blob: f243ea087bf94e15b44c2b1870912e902edf6bca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/bash
#
# 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"
if [ -z "$2" ]; then
echo "usage: `basename $0` <jail-root> <jail-name>"
exit 1
elif [ ! -d "$1/$2" ]; then
echo "folder $1/$2 does not exist"
exit 1
fi
cp /etc/resolv.conf $1/$2/etc/
cp /etc/localtime $1/$2/etc/
echo /dev/hdv1 / ext2 defaults 1 1 > $1/$2/etc/fstab
echo /dev/hdv1 / ext2 rw 0 0 > $1/$2/etc/mtab
echo "creating devices and dependencies"
if [ -f "$DEVICES" ]; then
cd $1/$2/
tar zxvf $DEVICES
chroot $1/$2/ sbin/ldconfig
else
echo error: device template $DEVICES not found
fi
if [ -f "$SKEL" ]; then
echo "creating /etc/vservers/$2.conf"
cp $SKEL /etc/vservers/$2.conf
else
echo error: config file template $SKEL not found
fi
if [ -f "$GPGKEY" ]; then
echo "importing slack gpg pubkey"
mkdir $1/$2/root/.gnupg
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""
|