CipUX Feature RefineHomedir

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

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

(2) reset a given home directory

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.