]> git.entuzijast.net Git - imunes.git/commitdiff
skripta za generiranje openvz template cachea
authorJosip Rodin <joy@debian.(none)>
Fri, 18 Sep 2009 13:50:51 +0000 (15:50 +0200)
committerJosip Rodin <joy@debian.(none)>
Fri, 18 Sep 2009 13:50:51 +0000 (15:50 +0200)
linux/gen-vz-template.sh [new file with mode: 0755]
linux/rc.local [new file with mode: 0755]

diff --git a/linux/gen-vz-template.sh b/linux/gen-vz-template.sh
new file mode 100755 (executable)
index 0000000..43f34ec
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh -e
+
+if [ "`id -u`" != 0 ]; then
+  echo "you must be root to run this"
+  exit 1
+fi
+
+if [ ! "$1" ]; then
+  dir=/home/nas-template
+elif [ -d "$1" ]; then
+  dir=$1
+else
+  echo "bad directory specified: $1"
+  exit 1
+fi
+
+if [ "$2" = "debian" ]; then
+  dist=debian
+  mirror=http://ftp.hr.debian.org/debian/
+elif [ ! "$2" -o "$2" = "ubuntu" ]; then
+  dist=ubuntu
+  mirror=http://hr.archive.ubuntu.com/ubuntu/
+elif [ -f "/etc/vz/dists/$2.conf" && "$4" ]; then
+  dist=$2
+  mirror=$4
+else
+  echo "bad distro specified: $2"
+  exit 1
+fi
+
+if [ ! "$3" -a $dist = "ubuntu" ]; then
+  rel=jaunty
+elif [ ! "$3" -a $dist = "debian" ]; then
+  rel=lenny
+elif [ "$3" ]; then
+  rel=$3
+else
+  echo "no distro release specified"
+  exit 1
+fi
+
+test -d $dir || mkdir -p $dir
+
+if [ ! -x $dir/sbin/init ]; then
+       test -f /var/lib/dpkg/info/debootstrap.list || apt-get install debootstrap
+       debootstrap --variant=minbase $rel $dir $mirror
+fi
+
+# chroot $dir # sad smo tu instalirali iproute itd unutar childa
+
+# da ne podize sest gettya po childu
+rm -f $dir/etc/event.d/tty?
+
+# da ne podize cpufreq regulator
+rm -f $dir/etc/rc?.d/???ondemand
+
+# dodajemo touch da tocno znamo kad se VE bootao
+cp rc.local $dir/etc/rc.local
+
+cd $dir
+
+tar czf ../imunes-openvz.tar.gz *
+mv ../imunes-openvz.tar.gz /var/lib/vz/template/cache/
+
+ln -s $dist.conf /etc/vz/dists/imunes-openvz.conf
diff --git a/linux/rc.local b/linux/rc.local
new file mode 100755 (executable)
index 0000000..116945c
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh -e
+#
+# rc.local
+#
+# This script is executed at the end of each multiuser runlevel.
+# Make sure that the script will "exit 0" on success or any other
+# value on error.
+
+# IMUNES trigger
+touch /tmp/imunes-boot-done
+
+exit 0