pandora/vm/prepare.sh

59 lines
1.4 KiB
Bash
Raw Normal View History

2016-03-05 13:06:39 +00:00
#!/bin/sh
set -e
rootdir=$1
2016-03-15 22:04:53 +00:00
BASE=$(dirname $0)
2016-03-05 13:06:39 +00:00
RELEASE=trusty
2016-03-15 22:04:53 +00:00
if [ -e "$BASE/settings.sh" ]; then
. "$BASE/settings.sh"
fi
SOURCE_LIST="/etc/apt/sources.list.d/base.list"
if [ ! -e "$rootdir/$SOURCE_LIST" ]; then
SOURCE_LIST="/etc/apt/sources.list"
fi
2016-03-05 13:06:39 +00:00
cat > "$rootdir/root/pandora_install" << EOF
#!/bin/bash
DEBIAN_FRONTEND=noninteractive
2016-03-15 22:04:53 +00:00
sed -i "s/main\$/main restricted universe multiverse/g" $SOURCE_LIST
2016-03-05 13:06:39 +00:00
apt-get update
apt-get -y --force-yes dist-upgrade
EOF
2016-03-15 22:04:53 +00:00
cat "$BASE/pandora_install.sh" >> "$rootdir/root/pandora_install"
2016-03-05 13:06:39 +00:00
#reset install proxy settings
cat >> "$rootdir/root/pandora_install" <<EOF
2016-03-15 22:04:53 +00:00
cat > $SOURCE_LIST <<EOS
2016-03-05 13:06:39 +00:00
deb http://archive.ubuntu.com/ubuntu $RELEASE main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu $RELEASE main restricted universe multiverse
EOS
2016-03-15 22:04:53 +00:00
2016-03-05 13:06:39 +00:00
apt-get -qq update
sed -i \
-e 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="silent"/g' \
/etc/default/grub
update-grub
2016-03-15 22:04:53 +00:00
rm -f /etc/init/pandora_install.conf /pandora_install
shutdown -h now
2016-03-05 13:06:39 +00:00
EOF
chmod +x "$rootdir/root/pandora_install"
2016-03-15 22:04:53 +00:00
cat >> "$rootdir/pandora_install" <<EOF
#!/bin/bash
/root/pandora_install >/root/pandora_install.log 2>&1 &
$INSTALL_EXTRA
EOF
chmod +x "$rootdir/pandora_install"
cat > "$rootdir/etc/init/pandora_install.conf" << EOF
description "install pan.do/ra"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on [!12345]
task
exec /pandora_install
2016-03-05 13:06:39 +00:00
EOF