diff options
Diffstat (limited to 'source/ap')
-rw-r--r-- | source/ap/lxc/scripts/rc.6.lxc | 21 | ||||
-rw-r--r-- | source/ap/lxc/scripts/rc.6.orig | 28 | ||||
-rw-r--r-- | source/ap/lxc/scripts/rc.M.lxc | 65 | ||||
-rw-r--r-- | source/ap/lxc/scripts/rc.M.orig | 67 | ||||
-rw-r--r-- | source/ap/lxc/scripts/rc.S.lxc | 68 | ||||
-rw-r--r-- | source/ap/lxc/scripts/rc.S.orig | 68 | ||||
-rw-r--r-- | source/ap/lxc/scripts/rc.inet1.lxc | 40 | ||||
-rw-r--r-- | source/ap/lxc/scripts/rc.inet1.orig | 40 |
8 files changed, 255 insertions, 142 deletions
diff --git a/source/ap/lxc/scripts/rc.6.lxc b/source/ap/lxc/scripts/rc.6.lxc index 7fd57ef2..73923da9 100644 --- a/source/ap/lxc/scripts/rc.6.lxc +++ b/source/ap/lxc/scripts/rc.6.lxc @@ -44,6 +44,10 @@ case "$0" in ;; esac +# Restart init. This prevents init from hanging on to file handles for removed +# glibc shared libraries in the case that those were upgraded or reinstalled. +/sbin/telinit u + # Save the system time to the hardware clock using hwclock --systohc. # This will also create or update the timestamps in /etc/adjtime. if [ -x /sbin/hwclock -a -z "$container" ]; then @@ -114,6 +118,11 @@ if [ -x /etc/rc.d/rc.openldap ]; then /etc/rc.d/rc.openldap stop fi +# Stop the haveged entropy daemon: +if [ -x /etc/rc.d/rc.haveged -a -z "$container" ]; then + /etc/rc.d/rc.haveged stop +fi + # Stop D-Bus: if [ -x /etc/rc.d/rc.messagebus ]; then /etc/rc.d/rc.messagebus stop @@ -122,10 +131,10 @@ fi # Kill any processes (typically gam) that would otherwise prevent # unmounting NFS volumes: unset FUSER_DELAY -for dir in $(/bin/mount | grep 'type nfs ' | cut -d ' ' -f 3 ) ; do +for dir in $(/bin/mount | grep 'type nfs ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1) ; do echo "Killing processes holding NFS mount $dir open..." # Background this to prevent fuser from also blocking shutdown: - /usr/bin/fuser -k -m $dir & + /usr/bin/fuser -k -M -m "$dir" & FUSER_DELAY=5 done # If fuser was run, let it have some delay: @@ -236,7 +245,11 @@ fi if [ -z "$container" ]; then echo "Unmounting local file systems:" - /bin/umount -v -a -t no,proc,sysfs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g" 2> /dev/null + /bin/umount -v -a -t no,proc,sysfs,devtmpfs,fuse.gvfsd-fuse,tmpfs + # JFS needs a sync here or the / partition cannot be remounted read-only. + # In spite of this, it seems that a JFS root partition will always be checked + # (and found to be clean) at boot: + /bin/sync echo "Remounting root filesystem read-only:" /bin/mount -v -n -o remount,ro / fi @@ -269,7 +282,7 @@ fi if [ -z "$container" ]; then if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then echo "Deactivating LVM volume groups:" - /sbin/vgchange -an --ignorelockingfailure + /sbin/vgchange -an fi fi diff --git a/source/ap/lxc/scripts/rc.6.orig b/source/ap/lxc/scripts/rc.6.orig index 23c280d9..e3986db8 100644 --- a/source/ap/lxc/scripts/rc.6.orig +++ b/source/ap/lxc/scripts/rc.6.orig @@ -37,6 +37,10 @@ case "$0" in ;; esac +# Restart init. This prevents init from hanging on to file handles for removed +# glibc shared libraries in the case that those were upgraded or reinstalled. +/sbin/telinit u + # Save the system time to the hardware clock using hwclock --systohc. # This will also create or update the timestamps in /etc/adjtime. if [ -x /sbin/hwclock ]; then @@ -107,6 +111,11 @@ if [ -x /etc/rc.d/rc.openldap ]; then /etc/rc.d/rc.openldap stop fi +# Stop the haveged entropy daemon: +if [ -x /etc/rc.d/rc.haveged ]; then + /etc/rc.d/rc.haveged stop +fi + # Stop D-Bus: if [ -x /etc/rc.d/rc.messagebus ]; then /etc/rc.d/rc.messagebus stop @@ -115,10 +124,10 @@ fi # Kill any processes (typically gam) that would otherwise prevent # unmounting NFS volumes: unset FUSER_DELAY -for dir in $(/bin/mount | grep 'type nfs ' | cut -d ' ' -f 3 ) ; do +for dir in $(/bin/mount | grep 'type nfs ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1) ; do echo "Killing processes holding NFS mount $dir open..." # Background this to prevent fuser from also blocking shutdown: - /usr/bin/fuser -k -m $dir & + /usr/bin/fuser -k -M -m "$dir" & FUSER_DELAY=5 done # If fuser was run, let it have some delay: @@ -225,8 +234,19 @@ if [ -x /etc/rc.d/rc.cgmanager ]; then /etc/rc.d/rc.cgmanager stop fi +# Umount all tmpfs mounts except /dev/shm and under /run: +cat /proc/mounts | grep " tmpfs " | grep -v -e " /run " -e " /run/" -e " /dev/shm " | while read mount ; do + umount --recursive -v $(echo $mount | cut -f 2 -d ' ') 2> /dev/null +done + +# Unmount local file systems: echo "Unmounting local file systems:" -/bin/umount -v -a -t no,proc,sysfs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g" 2> /dev/null +/bin/umount -v -a -t no,proc,sysfs,devtmpfs,fuse.gvfsd-fuse,tmpfs + +# JFS needs a sync here or the / partition cannot be remounted read-only. +# In spite of this, it seems that a JFS root partition will always be checked +# (and found to be clean) at boot: +/bin/sync echo "Remounting root filesystem read-only:" /bin/mount -v -n -o remount,ro / @@ -258,7 +278,7 @@ fi # Deactivate LVM volume groups: if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then echo "Deactivating LVM volume groups:" - /sbin/vgchange -an --ignorelockingfailure + /sbin/vgchange -an fi # This never hurts again (especially since root-on-LVM always fails diff --git a/source/ap/lxc/scripts/rc.M.lxc b/source/ap/lxc/scripts/rc.M.lxc index 2b16190e..8cab0150 100644 --- a/source/ap/lxc/scripts/rc.M.lxc +++ b/source/ap/lxc/scripts/rc.M.lxc @@ -27,10 +27,10 @@ if [ -x /sbin/ldconfig ]; then /sbin/ldconfig & fi -# Screen blanks after 15 minutes idle time, and powers down in one hour -# if the kernel supports APM or ACPI power management: -if [ -z "$container" ]; then - /bin/setterm -blank 15 -powersave powerdown -powerdown 60 +# Call the setterm init script to set screen blanking and power management +# defaults: +if [ -x /etc/rc.d/rc.setterm -a -z "$container" ]; then + /etc/rc.d/rc.setterm fi # Set the hostname. @@ -105,6 +105,16 @@ if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems ; then fi fi +# Start the haveged entropy daemon: +if [ -x /etc/rc.d/rc.haveged -a -z "$container" ]; then + /etc/rc.d/rc.haveged start +fi + +# Start the rngd entropy daemon: +if [ -x /etc/rc.d/rc.rngd -a -z "$container" ]; then + /etc/rc.d/rc.rngd start +fi + # Initialize the networking hardware. if [ -x /etc/rc.d/rc.inet1 ]; then /etc/rc.d/rc.inet1 @@ -115,6 +125,11 @@ if [ -x /etc/rc.d/rc.messagebus ]; then /etc/rc.d/rc.messagebus start fi +# Start console-kit-daemon: +if [ -x /etc/rc.d/rc.consolekit ]; then + /etc/rc.d/rc.consolekit start +fi + # Start Bluetooth: if [ -x /etc/rc.d/rc.bluetooth ]; then /etc/rc.d/rc.bluetooth start @@ -146,8 +161,7 @@ if [ -x /etc/rc.d/rc.ntpd ]; then fi # Remove stale locks and junk files (must be done after mount -a!) -/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/core /core 2> /dev/null -/bin/rm -rf /var/spool/cron/cron.?????? 2> /dev/null +/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/.X11-unix/* 2> /dev/null # Remove stale hunt sockets so the game can start. if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then @@ -191,11 +205,6 @@ if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then /usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null & fi -# Start console-kit-daemon: -if [ -x /etc/rc.d/rc.consolekit ]; then - /etc/rc.d/rc.consolekit start -fi - # Start HAL: if [ -x /etc/rc.d/rc.hald ]; then /etc/rc.d/rc.hald start @@ -217,7 +226,7 @@ fi if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then echo "Updating gdk-pixbuf.loaders:" echo " /usr/bin/update-gdk-pixbuf-loaders &" - /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1 & + HOME=/root /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1 & fi if [ -x /usr/bin/update-pango-querymodules ]; then echo "Updating pango.modules:" @@ -255,12 +264,10 @@ if [ -x /etc/rc.d/rc.atalk ]; then fi # Start smartd, which monitors the status of S.M.A.R.T. compatible -# hard drives and reports any problems. Note some devices (which aren't -# smart, I guess ;) will hang if probed by smartd, so it's commented out -# by default. -#if [ -x /usr/sbin/smartd ]; then -# /usr/sbin/smartd -#fi +# hard drives and reports any problems: +if [ -x /etc/rc.d/rc.smartd -a -z "$container" ]; then + /etc/rc.d/rc.smartd start +fi # Monitor the UPS with genpowerd. # To use this, uncomment this section and edit your settings in @@ -285,15 +292,13 @@ if [ -x /sbin/accton -a -r /var/log/pacct ]; then fi # Start crond (Dillon's crond): -# If you want cron to actually log activity to /var/log/cron, then change -# -l notice to -l info to increase the logging level. -if [ -x /usr/sbin/crond ]; then - /usr/sbin/crond -l notice +if [ -x /etc/rc.d/rc.crond ]; then + /etc/rc.d/rc.crond start fi # Start atd (manages jobs scheduled with 'at'): -if [ -x /usr/sbin/atd ]; then - /usr/sbin/atd -b 15 -l 1 +if [ -x /etc/rc.d/rc.atd ]; then + /etc/rc.d/rc.atd start fi # Slackware-Mini-Quota-HOWTO: @@ -386,6 +391,18 @@ if [ -x /etc/rc.d/rc.gpm ]; then /etc/rc.d/rc.gpm start fi +# Start the Icecream scheduler. This needs to run on only one machine that is +# part of the compile cluster: +if [ -x /etc/rc.d/rc.icecc-scheduler ]; then + /etc/rc.d/rc.icecc-scheduler start +fi + +# Start the Icecream daemon. This needs to run on every machine that will be +# part of the compile cluster (including the machine running the scheduler): +if [ -x /etc/rc.d/rc.iceccd ]; then + /etc/rc.d/rc.iceccd start +fi + # If there are SystemV init scripts for this runlevel, run them. if [ -x /etc/rc.d/rc.sysvinit ]; then /etc/rc.d/rc.sysvinit diff --git a/source/ap/lxc/scripts/rc.M.orig b/source/ap/lxc/scripts/rc.M.orig index 0cd9f0b5..cfffb8ec 100644 --- a/source/ap/lxc/scripts/rc.M.orig +++ b/source/ap/lxc/scripts/rc.M.orig @@ -20,9 +20,11 @@ if [ -x /sbin/ldconfig ]; then /sbin/ldconfig & fi -# Screen blanks after 15 minutes idle time, and powers down in one hour -# if the kernel supports APM or ACPI power management: -/bin/setterm -blank 15 -powersave powerdown -powerdown 60 +# Call the setterm init script to set screen blanking and power management +# defaults: +if [ -x /etc/rc.d/rc.setterm ]; then + /etc/rc.d/rc.setterm +fi # Set the hostname. if [ -r /etc/HOSTNAME ]; then @@ -30,7 +32,7 @@ if [ -r /etc/HOSTNAME ]; then else # fall back on this old default: echo "darkstar.example.net" > /etc/HOSTNAME - /bin/hostname darkstar + /bin/hostname $(cat /etc/HOSTNAME) fi # Set the permissions on /var/log/dmesg according to whether the kernel @@ -94,6 +96,16 @@ if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems ; then fi fi +# Start the haveged entropy daemon: +if [ -x /etc/rc.d/rc.haveged ]; then + /etc/rc.d/rc.haveged start +fi + +# Start the rngd entropy daemon: +if [ -x /etc/rc.d/rc.rngd ]; then + /etc/rc.d/rc.rngd start +fi + # Initialize the networking hardware. if [ -x /etc/rc.d/rc.inet1 ]; then /etc/rc.d/rc.inet1 @@ -104,6 +116,11 @@ if [ -x /etc/rc.d/rc.messagebus ]; then /etc/rc.d/rc.messagebus start fi +# Start console-kit-daemon: +if [ -x /etc/rc.d/rc.consolekit ]; then + /etc/rc.d/rc.consolekit start +fi + # Start Bluetooth: if [ -x /etc/rc.d/rc.bluetooth ]; then /etc/rc.d/rc.bluetooth start @@ -135,8 +152,7 @@ if [ -x /etc/rc.d/rc.ntpd ]; then fi # Remove stale locks and junk files (must be done after mount -a!) -/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/core /core 2> /dev/null -/bin/rm -rf /var/spool/cron/cron.?????? 2> /dev/null +/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/.X11-unix/* 2> /dev/null # Remove stale hunt sockets so the game can start. if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then @@ -180,11 +196,6 @@ if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then /usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null & fi -# Start console-kit-daemon: -if [ -x /etc/rc.d/rc.consolekit ]; then - /etc/rc.d/rc.consolekit start -fi - # Start HAL: if [ -x /etc/rc.d/rc.hald ]; then /etc/rc.d/rc.hald start @@ -206,7 +217,7 @@ fi if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then echo "Updating gdk-pixbuf.loaders:" echo " /usr/bin/update-gdk-pixbuf-loaders &" - /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1 & + HOME=/root /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1 & fi if [ -x /usr/bin/update-pango-querymodules ]; then echo "Updating pango.modules:" @@ -244,12 +255,10 @@ if [ -x /etc/rc.d/rc.atalk ]; then fi # Start smartd, which monitors the status of S.M.A.R.T. compatible -# hard drives and reports any problems. Note some devices (which aren't -# smart, I guess ;) will hang if probed by smartd, so it's commented out -# by default. -#if [ -x /usr/sbin/smartd ]; then -# /usr/sbin/smartd -#fi +# hard drives and reports any problems: +if [ -x /etc/rc.d/rc.smartd ]; then + /etc/rc.d/rc.smartd start +fi # Monitor the UPS with genpowerd. # To use this, uncomment this section and edit your settings in @@ -274,15 +283,13 @@ if [ -x /sbin/accton -a -r /var/log/pacct ]; then fi # Start crond (Dillon's crond): -# If you want cron to actually log activity to /var/log/cron, then change -# -l notice to -l info to increase the logging level. -if [ -x /usr/sbin/crond ]; then - /usr/sbin/crond -l notice +if [ -x /etc/rc.d/rc.crond ]; then + /etc/rc.d/rc.crond start fi # Start atd (manages jobs scheduled with 'at'): -if [ -x /usr/sbin/atd ]; then - /usr/sbin/atd -b 15 -l 1 +if [ -x /etc/rc.d/rc.atd ]; then + /etc/rc.d/rc.atd start fi # Slackware-Mini-Quota-HOWTO: @@ -375,6 +382,18 @@ if [ -x /etc/rc.d/rc.gpm ]; then /etc/rc.d/rc.gpm start fi +# Start the Icecream scheduler. This needs to run on only one machine that is +# part of the compile cluster: +if [ -x /etc/rc.d/rc.icecc-scheduler ]; then + /etc/rc.d/rc.icecc-scheduler start +fi + +# Start the Icecream daemon. This needs to run on every machine that will be +# part of the compile cluster (including the machine running the scheduler): +if [ -x /etc/rc.d/rc.iceccd ]; then + /etc/rc.d/rc.iceccd start +fi + # If there are SystemV init scripts for this runlevel, run them. if [ -x /etc/rc.d/rc.sysvinit ]; then /etc/rc.d/rc.sysvinit diff --git a/source/ap/lxc/scripts/rc.S.lxc b/source/ap/lxc/scripts/rc.S.lxc index d6bc21f0..6732184a 100644 --- a/source/ap/lxc/scripts/rc.S.lxc +++ b/source/ap/lxc/scripts/rc.S.lxc @@ -191,11 +191,6 @@ if [ -z "$container" ]; then /sbin/swapon -a 2> /dev/null fi -# Start FUSE, if requested: -if [ -x /etc/rc.d/rc.fuse -a -z "$container" ]; then - /etc/rc.d/rc.fuse start -fi - # Set the tick and frequency for the system clock. # Default values are: TICK=10000 and FREQ=0 if [ -z "$container" ]; then @@ -255,7 +250,12 @@ fi # Check the root filesystem: if [ -z "$container" ]; then - if [ ! $READWRITE = yes ]; then + # If we're using F2FS for the root filesystem, don't check it as it doesn't + # allow checking a read-only filesystem: + if grep -q ' / f2fs ' /proc/mounts ; then + echo "Remounting root device with read-write enabled." + /sbin/mount -w -v -n -o remount / + elif [ ! $READWRITE = yes ]; then RETVAL=0 if [ ! -r /etc/fastboot ]; then echo "Checking root filesystem:" @@ -294,7 +294,6 @@ if [ -z "$container" ]; then /sbin/umount -a -r /sbin/mount -n -o remount,ro / echo "Rebooting system." - sleep 2 reboot -f fi # Remount the root filesystem in read-write mode @@ -318,24 +317,23 @@ if [ -z "$container" ]; then fi # Done checking root filesystem fi -# Any /etc/mtab that exists here is old, so we start with a new one: -/bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab - -# Add entry for / to /etc/mtab: -if [ -z "$container" ]; then - /sbin/mount -f -w / -fi - -# Add /proc, /sys, and /dev/shm mounts to /etc/mtab: -if [ -z "$container" ]; then - if [ -d /proc/sys ]; then - /sbin/mount -f -t proc proc /proc - fi - if [ -d /sys/bus ]; then - /sbin/mount -f -t sysfs sysfs /sys - fi - if grep -q '^[^ ]\+ /dev/shm ' /proc/mounts 2> /dev/null ; then - /sbin/mount -f -t tmpfs tmpfs /dev/shm +# If /etc/mtab is a symlink (probably to /proc/mounts) then we don't want to mess with it. +if [ ! -L /etc/mtab -o ! -r /etc/mtab ]; then + # /etc/mtab is a file (or doesn't exist), so we'll handle it the old way: + # Any /etc/mtab that exists here is old, so we start with a new one: + /bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab + if [ -z "$container" ]; then + # Add /, /proc, /sys, and /dev/shm mounts to /etc/mtab: + /sbin/mount -f -w / + if [ -d /proc/sys ]; then + /sbin/mount -f -t proc proc /proc + fi + if [ -d /sys/bus ]; then + /sbin/mount -f -t sysfs sysfs /sys + fi + if grep -q '^[^ ]\+ /dev/shm ' /proc/mounts 2> /dev/null ; then + /sbin/mount -f -t tmpfs tmpfs /dev/shm + fi fi fi @@ -384,18 +382,15 @@ fi # because those have already been mounted. Also check that # devpts is not already mounted before attempting to mount # it. With a 2.6.x or newer kernel udev mounts devpts. -# We also need to wait a little bit to let USB and other -# hotplugged devices settle (sorry to slow down the boot): if [ -z "$container" ]; then echo "Mounting non-root local filesystems:" - sleep 3 if /bin/grep -wq devpts /proc/mounts ; then # This pipe after the mount command is just to convert the new # mount verbose output back to the old format that contained # more useful information: - /sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs,nodevpts | grep successfully | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done + /sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs,nodevpts | grep successfully | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep " ${dev} " ; done else - /sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs | grep successfully | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done + /sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs | grep successfully | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep " ${dev} " ; done fi fi @@ -411,13 +406,23 @@ if [ -x /etc/rc.d/rc.cgmanager -a -d /sys/fs/cgroup ]; then /etc/rc.d/rc.cgmanager start fi +# Start libcgroup services: +if [ -x /etc/rc.d/rc.cgconfig -a -x /etc/rc.d/rc.cgred -a -d /sys/fs/cgroup ]; then + /etc/rc.d/rc.cgconfig start ; echo " /usr/sbin/cgconfigparser -l /etc/cgconfig.conf" + /etc/rc.d/rc.cgred start +fi + # Clean up some temporary files: rm -f /var/run/* /var/run/*/* /var/run/*/*/* /etc/nologin \ /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \ /var/state/saslauthd/saslauthd.pid \ /tmp/.Xauth* 1> /dev/null 2> /dev/null +if [ -d /var/lib/pkgtools/setup/tmp ]; then + ( cd /var/lib/pkgtools/setup/tmp && rm -rf * ) +elif [ -d /var/log/setup/tmp ]; then ( cd /var/log/setup/tmp && rm -rf * ) - ( cd /tmp && rm -rf kde-[a-zA-Z]* ksocket-[a-zA-Z]* hsperfdata_[a-zA-Z]* plugtmp* ) +fi +( cd /tmp && rm -rf kde-[a-zA-Z]* ksocket-[a-zA-Z]* hsperfdata_[a-zA-Z]* plugtmp* ) # Clear /var/lock/subsys: if [ -d /var/lock/subsys ]; then @@ -471,4 +476,3 @@ else dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null fi chmod 600 /etc/random-seed - diff --git a/source/ap/lxc/scripts/rc.S.orig b/source/ap/lxc/scripts/rc.S.orig index 78e68e40..4162938f 100644 --- a/source/ap/lxc/scripts/rc.S.orig +++ b/source/ap/lxc/scripts/rc.S.orig @@ -73,7 +73,6 @@ if grep -wq cgroup /proc/filesystems ; then fi fi - # Initialize the Logical Volume Manager. # This won't start unless we find /etc/lvmtab (LVM1) or # /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to @@ -177,11 +176,6 @@ fi # Enable swapping: /sbin/swapon -a 2> /dev/null -# Start FUSE, if requested: -if [ -x /etc/rc.d/rc.fuse ]; then - /etc/rc.d/rc.fuse start -fi - # Set the tick and frequency for the system clock. # Default values are: TICK=10000 and FREQ=0 TICK=10000 @@ -235,8 +229,13 @@ if [ -r /etc/forcefsck ]; then FORCEFSCK="-f" fi -# Check the root filesystem: -if [ ! $READWRITE = yes ]; then +# If we're using F2FS for the root filesystem, don't check it as it doesn't +# allow checking a read-only filesystem: +if grep -q ' / f2fs ' /proc/mounts ; then + echo "Remounting root device with read-write enabled." + /sbin/mount -w -v -n -o remount / +elif [ ! $READWRITE = yes ]; then + # Check the root filesystem: RETVAL=0 if [ ! -r /etc/fastboot ]; then echo "Checking root filesystem:" @@ -275,7 +274,6 @@ if [ ! $READWRITE = yes ]; then /sbin/umount -a -r /sbin/mount -n -o remount,ro / echo "Rebooting system." - sleep 2 reboot -f fi # Remount the root filesystem in read-write mode @@ -298,22 +296,22 @@ else echo "to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it." fi # Done checking root filesystem - -# Any /etc/mtab that exists here is old, so we start with a new one: -/bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab - -# Add entry for / to /etc/mtab: -/sbin/mount -f -w / - -# Add /proc, /sys, and /dev/shm mounts to /etc/mtab: -if [ -d /proc/sys ]; then - /sbin/mount -f -t proc proc /proc -fi -if [ -d /sys/bus ]; then - /sbin/mount -f -t sysfs sysfs /sys -fi -if grep -q '^[^ ]\+ /dev/shm ' /proc/mounts 2> /dev/null ; then - /sbin/mount -f -t tmpfs tmpfs /dev/shm +# If /etc/mtab is a symlink (probably to /proc/mounts) then we don't want to mess with it. +if [ ! -L /etc/mtab -o ! -r /etc/mtab ]; then + # /etc/mtab is a file (or doesn't exist), so we'll handle it the old way: + # Any /etc/mtab that exists here is old, so we start with a new one: + /bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab + # Add /, /proc, /sys, and /dev/shm mounts to /etc/mtab: + /sbin/mount -f -w / + if [ -d /proc/sys ]; then + /sbin/mount -f -t proc proc /proc + fi + if [ -d /sys/bus ]; then + /sbin/mount -f -t sysfs sysfs /sys + fi + if grep -q '^[^ ]\+ /dev/shm ' /proc/mounts 2> /dev/null ; then + /sbin/mount -f -t tmpfs tmpfs /dev/shm + fi fi # Configure ISA Plug-and-Play devices: @@ -359,17 +357,14 @@ fi # because those have already been mounted. Also check that # devpts is not already mounted before attempting to mount # it. With a 2.6.x or newer kernel udev mounts devpts. -# We also need to wait a little bit to let USB and other -# hotplugged devices settle (sorry to slow down the boot): echo "Mounting non-root local filesystems:" -sleep 3 if /bin/grep -wq devpts /proc/mounts ; then # This pipe after the mount command is just to convert the new # mount verbose output back to the old format that contained # more useful information: - /sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs,nodevpts | grep successfully | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done + /sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs,nodevpts | grep successfully | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep " ${dev} " ; done else - /sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs | grep successfully | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done + /sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs | grep successfully | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep " ${dev} " ; done fi # Enable swapping again. This is needed in case a swapfile is used, @@ -382,13 +377,23 @@ if [ -x /etc/rc.d/rc.cgmanager -a -d /sys/fs/cgroup ]; then /etc/rc.d/rc.cgmanager start fi +# Start libcgroup services: +if [ -x /etc/rc.d/rc.cgconfig -a -x /etc/rc.d/rc.cgred -a -d /sys/fs/cgroup ]; then + /etc/rc.d/rc.cgconfig start ; echo " /usr/sbin/cgconfigparser -l /etc/cgconfig.conf" + /etc/rc.d/rc.cgred start +fi + # Clean up some temporary files: rm -f /var/run/* /var/run/*/* /var/run/*/*/* /etc/nologin \ /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \ /var/state/saslauthd/saslauthd.pid \ /tmp/.Xauth* 1> /dev/null 2> /dev/null +if [ -d /var/lib/pkgtools/setup/tmp ]; then + ( cd /var/lib/pkgtools/setup/tmp && rm -rf * ) +elif [ -d /var/log/setup/tmp ]; then ( cd /var/log/setup/tmp && rm -rf * ) - ( cd /tmp && rm -rf kde-[a-zA-Z]* ksocket-[a-zA-Z]* hsperfdata_[a-zA-Z]* plugtmp* ) +fi +( cd /tmp && rm -rf kde-[a-zA-Z]* ksocket-[a-zA-Z]* hsperfdata_[a-zA-Z]* plugtmp* ) # Clear /var/lock/subsys: if [ -d /var/lock/subsys ]; then @@ -442,4 +447,3 @@ else dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null fi chmod 600 /etc/random-seed - diff --git a/source/ap/lxc/scripts/rc.inet1.lxc b/source/ap/lxc/scripts/rc.inet1.lxc index 58213a7c..2ae9bbb5 100644 --- a/source/ap/lxc/scripts/rc.inet1.lxc +++ b/source/ap/lxc/scripts/rc.inet1.lxc @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/bash # /etc/rc.d/rc.inet1 # This script is used to bring up the various network interfaces. # @@ -215,19 +215,28 @@ if_up() { # 15 seconds should be a reasonable default DHCP timeout. 30 was too much. echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1}" | $LOGGER /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1} - # If the dhcpcd call succeeds, add extra IP addresses, if defined, to interface - if [ "$?" == "0" ] && [ -n "${IPALIASES[$i]}" ]; then - num=0 - for ipalias in ${IPALIASES[$i]}; do - /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ; - num=$(($num + 1)) - done + if [ "$?" == "0" ]; then # the dhcp call has succeeded + if [ -n "${IPALIASES[$i]}" ]; then + # Add extra IP addresses, if defined, to interface + num=0 + for ipalias in ${IPALIASES[$i]}; do + ip="${ipalias%/*}" + nm="${ipalias#*/}" + [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="32" + /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num} + num=$(($num + 1)) + done + fi + if [ "${PROMISCUOUS[$i]}" = "yes" ]; then + # Set promiscuous mode on the interface + /sbin/ip link set dev ${1} promisc on + fi fi else # bring up interface using a static IP address if [ -n "${IPADDR[$i]}" ]; then # skip unconfigured interfaces # Set up the network card: - echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}" | $LOGGER - /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1} + echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} broadcast + dev ${1}" | $LOGGER + /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} broadcast + dev ${1} if /sbin/ip link show dev ${1} | grep -wq "state DOWN" ; then /sbin/ip link set dev ${1} up # Bring up interface fi @@ -235,10 +244,17 @@ if_up() { if [ -n "${IPALIASES[$i]}" ]; then num=0 for ipalias in ${IPALIASES[$i]}; do - /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ; + ip="${ipalias%/*}" + nm="${ipalias#*/}" + [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="32" + /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num} num=$(($num + 1)) done fi + if [ "${PROMISCUOUS[$i]}" = "yes" ]; then + # Set promiscuous mode on the interface + /sbin/ip link set dev ${1} promisc on + fi else debug_log "${1} interface is not configured in /etc/rc.d/rc.inet1.conf" fi @@ -279,6 +295,8 @@ if_down() { if [ -n "${BRNICS[$i]}" ]; then br_close $i fi + # Flush the address from the interface: + ip address flush dev ${1} fi } diff --git a/source/ap/lxc/scripts/rc.inet1.orig b/source/ap/lxc/scripts/rc.inet1.orig index 2f566ef8..cf9da0f4 100644 --- a/source/ap/lxc/scripts/rc.inet1.orig +++ b/source/ap/lxc/scripts/rc.inet1.orig @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/bash # /etc/rc.d/rc.inet1 # This script is used to bring up the various network interfaces. # @@ -204,19 +204,28 @@ if_up() { # 15 seconds should be a reasonable default DHCP timeout. 30 was too much. echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1}" | $LOGGER /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1} - # If the dhcpcd call succeeds, add extra IP addresses, if defined, to interface - if [ "$?" == "0" ] && [ -n "${IPALIASES[$i]}" ]; then - num=0 - for ipalias in ${IPALIASES[$i]}; do - /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ; - num=$(($num + 1)) - done + if [ "$?" == "0" ]; then # the dhcp call has succeeded + if [ -n "${IPALIASES[$i]}" ]; then + # Add extra IP addresses, if defined, to interface + num=0 + for ipalias in ${IPALIASES[$i]}; do + ip="${ipalias%/*}" + nm="${ipalias#*/}" + [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="32" + /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num} + num=$(($num + 1)) + done + fi + if [ "${PROMISCUOUS[$i]}" = "yes" ]; then + # Set promiscuous mode on the interface + /sbin/ip link set dev ${1} promisc on + fi fi else # bring up interface using a static IP address if [ -n "${IPADDR[$i]}" ]; then # skip unconfigured interfaces # Set up the network card: - echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}" | $LOGGER - /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1} + echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} broadcast + dev ${1}" | $LOGGER + /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} broadcast + dev ${1} if /sbin/ip link show dev ${1} | grep -wq "state DOWN" ; then /sbin/ip link set dev ${1} up # Bring up interface fi @@ -224,10 +233,17 @@ if_up() { if [ -n "${IPALIASES[$i]}" ]; then num=0 for ipalias in ${IPALIASES[$i]}; do - /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ; + ip="${ipalias%/*}" + nm="${ipalias#*/}" + [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="32" + /sbin/ip address add ${ip}/${nm} dev ${1} label ${1}:${num} num=$(($num + 1)) done fi + if [ "${PROMISCUOUS[$i]}" = "yes" ]; then + # Set promiscuous mode on the interface + /sbin/ip link set dev ${1} promisc on + fi else debug_log "${1} interface is not configured in /etc/rc.d/rc.inet1.conf" fi @@ -268,6 +284,8 @@ if_down() { if [ -n "${BRNICS[$i]}" ]; then br_close $i fi + # Flush the address from the interface: + ip address flush dev ${1} fi } |