Rev 84 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed
#!/bin/bash## Fix things during bootup - run first# For example: Enable services, etc ...# Executed at the very end of /etc/rc.d/rc.sysinit## Urs Beyerle, PSI#### -----------------------------------------------------------### Definitions### -----------------------------------------------------------# dir of mounted /$MOUNTDIR/liveMOUNTDIR=livecd# source functions. /$MOUNTDIR/live/liblinuxlive. /etc/init.d/functions### -----------------------------------------------------------### Get boot parameters### -----------------------------------------------------------# start afs?AFS=$( cmdline_parameter afs )CELL=$( cmdline_value cell )# or force no afs[ $( cmdline_parameter noafs ) ] && AFS=""# start ssh server?SSH=$( cmdline_parameter ssh )# root on NFS?NFSROOT=$( cmdline_value nfsroot )# PSI setup?PSI=$( cmdline_parameter psi )# do not start networkNONET=$( cmdline_parameter nonet )# Are PXE/TFTP and NFS Server the same host ? not uesed any moreONEMASTER=$( cmdline_parameter onemaster )# fast booting ?FASTBOOT=$( cmdline_parameter fastboot )# if run=rdesktop, we do fast bootif [ "$( cmdline_value run )" = "rdesktop" ]; thenFASTBOOT="fastboot"fi# start ntpd ?NTPD=$( cmdline_parameter ntpd )# services on/offSERVICEON=$( cmdline_value serviceon )SERVICEOFF=$( cmdline_value serviceoff )# Xserver configurationsSCREEN=$( cmdline_value screen )### -----------------------------------------------------------### Configure services### -----------------------------------------------------------### disable rpcidmapd, if LiveCD mounted over NFSif [ $NFSROOT ]; thenchkconfig rpcidmapd offfi### disable NetworkManager, if LiveCD mounted over NFSif [ $NFSROOT ]; thenchkconfig NetworkManager offchkconfig NetworkManagerDispatcher offfi### disable shutdown of network and nfs,# if we have the LiveCD mounted over NFSif [ $NFSROOT ]; thenif [ $ONEMASTER ]; then# "network off" is only necessary,# if PXE/TFTP and NTS server is on same machinechkconfig network offfirm -f /etc/rc.d/rc6.d/K75netfsrm -f /etc/rc.d/rc6.d/K86nfslockrm -f /etc/rc.d/rc6.d/K87portmaprm -f /etc/rc.d/rc6.d/K90networkrm -f /etc/rc.d/rc0.d/K75netfsrm -f /etc/rc.d/rc0.d/K86nfslockrm -f /etc/rc.d/rc0.d/K87portmaprm -f /etc/rc.d/rc0.d/K90networkfi### enable AFS during start up, if given by boot parameterif [ $AFS ]; thenchkconfig afs onfi### disable some services for fast bootingif [ $FASTBOOT ]; thenecho "Fast booting enabled"chkconfig vpnclient_init offchkconfig haldaemon offchkconfig pcmcia offchkconfig ntpd offchkconfig atd offchkconfig cpuspeed offchkconfig gpm offchkconfig messagebus offrm -rf /etc/rc.d/rc3.d/S04kudzu-autorm -rf /etc/rc.d/rc5.d/S04kudzu-autofi### enable ntpd?if [ $NTPD ]; thenchkconfig ntpd onfi### enable SSH server during start up, if given by boot parameterif [ $SSH ]; thenchkconfig sshd onfi### activate ipw3945d daemon, if we have Intel IPW3945 WLANif [ ! $NONET ]; thenlspci | grep -q Intel.*3945ABGif [ "$?" = "0" ]; thenchkconfig ipw3945d on 2>/dev/nullfifi### enable 915resolution on Intel Mobile Display controller# and set resolution in /etc/sysconfig/915resolution defined by screen=lspci | grep -q Display.*Intel.*Mobileif [ "$?" = "0" ]; thenchkconfig 915resolution on 2>/dev/nullif [ -e /etc/sysconfig/915resolution ]; thenX=$( echo $SCREEN | cut -d"x" -f1 )Y=$( echo $SCREEN | cut -d"x" -f2 )if [ $X ]; thensed -i "s|^X=.*|X=$X|" /etc/sysconfig/915resolutionfiif [ $Y ]; thensed -i "s|^Y=.*|Y=$Y|" /etc/sysconfig/915resolutionfififi### services onif [ -n $SERVICEON ]; thenfor service in `echo "$SERVICEON" | tr ':' ' '`; doif [ -f /etc/init.d/$service ]; thenchkconfig $service onfidonefi### services offif [ -n $SERVICEOFF ]; thenfor service in `echo "$SERVICEOFF" | tr ':' ' '`; doif [ -f /etc/init.d/$service ]; thenchkconfig $service offfidonefi### -----------------------------------------------------------### Main### -----------------------------------------------------------### get resolv.conf, if we have the LiveCD mounted over NFSif [ $NFSROOT ]; thencp -f /$MOUNTDIR/live/etc/resolv.conf /etc/fi### restore blacklist (modified in runveryfirst)if [ $NFSROOT ]; then[ -e /etc/hotplug/blacklist ] && BLACKLIST_FILE=/etc/hotplug/blacklist[ -e /etc/modprobe.d/blacklist ] && BLACKLIST_FILE=/etc/modprobe.d/blacklistmv -f ${BLACKLIST_FILE}.backup ${BLACKLIST_FILE}fi### create AFS mount pointmkdir -p /afs### set afs cell, if given by boot parameterif [ $CELL ]; thenecho $CELL > /usr/vice/etc/ThisCellfi### fix perm of /tmpchmod 1777 /tmp### link /opt -> /usr/opt !ln -s /usr/opt /opt### create homemkdir -p /home### create /scratchmkdir -p /scratchchmod 1777 /scratch### create /dataif [ $PSI ]; thenmkdir -p /datachmod 1777 /datafi### add PSI masterif [ $PSI ]; thenmkdir -p /mnt/masterecho "pxeserv01:/master /mnt/master nfs nfsvers=2,noauto,nolock,ro 0 0" >> /etc/fstabfi