From a08e3948543f888c02971e8916fcb56e3bec8160 Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 9 Feb 2007 23:03:37 +0000 Subject: vservers post-install scripts fixed git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@178 04377dda-e619-0410-9926-eae83683ac58 --- templates/vserver-legacy/vserver-legacy.s/vserver-legacy.sh | 11 ++++++----- templates/vserver/vserver.s/vserver.sh | 10 ++++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/templates/vserver-legacy/vserver-legacy.s/vserver-legacy.sh b/templates/vserver-legacy/vserver-legacy.s/vserver-legacy.sh index f243ea0..4ce8a4b 100644 --- a/templates/vserver-legacy/vserver-legacy.s/vserver-legacy.sh +++ b/templates/vserver-legacy/vserver-legacy.s/vserver-legacy.sh @@ -3,9 +3,10 @@ # legacy vserver template # -DEVICES="/etc/simplepkg/vserver-legacy.s/devices.tar.gz" -GPGKEY="/etc/simplepkg/vserver-legacy.s/GPG-KEY" -SKEL="/etc/simplepkg/vserver-legacy.s/skel.conf" +BASE="/etc/simplepkg/templates/vserver-legacy/vserver-legacy.s/" +DEVICES="$BASE/devices.tar.gz" +GPGKEY="$BASE/GPG-KEY" +SKEL="$BASE/skel.conf" if [ -z "$2" ]; then echo "usage: `basename $0` " @@ -30,7 +31,8 @@ else fi if [ -f "$SKEL" ]; then - echo "creating /etc/vservers/$2.conf" + echo "creating /etc/vservers/$2.conf" + mkdir -p /etc/vservers cp $SKEL /etc/vservers/$2.conf else echo error: config file template $SKEL not found @@ -42,7 +44,6 @@ if [ -f "$GPGKEY" ]; then gpg --homedir $1/$2/root/.gnupg --import $GPGKEY fi -# todo: add rebootmgr echo "done; now edit /etc/vservers/$2.conf" echo "then, set all desired iptables rules and start $server vserver" echo "dont forget to change root's password with the command "vserver $2 exec passwd"" diff --git a/templates/vserver/vserver.s/vserver.sh b/templates/vserver/vserver.s/vserver.sh index b381092..e9d68a9 100644 --- a/templates/vserver/vserver.s/vserver.sh +++ b/templates/vserver/vserver.s/vserver.sh @@ -3,8 +3,9 @@ # vserver template script # -DEVICES="/etc/simplepkg/vserver.s/devices.tar.gz" -GPGKEY="/etc/simplepkg/vserver.s/GPG-KEY" +BASE="/etc/simplepkg/templates/vserver/vserver.s" +DEVICES="$BASE/devices.tar.gz" +GPGKEY="$BASE/GPG-KEY" if [ -z "$2" ]; then echo "usage: `basename $0` " @@ -17,8 +18,13 @@ fi echo "creating /etc/vservers/$2..." mv $1/$2 $1/$2.old vserver $2 build -m skeleton --force &> /dev/null +result="$?" rm -rf $1/$2 && mv $1/$2.old $1/$2 +if [ "$result" != "0" ]; then + mkdir -p /etc/vservers/$2/apps/init +fi + echo sysv > /etc/vservers/$2/apps/init/style echo 3 > /etc/vservers/$2/apps/init/runlevel.start echo 6 > /etc/vservers/$2/apps/init/runlevel.stop -- cgit v1.2.3