#!/bin/sh # # rc.local # # This script will setup the environment for a diskless workstation, as # part of the Linux Terminal Server Project (http://www.LTSP.org) # PATH=/ltsbin:/bin:$PATH:/usr/local/bin; export PATH . /etc/ltsp_functions # # Find out if we want to allow local applications # LOCAL_APPS=`get_cfg LOCAL_APPS N` # # Create and mount the ramdisk as the /tmp filesystem This # is the only place we can write files, because everything else # is read-only. # echo "Creating ramdisk on /tmp" RAMDISK_SIZE=`get_cfg RAMDISK_SIZE 1024` /sbin/mke2fs -q -m0 /dev/ram ${RAMDISK_SIZE} /bin/mount -t ext2 -n /dev/ram /tmp # Creation du /tmp/.etc chmod 7777 /tmp mkdir /tmp/.etc cat /etc/fstab.orig > /etc/fstab ################################################################################ # # Load some kernel modules # for i in 01 02 03 04 05 06 07 08 09 10; do MODULE=`get_cfg MODULE_${i}` if [ "${MODULE}" ]; then /sbin/insmod /modules/${MODULE} fi done DEFAULT_SERVER=`get_cfg SERVER 192.168.0.254` ################################################################################ # # Mount filesystems # NFS_OPTIONS=`get_cfg NFS_OPTIONS nolock` if [ "${LOCAL_APPS}" = "Y" ]; then echo "Mounting additional filesystems..." mount -t nfs -o ${NFS_OPTIONS} ${DEFAULT_SERVER}:/usr /usr mount -t nfs -o ${NFS_OPTIONS} ${DEFAULT_SERVER}:/sbin /sbin mount -t nfs -o ${NFS_OPTIONS} ${DEFAULT_SERVER}:/bin /bin mount -t nfs -o ${NFS_OPTIONS} ${DEFAULT_SERVER}:/lib /lib fi # Ajout de la route par defaut /sbin/route add default gw ${DEFAULT_SERVER} dev eth0 mkdir /tmp/.mnt mkdir /tmp/.dev mknod /tmp/.dev/console c 4 0 mknod /tmp/.dev/tty0 c 4 0 echo "Setting up loopback device" /sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0 broadcast 127.255.255.255 # Creation de quelques dossier temporaires necessaires mkdir /tmp/.var mkdir /tmp/.var/tmp mkdir /tmp/.var/run mkdir /tmp/.var/run/console mkdir /tmp/.var/run/nscd mkdir /tmp/.var/log mkdir /tmp/.var/log/gdm mkdir /tmp/.var/log/hotplug touch /tmp/.var/log/hotplug/events mkdir /tmp/.var/lock mkdir /tmp/.var/lock/subsys mkdir /tmp/.var/lib mkdir /tmp/.var/lib/xkb mkdir /tmp/.var/lib/texmf mkdir /tmp/.var/lib/menu mkdir /tmp/.var/lib/gnome mkdir /tmp/.var/lib/nfs mkdir /tmp/.var/lib/nfs/statd mkdir /tmp/.var/gdm mkdir /tmp/.var/spool mkdir /tmp/.var/spool/lpd mkdir /tmp/.var/ntp mkdir /tmp/igs mkdir /tmp/.ICE-unix if [ "${LOCAL_APPS}" = "Y" ]; then echo "montage supplémentaire pour TeX et gnome (ces dossiers doivent etre accessible depuis le serveur" mount -t nfs -o ${NFS_OPTIONS} ${DEFAULT_SERVER}:/var/lib/texmf /var/lib/texmf mount -t nfs -o ${NFS_OPTIONS} ${DEFAULT_SERVER}:/var/lib/menu /var/lib/menu mount -t nfs -o ${NFS_OPTIONS} ${DEFAULT_SERVER}:/var/lib/gnome /var/lib/gnome fi # Autres dossiers et permissions chmod 0666 /tmp/.dev/null chmod 0750 /tmp/.var/gdm chown 42:42 /tmp/.var/gdm chown 4:7 /tmp/.var/spool/lpd chmod 700 /tmp/.var/spool/lpd chown 4000:4000 /tmp/igs chmod 1777 /tmp/.ICE-unix chmod 7777 /tmp/.var/tmp touch /tmp/.var/log/lastlog touch /tmp/.var/log/wtmp chmod 664 /tmp/.var/log/wtmp chown rpcuser:rpcuser /tmp/.var/lib/nfs/statd/ echo "System initialization:" /etc/rc.d/rc.sysinit ################################################################################ # # Setup the XF86Config file # XF86CONFIG_FILE=`get_cfg XF86CONFIG_FILE` if [ ! -z "${XF86CONFIG_FILE}" ]; then # # If XF86CONFIG_FILE is defined in the lts.conf file, then # it points to an XF86Config file that is pre-made for a workstation # if [ -f /etc/X11/${XF86CONFIG_FILE} ]; then cp /etc/X11/${XF86CONFIG_FILE} /etc/X11/XF86Config else # # on Debian, XF86Config usually resides in /etc/X11, so try that also. # a sysadmin may be used to that location. # cp /etc/X11/XF86Config-default /etc/X11/XF86Config fi else # # Build the XF86Config file from entries in the lts.conf file # /bin/sh /etc/rc.setupx fi ################################################################################ # # Check the hostname # HOSTNAME=`hostname` echo "Current hostname: ${HOSTNAME}" echo "127.0.0.1 localhost ${HOSTNAME}" >/etc/hosts ################################################################################ # # Start the syslog daemon # SYSLOG_HOST=`get_cfg SYSLOG_HOST ${DEFAULT_SERVER}` # Soit un log sur le serveur : echo "*.* @${DEFAULT_SERVER}" > /etc/syslog.conf # Soit un log sur le client mais perdu au reboot : #echo "*.* -/var/log/messages" > /etc/syslog.conf ################################################################################ # # Local app daemon stuff # if [ "${LOCAL_APPS}" = "Y" ]; then echo "Demarrage HOTPlug" /etc/init.d/hotplug start /etc/init.d/udev start /etc/init.d/syslog start /etc/init.d/portmap start echo "Demarrage de sshd" mkdir /var/empty mkdir /var/empty/sshd chmod 111 /var/empty/sshd /usr/sbin/sshd echo "Demarrage de xfs" /usr/X11R6/bin/xfs -droppriv -daemon /sbin/setsysfont echo "Demarrage de lockd" /etc/init.d/nfslock start echo "Demarrage de NTP" echo "92.010" > /etc/ntp/drift /etc/init.d/ntpd start echo "Creating SWAP" SWAPSIZE=`get_cfg SWAPSIZE 20480` dd if=/dev/zero of=/tmp/swapfile bs=1024 count=${SWAPSIZE} mkswap /tmp/swapfile swapon /tmp/swapfile echo "Demarrage de nscd" /usr/sbin/nscd echo "Montage des partitions" mount -a 2> /dev/null echo "Demarrage ALSA" /etc/init.d/alsa start /etc/init.d/sound start fi