diff -urN '--exclude=.AppleDouble' '--exclude=.DS_Store' initscripts-8.91.13.orig/rc.d/init.d/halt initscripts-8.91.13/rc.d/init.d/halt --- initscripts-8.91.13.orig/rc.d/init.d/halt 2011-01-25 14:52:15.000000000 +0900 +++ initscripts-8.91.13/rc.d/init.d/halt 2013-12-11 15:11:20.000000000 +0900 @@ -11,6 +11,10 @@ NOLOCALE=1 . /etc/init.d/functions +if grep -q container=lxc /proc/1/environ; then + LXC="lxc" +fi + action() { echo -n "$1 " shift @@ -94,7 +98,7 @@ # Turn off swap, then unmount file systems. [ -f /proc/swaps ] && SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps` -if [ -n "$SWAPS" ]; then +if [ ! -n "$LXC" -a -n "$SWAPS" ]; then action $"Turning off swap: " swapoff $SWAPS for dst in $SWAPS; do if [[ "$dst" =~ ^/dev/mapper ]] \ @@ -155,9 +159,11 @@ # Remount read only anything that's left mounted. # echo $"Remounting remaining filesystems readonly" -mount | awk '{ print $3 }' | while read line; do +if [ ! -n "$LXC" ]; then + mount | awk '{ print $3 }' | while read line; do fstab-decode mount -n -o ro,remount $line -done + done +fi fi # noumouont or readonlyroot diff -urN '--exclude=.AppleDouble' '--exclude=.DS_Store' initscripts-8.91.13.orig/rc.d/rc.sysinit initscripts-8.91.13/rc.d/rc.sysinit --- initscripts-8.91.13.orig/rc.d/rc.sysinit 2012-07-09 03:30:30.000000000 +0900 +++ initscripts-8.91.13/rc.d/rc.sysinit 2013-12-11 15:09:54.000000000 +0900 @@ -13,6 +13,9 @@ HOSTTYPE=`uname -m` KERNELRELEASE=`uname -r` KERNELVERSION=`echo $KERNELRELEASE | cut -f 1-2 -d.` +if grep -q container=lxc /proc/1/environ; then + LXC="lxc" +fi # VLEE: make host dependent /etc if [ -x /etc/rc.diskless ]; then @@ -48,12 +51,12 @@ fi mount -n -t tmpfs none /run >/dev/null 2>&1 # Mount /proc, /sys -if [ ! -e /proc/mounts ]; then +if [ ! -e /proc/mounts -a ! -n "$LXC" ]; then mount -n -t proc /proc /proc mount -n -t sysfs /sys /sys >/dev/null 2>&1 fi # Mount /dev if not already mount -if ! (grep -q "/dev devtmpfs" /proc/mounts); then +if ! (grep -q "/dev devtmpfs" /proc/mounts) && [ ! -n "$LXC" ]; then mount -n -t devtmpfs none /dev >/dev/null 2>&1 fi if [ ! -d /proc/bus/usb ]; then @@ -114,7 +117,7 @@ nashpid=$(pidof nash 2>/dev/null) [ -n "$nashpid" ] && kill $nashpid >/dev/null 2>&1 unset nashpid -if [ ! -f "/lxcroot" ]; then +if [ ! -n "$LXC" ]; then /sbin/start_udev fi @@ -279,7 +282,7 @@ update_boot_stage RCfsck -if [ -f /fastboot ] || [ -f /lxcroot ] || strstr "$cmdline" fastboot ; then +if [ -f /fastboot ] || [ -n "$LXC" ] || strstr "$cmdline" fastboot ; then fastboot=yes else fastboot= @@ -305,7 +308,7 @@ if [ -f /forcefsck ]; then fsckoptions="-f $fsckoptions" -elif [ -f /.autofsck ] && [ ! -f /lxcroot ]; then +elif [ -f /.autofsck ] && [ ! -n "$LXC" ]; then echo $"Your system appears to have shut down uncleanly" AUTOFSCK_TIMEOUT=5 AUTOFSCK_DEF_CHECK=no @@ -418,7 +421,7 @@ if strstr "$cmdline" no_remount_rootfs ;then action $"Staying readonly root filesystem mode : " /bin/true else - [ "$state" != "rw" ] && [ ! -f "/lxcroot" ] && \ + [ "$state" != "rw" ] && [ ! -n "$LXC" ] && \ action $"Remounting root filesystem in specified mode($newstate): " mount -n -o remount,$newstate / fi