#---------------------------------------------------------------------------- # /etc/rc.d/rc000.base # was file /etc/rc.local # # Creation: 25.09.2000 fm # Last Update: $Id$ # # Copyright (c) 2000-2002 Frank Meyer #---------------------------------------------------------------------------- begin_script RC000_BASE "basic setup..." [ "$CONSOLE_BLANK_TIME" ] && echo -e "\33[9;$CONSOLE_BLANK_TIME]" #---------------------------------------------------------------------------- # set local time zone #---------------------------------------------------------------------------- TZ=$TIME_INFO export TZ echo $TZ > /etc/TZ echo export TZ=$TIME_INFO >>/.profile if [ "$OPT_Y2K" = "yes" ] then add-days --utc $Y2K_DAYS echo 1 >/var/run/broken_rtc # used by chrony else if [ -z "`dmesg | grep 'Booting paravirtualized kernel on Xen'`" ] then do_modprobe_if_exists kernel/drivers/char rtc # for kernel 2.6.16.x do_modprobe_if_exists kernel/drivers/rtc rtc-cmos # for kernel > 2.6.16 [ -c /dev/rtc0 ] && ln -s /dev/rtc0 /dev/rtc if [ -f /sbin/hwclock ] then > /var/run/utmp hwclock --hctosys --cpupriority=99 --nodrift fi fi fi #---------------------------------------------------------------------------- # initialize counter for ttyI devices #---------------------------------------------------------------------------- echo 0 >/var/run/next_ttyI #---------------------------------------------------------------------------- # mount boot device #---------------------------------------------------------------------------- if [ "$boot_dev" -a "$boot_fs" ] then mopt= case $boot_fs in vfat) mopt=',umask=077' ;; esac case "$MOUNT_BOOT" in ro) echo "$boot_dev /boot $boot_fs ro$mopt" >> /etc/fstab mount /boot ;; rw) echo "$boot_dev /boot $boot_fs defaults$mopt" >> /etc/fstab mount /boot # is /boot really writeable (a write-protected floppy will # be mountet ro) if [ -z "`cat /proc/mounts | sed -n '/\/boot .*[ ,]rw[ ,]/p'`" ] then MOUNT_BOOT='ro' log_error "WARNING: boot media is write protected, check variable MOUNT_BOOT" fi ;; *) # /boot entry in fstab is needed for recovery-mode of # hd-installation echo "$boot_dev /boot $boot_fs noauto$mopt" >> /etc/fstab ;; esac fi #---------------------------------------------------------------------------- # set hostname #---------------------------------------------------------------------------- hostname $HOSTNAME # set hostname >/etc/inetd.conf # truncate inetd.conf #---------------------------------------------------------------------------- # patch shadow file with our password - but only if password filled #---------------------------------------------------------------------------- sed -i -e "s#^root:\*:#root:$PASSWORD:#;s#^fli4l:\*:#fli4l:$PASSWORD:#" /etc/shadow #---------------------------------------------------------------------------- # prepare service restart infrastructure #---------------------------------------------------------------------------- service-restart.sh start #---------------------------------------------------------------------------- # configure ISA PNP devices: #---------------------------------------------------------------------------- if [ -f /sbin/isapnp -a -f /etc/isapnp.conf ] then pnpdump -r >/dev/null 2>&1 # reset pnp devices isapnp /etc/isapnp.conf fi #---------------------------------------------------------------------------- # configure dynamic ip addresses #---------------------------------------------------------------------------- if [ "$IP_DYN_ADDR" = "yes" ] then echo 7 >/proc/sys/net/ipv4/ip_dynaddr # enable dyn ip addresses fi [ "$DEBUG_IPUP" = yes ] && > /var/run/debug_ipup #---------------------------------------------------------------------------- # rename netfilter modules (actually use ln to give them an alias name) #---------------------------------------------------------------------------- rename_netfilter_modules () { dir=$1 prefix=$2 postfix=$3 if [ -d $dir ] then cd $dir for i in $prefix*target* do if [ -f $i ] then target=`echo $i | sed -e "s/${prefix}_\([^._]*\).*/\1/g" | \ tr 'a-z' 'A-Z'` name=${prefix}_${target}.$postfix ln -s $i $name case $postfix in so) ;; *) sed -i -e "s/$i/$name/g" /lib/modules/${kernel_version}/modules.dep ;; esac fi done fi } rewrite_name () { case $1 in *_target) set `echo $1 | sed -e 's/_/ /g'` echo "$1_`echo $2 | tr a-z A-Z`" ;; *) echo $1 ;; esac } fix_module_aliases () { file=$1 while read line; do case $line in alias*symbol:*) echo $line ;; alias*_target*) set $line echo "$1 `rewrite_name $2` `rewrite_name $3`" ;; *) echo $line ;; esac done < $file > $file.$$ mv $file.$$ $file } rename_netfilter_modules /lib/iptables libipt so rename_netfilter_modules /lib/iptables libip6t so rename_netfilter_modules /lib/iptables libxt so rename_netfilter_modules /lib/modules/${kernel_version}/kernel/net/ipv4/netfilter ipt $mod_ext rename_netfilter_modules /lib/modules/${kernel_version}/kernel/net/ipv6/netfilter ip6t $mod_ext rename_netfilter_modules /lib/modules/${kernel_version}/kernel/net/netfilter xt $mod_ext [ -f /etc/modprobe.conf ] && fix_module_aliases /etc/modprobe.conf #---------------------------------------------------------------------------- # insert lockcommand into iptables calls #---------------------------------------------------------------------------- if [ -f /sbin/lockcommand ] then mv /sbin/iptables /sbin/iptables.real ln /sbin/lockcommand /sbin/iptables fi #---------------------------------------------------------------------------- # configure keyboard locale #---------------------------------------------------------------------------- if [ -f /etc/*.map ] then cat /etc/*.map | loadkmap fi chmod 400 /etc/shadow # create alias name for imond-stat ln -s /usr/local/bin/imond-stat /usr/local/bin/imond-send # if /etc/fonts/conf.avail exist create a symlink to /etc/fonts/conf.d [ -d /etc/fonts/conf.avail ] && ln -s /etc/fonts/conf.avail /etc/fonts/conf.d # to make the collectd and libsensor happy create an empty sensors3.conf file [ -d /etc/sensors.d -a ! -e /etc/sensors3.conf ] && echo "#" > /etc/sensors3.conf # wrap ip if needed if [ "$DEBUG_IP" ]; then mv /bin/ip /usr/local/bin/wrapped ln -s /usr/local/bin/wrapper.sh /bin/ip fi # rename /etc/ppp/filter.ntp if avaiable [ -e /etc/ppp/filter.ntp ] && mv -f /etc/ppp/filter.ntp /etc/ppp/filter end_script