SOURCES: util-vserver-mounted.patch (NEW) - accommodate for buildi...
baggins
baggins at pld-linux.org
Thu Oct 13 20:19:21 CEST 2005
Author: baggins Date: Thu Oct 13 18:19:21 2005 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- accommodate for building vservers in mounted filesystems
(e.g. if /vserver/sth is a mountpoint)
---- Files affected:
SOURCES:
util-vserver-mounted.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/util-vserver-mounted.patch
diff -u /dev/null SOURCES/util-vserver-mounted.patch:1.1
--- /dev/null Thu Oct 13 20:19:21 2005
+++ SOURCES/util-vserver-mounted.patch Thu Oct 13 20:19:16 2005
@@ -0,0 +1,71 @@
+diff -ur util-vserver-0.30.208/scripts/vserver-build.functions /usr/lib/util-vserver/vserver-build.functions
+--- util-vserver-0.30.208/scripts/vserver-build.functions 2005-10-12 15:34:51.640803600 +0200
++++ /usr/lib/util-vserver/vserver-build.functions 2005-10-12 15:32:33.616786440 +0200
+@@ -102,14 +102,16 @@
+ function _renameVserverCfg
+ {
+ local suffix=.~$(date +'%s')~
+- local i
+-
+- for i in "$VDIR" "$SETUP_CONFDIR"; do
+- test ! -e "$i" || {
+- mv "$i" "$i$suffix"
+- say "Renamed '$i' to '$i$suffix'"
+- }
+- done
++
++ if [ -e "$VDIR" -a "$1" -ne 0 ]; then
++ mv "$VDIR" "$VDIR$suffix"
++ say "Renamed '$VDIR' to '$VDIR$suffix'"
++ fi
++
++ if [ -e "$SETUP_CONFDIR" ]; then
++ mv "$SETUP_CONFDIR" "$SETUP_CONFDIR$suffix"
++ say "Renamed '$SETUP_CONFDIR' to '$SETUP_CONFDIR$suffix'"
++ fi
+ }
+
+
+@@ -157,11 +159,38 @@
+ ## Usage: initFilesystem [force]
+ function base.initFilesystem
+ {
+- test -z "$1" || _renameVserverCfg
+- test ! -d "$VDIR" -a ! -d "$SETUP_CONFDIR" || {
++ local list
++ local vdirl
++ local mounted
++
++ vdirl="$(readlink $ROOTDIR)/$VSERVERDIRNAME"
++ mount | grep -q "$vdirl"
++ mounted=$?
++
++ test -z "$1" || _renameVserverCfg $mounted
++ test -d "$VDIR" && {
++ if [ "$mounted" -eq 0 ]; then
++ list=$(ls -1a "$vdirl" | awk '! /^(\.|\.\.|lost\+found)$/ { print $1; }')
++ if [ -n "$list" ]; then
++ echo \
++"vserver-topdirectory '$vdirl' is a non-empty mounted filesystem;
++please clean it manually"
++>&2
++ exit 1
++ fi
++ else
++ echo \
++"vserver-topdirectory '$VDIR' exist already;
++please try to use '--force', or remove them manually"
++>&2
++ exit 1
++ fi
++ } >&2
++
++ test -d "$SETUP_CONFDIR" && {
+ echo \
+-"vserver-topdirectory '$VDIR' and/or configuration at '$SETUP_CONFDIR'
+-exist already; please try to use '--force', or remove them manually"
++"configuration at '$SETUP_CONFDIR' exist already;
++please try to use '--force', or remove them manually"
+ >&2
+ exit 1
+ } >&2
================================================================
More information about the pld-cvs-commit
mailing list