From c942ac2b9bbac2d760d6ddae5e87a02588b1ed71 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 22 Aug 2013 16:26:38 +0200 Subject: [PATCH] install all packages in firstboot so it can also be used with lxc --- vm/build.sh | 35 ------------------------- vm/firstboot.sh | 69 ++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 60 insertions(+), 44 deletions(-) diff --git a/vm/build.sh b/vm/build.sh index 0675350f0..814676679 100755 --- a/vm/build.sh +++ b/vm/build.sh @@ -26,40 +26,5 @@ sudo vmbuilder vbox ubuntu --suite=precise \ --user pandora \ --pass $password \ --components main,universe,multiverse \ - --ppa j/pandora \ - --addpkg openssh-server \ - --addpkg acpid \ - --addpkg vim \ - --addpkg wget \ - --addpkg pwgen \ - --addpkg nginx \ - --addpkg rabbitmq-server \ - --addpkg bzr \ - --addpkg git \ - --addpkg subversion \ - --addpkg mercurial \ - --addpkg update-manager-core \ - --addpkg python-software-properties \ - --addpkg python-setuptools \ - --addpkg python-pip \ - --addpkg python-virtualenv \ - --addpkg python-imaging \ - --addpkg python-dev \ - --addpkg python-imaging \ - --addpkg python-numpy \ - --addpkg python-psycopg2 \ - --addpkg python-pyinotify \ - --addpkg python-simplejson \ - --addpkg python-lxml \ - --addpkg python-html5lib \ - --addpkg python-ox \ - --addpkg python-gst0.10 \ - --addpkg gstreamer0.10-plugins-good \ - --addpkg gstreamer0.10-plugins-bad \ - --addpkg oxframe \ - --addpkg libavcodec-extra-53 \ - --addpkg libav-tools \ - --addpkg ffmpeg2theora \ - --addpkg imagemagick \ --firstboot=$base/firstboot.sh \ $extra diff --git a/vm/firstboot.sh b/vm/firstboot.sh index 209e59232..0c06cd9b9 100755 --- a/vm/firstboot.sh +++ b/vm/firstboot.sh @@ -1,12 +1,55 @@ -#!/bin/sh +#!/bin/bash +LXC=`grep -q lxc /proc/1/environ && echo 'yes' || echo 'no'` + export DEBIAN_FRONTEND=noninteractive -#fails in bootstrap -apt-get -y install ipython ntp - +apt-get install -y \ + update-manager-core \ + python-software-properties add-apt-repository -y ppa:j/pandora +apt-get update + +if [ "$LXC" == "no" ]; then +apt-get install -y \ + acpid \ + ntp +fi + +apt-get install -y \ + openssh-server \ + vim \ + wget \ + pwgen \ + nginx \ + rabbitmq-server \ + bzr \ + git \ + subversion \ + mercurial \ + python-setuptools \ + python-pip \ + python-virtualenv \ + python-imaging \ + python-dev \ + python-imaging \ + python-numpy \ + python-psycopg2 \ + python-pyinotify \ + python-simplejson \ + python-lxml \ + python-html5lib \ + python-ox \ + python-gst0.10 \ + gstreamer0.10-plugins-good \ + gstreamer0.10-plugins-bad \ + oxframe \ + libavcodec-extra-53 \ + libav-tools \ + ffmpeg2theora \ + imagemagick \ + ipython \ + postgresql \ + postgresql-contrib -#postgresql -apt-get -y install postgresql postgresql-contrib sudo -u postgres createuser -S -D -R pandora sudo -u postgres createdb -T template0 --locale=C --encoding=UTF8 -O pandora pandora echo "CREATE EXTENSION pg_trgm;" | sudo -u postgres psql pandora @@ -72,6 +115,7 @@ cp "/srv/pandora/etc/logrotate.d/pandora" "/etc/logrotate.d/pandora" cp "/srv/pandora/etc/nginx/pandora" "/etc/nginx/sites-available/default" service nginx restart +if [ "$LXC" == "no" ]; then cat > /usr/local/bin/fixtime < /usr/local/bin/genissue < /etc/rc.local << EOF #vm has one network interface and that might change, make it not persistent rm -f /etc/udev/rules.d/70-persistent-net.rules -#vm can be suspended, this help to keep the time in sync -/usr/local/bin/fixtime & - #update issue /usr/local/bin/genissue > /etc/issue EOF + +if [ "$LXC" == "no" ]; then +cat >> /etc/rc.local << EOF + +#vm can be suspended, this help to keep the time in sync +/usr/local/bin/fixtime & +EOF +fi chmod +x /etc/rc.local cat > /home/pandora/.vimrc <