#!/bin/sh # Home/Celerra v1.1 (c) 17.10.97 by Andreas Ley (u) 10.10.2003 # Einrichten des Homeverzeichnisses auf der Celerra usage() { echo "Usage: `basename $0` filesystem username uid gid" >&2 exit 1 } set -- `getopt hx $*` || usage trace=false while :; do case $1 in -h) sed '1d;s/^# *//;/^$/q' $0; usage;; -x) set -x; trace=true; shift;; --) shift; break;; esac done test $# -ne 4 && usage PATH=/usr/bin:/bin:/usr/machine/sbin export PATH fs="$1" user="$2" uid="$3" gid="$4" dir="${fs}/${user}" ################################################################################ # # Create home directory, set permissions, owner and group # mkdir -m 0700 "${dir}" || exit 1 chown "${uid}:${gid}" "${dir}" || exit 1 ################################################################################ # # Calculate list of commonly used hosts # In case of student user, create links to unix login initialization script # case "${fs}" in /export/rzfs-u?/user) targets="rzstud1.stud rzstud2.stud rzstud3.stud rzstud4.stud rzstud5.stud rzstud.stud www.stud" umask 222 owner "${dir}" /usr/bin/ln -s /home/ws/stud/bin/studinit "${dir}/.profile" || exit 1 owner "${dir}" /usr/bin/ln -s /home/ws/stud/bin/studinit "${dir}/.xprofile" || exit 1 ;; *) targets="rz70.rz rz73.rz rz80.rz rz81.rz rz82.rz rz90.rz rzaix.rz rzlx1.rz wwwrz.rz rzpool.rz" ;; esac ################################################################################ # # Create directory for WinSSH Hostkeys # umask 077 owner "${dir}" /usr/bin/mkdir -p "${dir}/w2k/profile/Application Data/SSH/HostKeys" || exit 1 # # Link WinSSH Hostkeys # umask 333 for target in ${targets}; do host=`echo ${target} | cut -d. -f1` subdomain=`echo ${target} | cut -d. -f2` for domain in "" ".${subdomain}" ".${subdomain}.uni-karlsruhe.de"; do cp -p "/usr/common/machine/etc/ssh2/hostkeys/key_24_${host}${domain}.pub" "${dir}/w2k/profile/Application Data/SSH/HostKeys" || exit 1 chown "${uid}:${gid}" "${dir}/w2k/profile/Application Data/SSH/HostKeys/key_24_${host}${domain}.pub" || exit 1 done done exit 0