### Fat Client Plugin based on workstation plugin -- (Nubae) David Van Assche ### Normal usage is ltsp-build-client --fatclient --highfat for all packages ### and ltsp-build-client --fatclient for minimal install including edu packages, firefox and evolution ### v. 0.8 -- fixed copy accounts to fat client environment, added some packages ### v 0.8.1 -- fixed missing leading / from line 134 -- thanks S Verma ### v 0.8.2 -- took out superflous code and modified $TMP variable to work with Jaunty, where the $TMP is used in another script ### v 0.8.3 -- Various updates by Markus Kienast, including automated discovery of correct repo for distribution. case "$MODE" in commandline) add_option "fatclient" "`eval_gettext "low fat netbooted diskless workstation mode, e.g --fat-client Ubuntu"`" "advanced" "true" add_option "highfat" "`eval_gettext "fat client with full multimedia, used in conjunction with --fat-client"`" "advanced" "false" ;; configure) if [ -n "$option_fatclient_value" ]; then TARGETS="Ubuntu" for TMPER in $(echo $option_fatclient_value | tr ',' ' ') ; do if [[ $TARGETS == *$TMPER* ]]; then if [[ $FATCLIENT != *$TMPER* ]]; then FATCLIENT="$FATCLIENT $TMPER" fi fi done if [ -n "$option_highfat_value" ]; then HIGHFAT="True" fi HIGHFAT=$(echo $HIGHFAT) if [ -z "$FATCLIENT" ]; then echo Sorry, $option_fatclient_value cannot be installed. exit fi COMPONENTS="main restricted universe multiverse" RCS_WHITELIST="$RCS_WHITELIST pcmciautils brltty screen urandom udev-finish portmap nfs-common" RC2_WHITELIST="$RC2_WHITELIST portmap nfs-common vbesave acpid powernowd.early dbus hal cupsys apport \ hotkey-setup powernowd consolekit avahi-daemon bluetooth gdm anacron atd cron acpi-support rc.local" RC6_WHITELIST="$RC6_WHITELIST portmap" RC0_WHITELIST="$RC0_WHITELIST portmap" RC2_WHITELIST="$RC2_WHITELIST gdm" fi ;; after-install) if [ -n "$FATCLIENT" ]; then # guess from the LANG environment which localized packages # are to be installed, check that they exist function add_localized_packages { for i in $* ; do for j in $(chroot $ROOT apt-cache -n search $i-$SHORT_LANG | awk '{print $1}') ; do if [ $j == $i-$SHORT_LANG ]; then WORKSTATION_PACKS="$WORKSTATION_PACKS $j" fi done done } # install the right packages for the lowfat Workstation # # another place for locale echo LANG=\"$LANG\" > $ROOT/etc/default/locale SHORT_LANG=$(echo $LANG | sed 's/\(.*\)_.*/\1/') for WORKSTATION_DESK in $FATCLIENT ; do WORKSTATION_PACKS="$WORKSTATION_PACKS ubuntu-desktop language-pack-gnome-de flashplugin-nonfree pidgin" if [ $HIGHFAT == True ] ; then echo "deb http://archive.canonical.com/ubuntu `lsb_release -cs` partner" >> $ROOT/etc/apt/sources.list wget http://www.medibuntu.org/sources.list.d/`lsb_release -cs`.list --output-document=$ROOT/etc/apt/sources.list.d/medibuntu.list chroot $ROOT apt-get update chroot $ROOT apt-get --yes --allow-unauthenticated install medibuntu-keyring chroot $ROOT apt-get update WORKSTATION_PACKS="$WORKSTATION_PACKS openoffice.org openclipart-openoffice.org ubuntu-restricted-extras vlc mplayer banshee inkscape celestia mozilla-mplayer acroread realplayer scribus mozilla-plugin-vlc vlc-plugin-pulse" fi if [ $SHORT_LANG != en ]; then add_localized_packages language-pack-gnome fi done WORKSTATION_PACKS="$WORKSTATION_PACKS language-pack-en language-support-en fdutils fuse-utils ubuntu-standard nfs-common portmap" if [ $SHORT_LANG != en ]; then add_localized_packages language-pack language-support fi chroot $ROOT apt-get $APT_GET_OPTS --force-yes install $WORKSTATION_PACKS # remove network-manager it causes trouble WORKSTATION_PACKS=network-manager # Take out apparmor, since it causes problems WORKSTATION_PACKS=apparmor # remove second window manager WORKSTATION_PACKS=kdm chroot $ROOT apt-get $APT_GET_OPTS --force-yes --purge remove $WORKSTATION_PACKS # Now perform local setup similar to main installer # # fixed in ltsp >= 5.0.40 if [[ -e /etc/timezone ]]; then cp /etc/timezone $ROOT/etc/timezone fi if [[ -e /etc/localtime ]]; then cp /etc/localtime $ROOT/etc/localtime fi ### Copy non system accounts to fat client export UGIDLIMIT=1000 awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd >> $ROOT/etc/passwd awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group >> $ROOT/etc/group awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow >> $ROOT/etc/shadow ### Set admin and add admin user to sudoers echo " -------------------------------------------------------------- Please enter the main admin user with root privileges! " read TMP grep $TMP /etc/group >> $ROOT/etc/group chmod 600 $ROOT/etc/sudoers echo "## Members of the admin group may gain root privileges %admin ALL=(ALL) ALL" >> $ROOT/etc/sudoers chmod 440 $ROOT/etc/sudoers ### Make sure pulseserver runs on localhost and defaults to use pulse for all audio apps. chroot $ROOT echo "default_driver=pulse" >> /etc/pulse/client.conf chroot $ROOT echo "default_server=127.0.0.1" >> /etc/pulse/client.conf ### adjust policykit to mount fixed drives without whining sed -ie "s/auth_admin_keep_always<\/allow_active>//" /usr/share/PolicyKit/policy/org.freedesktop.hal.storage.policy ### Discover server ips, split and show eth1 only IPS=$(ip -o -f inet addr show | sed -e 's,.* \(.*\)/.*,\1,' | grep -v '^127') set -- $IPS eth0=$1 shift eth1=$@ ### Add nfs startup script for lts.conf cat <> $ROOT/etc/nfsmounts.sh # nfs starts before portmap so mounts fail, so we restart portmap here /etc/init.d/portmap restart mount -t nfs $eth1:/home /home EOF ### make cronjob to extract users to admin user folder in shared nfs directory cat < /etc/cron.hourly/copyusers #!/bin/sh set -e awk -v LIMIT=$UGIDLIMIT -F: '(\$3>=LIMIT) && (\$3!=65534)' /etc/passwd > /home/$TMP/.passwd awk -v LIMIT=$UGIDLIMIT -F: '(\$3>=LIMIT) && (\$3!=65534)' /etc/group > /home/$TMP/.group grep $TMP /etc/group >> /home/$TMP/.group | sort -u /home/$TMP/.group -o /home/$TMP/.group awk -v LIMIT=$UGIDLIMIT -F: '(\$3>=LIMIT) && (\$3!=65534) {print \$1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /home/$TMP/.shadow EOF chmod a+x /etc/cron.hourly/copyusers ### make cronjob to copy users from nfs admin shared folder and integrate into /etc cat < $ROOT/etc/cron.hourly/copyusers #!/bin/sh set -e cat /home/$TMP/.passwd >> /etc/passwd cat /etc/passwd |sort -u /etc/passwd -o /etc/passwd cat /home/$TMP/.group >> /etc/group cat /etc/group |sort -u /etc/group -o /etc/group cat /home/$TMP/.shadow >> /etc/shadow cat /etc/shadow |sort -u /etc/shadow -o /etc/shadow EOF chmod a+x $ROOT/etc/cron.hourly/copyusers # execute copyusers on startup if [[ -e /var/lib/tftpboot/ltsp/$CHROOT/lts.conf ]]; then rm /var/lib/tftpboot/ltsp/$CHROOT/lts.conf fi if [[ ! -e /var/lib/tftpboot/ltsp/$CHROOT ]]; then mkdir /var/lib/tftpboot/ltsp/$CHROOT fi echo "[default]" > /var/lib/tftpboot/ltsp/$CHROOT/lts.conf echo "RCFILE_10=/etc/cron.hourly/copyusers" >> /var/lib/tftpboot/ltsp/$CHROOT/lts.conf # get the write-permission for a couple directories and files right for unionfs echo 'copy_dirs="$copy_dirs /var/lib/urandom"' >> $ROOT/etc/default/ltsp-client-setup echo 'rw_dirs="$rw_dirs /var/lib/gdm"' >> $ROOT/etc/default/ltsp-client-setup # give the client its dhcpd assigned hostname, you have to add # "use-host-decl-names on;" to its group section in /etc/ltsp/dhcpd.conf sed -i '/bindfiles=/s/\/etc\/hostname//' $ROOT/etc/default/ltsp-client-setup sed -i '/bindfiles=/s/\/etc\/network\/interfaces//' $ROOT/etc/default/ltsp-client-setup cat <> $ROOT/etc/network/interfaces auto lo iface lo inet loopback iface eth0 inet dhcp auto eth0 EOF ### add nfs script entry to lts.conf and make executable chmod a+x $ROOT/etc/nfsmounts.sh echo "RCFILE_09=/etc/nfsmounts.sh" >> /var/lib/tftpboot/ltsp/$CHROOT/lts.conf ### Get cupsys to connect to server for printers echo "ServerName $eth1" > $ROOT/etc/cups/client.conf # These cron jobs are not needed if we run them now or have done already if [ -e $ROOT/etc/cron.daily/find.notslocate ]; then chroot $ROOT /etc/cron.daily/find.notslocate rm -f $ROOT/etc/cron.daily/find.notslocate $ROOT/etc/cron.daily/slocate fi if [ -e $ROOT/etc/cron.daily/man-db ]; then chroot $ROOT mandb rm -f $ROOT/etc/cron.*/man-db fi rm -f $ROOT/etc/cron.*/scrollkeeper # large log files echo -n "" > $ROOT/var/log/dpkg.log echo -n "" > $ROOT/var/log/scrollkeeper.log fi ;; finalization) esac