Rev 216 | Blame | Compare with Previous | 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#### -----------------------------------------------------------### 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 )# fast booting ?FASTBOOT=$( cmdline_parameter fastboot )# no (auto) kudzu ?NOKUDZU=$( cmdline_parameter nokudzu )# 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 )### -----------------------------------------------------------### Set system clock again (code copied from rc.sysinit)### -----------------------------------------------------------ARC=0SRM=0UTC=0if [ -f /etc/sysconfig/clock ]; then. /etc/sysconfig/clock# convert old style clock config to new valuesif [ "${CLOCKMODE}" = "GMT" ]; thenUTC=trueelif [ "${CLOCKMODE}" = "ARC" ]; thenARC=truefifiCLOCKDEF=""CLOCKFLAGS="$CLOCKFLAGS --hctosys"case "$UTC" inyes|true) CLOCKFLAGS="$CLOCKFLAGS --utc"CLOCKDEF="$CLOCKDEF (utc)" ;;no|false) CLOCKFLAGS="$CLOCKFLAGS --localtime"CLOCKDEF="$CLOCKDEF (localtime)" ;;esaccase "$ARC" inyes|true) CLOCKFLAGS="$CLOCKFLAGS --arc"CLOCKDEF="$CLOCKDEF (arc)" ;;esaccase "$SRM" inyes|true) CLOCKFLAGS="$CLOCKFLAGS --srm"CLOCKDEF="$CLOCKDEF (srm)" ;;esac[ -x /sbin/hwclock ] && /sbin/hwclock $CLOCKFLAGSaction $"Setting clock $CLOCKDEF: `date`" /bin/true### -----------------------------------------------------------### Configure services### -----------------------------------------------------------### save status of services that may be disabled,# if LiveCD mounted over NFSif [ $NFSROOT ]; thenNFS_SERVICES="rpcidmapd NetworkManager NetworkManagerDispatcher \netfs nfslock portmap network"for serv in $NFS_SERVICES; dochkconfig --list $serv 2>/dev/null | grep -q ":on" && echo $serv >> /$MOUNTDIR/service.ondonefi### disable rpcidmapd, if LiveCD mounted over NFSif [ $NFSROOT ]; thenchkconfig rpcidmapd off >/dev/null 2>&1fi### disable NetworkManager, if LiveCD mounted over NFSif [ $NFSROOT ]; thenchkconfig NetworkManager off >/dev/null 2>&1chkconfig NetworkManagerDispatcher off >/dev/null 2>&1fi### disable shutdown of network and nfs,# if we have the LiveCD mounted over NFSif [ $NFSROOT ]; thenrm -f /etc/rc.d/rc6.d/K*netfsrm -f /etc/rc.d/rc6.d/K*nfslockrm -f /etc/rc.d/rc6.d/K*portmaprm -f /etc/rc.d/rc6.d/K*networkrm -f /etc/rc.d/rc0.d/K*netfsrm -f /etc/rc.d/rc0.d/K*nfslockrm -f /etc/rc.d/rc0.d/K*portmaprm -f /etc/rc.d/rc0.d/K*networkfi### enable AFS during start up, if given by boot parameterif [ $AFS ]; thenchkconfig afs onfi### disable auto-kudzu ?if [ $NOKUDZU ]; thenchkconfig kudzu-auto offfi### disable some services for fast bootingif [ $FASTBOOT ]; thenecho "Fast booting enabled"chkconfig vpnclient_init off 2>/dev/nullchkconfig haldaemon off 2>/dev/nullchkconfig pcmcia off 2>/dev/nullchkconfig ntpd off 2>/dev/nullchkconfig atd off 2>/dev/nullchkconfig cpuspeed off 2>/dev/nullchkconfig gpm off 2>/dev/nullchkconfig messagebus off 2>/dev/nullchkconfig avahi-daemon off 2>/dev/nullchkconfig kudzu-auto off 2>/dev/nullfi### 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, if screen= is given# and set correct resolution in /etc/sysconfig/915resolutionlspci | grep -q Display.*Intel.*Mobileif [ "$?" = "0" ] && [ $SCREEN ]; 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### create homemkdir -p /home### create /media, /misc, /netmkdir -p /media /misc /net### 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 noauto,nolock,ro 0 0" >> /etc/fstabfi