summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-08-06 10:59:29 +1000
committerQt by Nokia <qt-info@nokia.com>2012-08-07 08:54:52 +0200
commita772973ebc42057c82e782e26d3b98f919f2b2fa (patch)
treedd2946d3f4eb27014be188e901901191e0db70f3 /bootstrap
parentd35cb3f69e3401fffda745a29de065bd4493063c (diff)
Added bootstrap script for Debian squeeze.
Installs puppet from squeeze-backports, as the default squeeze puppet is too old. Disables any cdrom sources left over from installation, because these will cause puppet to refuse to manage debian packages. Change-Id: I132ee366254c6d22a6ea51bf725cc97861144776 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com> Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap/debian_squeeze_bootstrap.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/bootstrap/debian_squeeze_bootstrap.sh b/bootstrap/debian_squeeze_bootstrap.sh
new file mode 100755
index 0000000..96a5bb1
--- /dev/null
+++ b/bootstrap/debian_squeeze_bootstrap.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+# Bootstrap a clean Debian Squeeze system to be managed by puppet.
+
+REPO="$1"
+if [ "x$REPO" = "x" ]; then
+ {
+ echo "Usage: $(basename $0) git://some/git/repo"
+ echo ""
+ echo "Set up this machine to be managed using the puppet config in the given"
+ echo "git repository (e.g. git://qt.gitorious.org/qtqa/sysadmin.git)"
+ } 1>&2
+ exit 2
+fi
+
+set -e
+set -x
+
+if ! test -e /usr/bin/git; then
+ echo Installing git...
+ apt-get -y -o DPkg::Options::=--force-confnew install git
+else
+ echo git is already installed
+fi
+
+BACKPORTS_FILE=/etc/apt/sources.list.d/bootstrap-backports-sources.list
+if ! test -e $BACKPORTS_FILE; then
+ echo Setting up backports sources...
+ echo 'deb http://backports.debian.org/debian-backports squeeze-backports main' > $BACKPORTS_FILE
+ apt-get update
+else
+ echo backports sources already exist
+fi
+
+if ! test -e /usr/bin/puppet; then
+ echo Installing puppet...
+ apt-get -t squeeze-backports -y -o DPkg::Options::=--force-confnew install puppet
+else
+ echo puppet is already installed
+fi
+
+if ! test -d /var/qtqa/sysadmin; then
+ echo "Grabbing $REPO ..."
+ mkdir -p /var/qtqa
+ git clone "$REPO" /var/qtqa/sysadmin
+fi
+
+# disable any cdrom sources left over from install
+sed -r -e 's|^deb cdrom:|#deb cdrom:|' -i /etc/apt/sources.list
+
+# Run puppet once.
+echo "Running puppet..."
+/var/qtqa/sysadmin/puppet/sync_and_run.pl
+set +x
+echo 'All done :-)'
+echo 'If this host already has an entry in manifests/nodes.pp, nothing needs to be done...'
+echo "Otherwise, puppet is ready to go but will not do anything until you add an entry for $(facter fqdn) to manifests/nodes.pp"
+
+# remove unneeded temporary backports file
+rm -f $BACKPORTS_FILE