Differences between revisions 3 and 4
Revision 3 as of 2006-11-05 02:49:04
Size: 6099
Comment: more little mistakes
Revision 4 as of 2008-02-10 02:00:39
Size: 6163
Comment: CipUX is generic, not something specific to DebianEdu.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from DebianEdu/CipUX/Feature/RefineHomedir

CipUX Feature RefineHomedir

This page describes briefly the implementation of the refine_homedir feature for CipUX.

?TableOfContents

Status of the project:

CipUX Netgroup Feature

Name:

CipUX_Feature_?RefineHomedir

Status:

implemented

Programmer:

MartinHerweg, ChristianKuelker

available in:

3.2.0

release:

2005-04-05

implemented in:

cipux-cibot

Description

This feature have two purposes:

(1) restore a given home directory

  • restore means to synchronize the skel data with the homedir. Normally this means that every file from the skel is copied (in real it as a rsync diff) from the skel to the homedir Pupil tend to play with config files (they learn) and destroy them. The restore mode is there to put everthing in order without deleting the own data of the user. This function can also be use to resync the standard desktop after changeing the standard desktop of the skeluser.

(2) reset a given home directory

  • reset means to wipe the homedir out and create it again and copy the skel back. This is the tool of last resort.

Implementation

It is implemented in the script:

cipux_refine_homedir

Usage

This will restore the home of bilbo

cipux_refine_homedir restore /skole/tjener/home0 student bilbo

This will wipe out the home of sauron

cipux_refine_homedir reset /skole/tjener/home0 teacher sauron

This will resynchronise all student desktops (if the desktop was configured properly inside the student account)

for user in `cipux_task_list_students`; do
  cipux_refine_homedir restore /skole/tjener/home0 student $user;
done

New in 3.2.12

It is always a problem to distribute the user data to the application. In some cases this can be automated now:

Scripts can now be written and executed after reset and restore which modify the user configuration.

Example mutt

If you have a institution where the name of the mailserver is equal for all users and the UID is the first part of the mail address then every account can have its own configuration calculated:

Mailserver domain: myschool.skolelinux.de

UID: bilbo

role: student

You can have this muttrc (part) inside /skole/tjener/home0/student/

...
set imap_login="student"
set smtp_host="localhost"
my_hdr bcc:student@myschool.skolelinux.de
...

Then this will be changed by refinement to:

...
set imap_login="bilbo"
set smtp_host="localhost"
my_hdr bcc:bilbo@myschool.skolelinux.de
...

How can this be done?

create the file, for example /etc/cipux/refine.d/enabled/mutt.sh

#
#  mutt
#

MODE=$1
PATH=$2
ROLE=$3
USER=$4

TARGET=.muttngrc
SOURCE=$PATH/$ROLE/$TARGET
DESTINATION=$PATH/$USER/$TARGET


if [ "$MODE" == "restore" ]; then
  if [ -e $DESTINATION ]; then 
    sed -i -e "s/$ROLE/$USER/;"  $DESTINATION
  fi
fi

if [ "$MODE" == "reset" ]; then
  if [ -e $SOURCE ]; then 
    if [ -e $DESTINATION ]; then 
      sed -e "s/$ROLE/$USER/;" $SOURCE > $DESTINATION
    fi
  fi
fi

Then execute:

cipux_refine_homedir restore /skole/tjener/home0 student bilbo

Discussion

This solution is far from beeing perfect. It has some limits. But is working from 2005 in serveral installations.

pros

working

teacher can write add ons easily with shell

cons

only UID, role, path and mode can be set so far

This section is for comments of enancing this concept. So please feel free to write your ideas.