summaryrefslogtreecommitdiff
path: root/autoinstall/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'autoinstall/bootstrap')
-rw-r--r--autoinstall/bootstrap/apt-preferences.txt6
-rw-r--r--autoinstall/bootstrap/bashrc.txt45
-rw-r--r--autoinstall/bootstrap/bootstrap-quantal-script.txt194
-rw-r--r--autoinstall/bootstrap/bootstrap-sid-script.txt15
-rw-r--r--autoinstall/bootstrap/bootstrap-wheezy-script.txt193
-rw-r--r--autoinstall/bootstrap/common.txt26
-rw-r--r--autoinstall/bootstrap/devscripts.txt6
-rw-r--r--autoinstall/bootstrap/dupload.txt16
-rw-r--r--autoinstall/bootstrap/gitconfig.txt8
-rw-r--r--autoinstall/bootstrap/issue.txt8
-rw-r--r--autoinstall/bootstrap/packages.txt12
-rw-r--r--autoinstall/bootstrap/pbuilder.txt27
-rw-r--r--autoinstall/bootstrap/quiltrc.txt15
-rw-r--r--autoinstall/bootstrap/reinit-cowbuilder.txt31
-rw-r--r--autoinstall/bootstrap/ssh.txt19
-rw-r--r--autoinstall/bootstrap/sudoers.txt6
-rw-r--r--autoinstall/bootstrap/vimrc.txt14
17 files changed, 260 insertions, 381 deletions
diff --git a/autoinstall/bootstrap/apt-preferences.txt b/autoinstall/bootstrap/apt-preferences.txt
new file mode 100644
index 0000000..6834060
--- /dev/null
+++ b/autoinstall/bootstrap/apt-preferences.txt
@@ -0,0 +1,6 @@
+cat > /etc/apt/preferences.d/kolab << EOF
+Package: *
+Pin: origin mirror.kolabsys.com
+Pin-Priority: 501
+EOF
+
diff --git a/autoinstall/bootstrap/bashrc.txt b/autoinstall/bootstrap/bashrc.txt
new file mode 100644
index 0000000..db4283e
--- /dev/null
+++ b/autoinstall/bootstrap/bashrc.txt
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+cat > /home/kolab/.bashrc << EOF
+# .bashrc
+
+# Source global definitions
+if [ -f /etc/bashrc ]; then
+ . /etc/bashrc
+fi
+
+# Set PATH before searching for sudo_utils
+export PATH=\$HOME/bin:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
+
+# User specific aliases and functions
+export HISTSIZE=9999999
+export SVN_EDITOR=vim
+export EDITOR=vim
+export DEBEMAIL=vanmeeuwen@kolabsys.com
+export DEBFULLNAME="Jeroen van Meeuwen (Kolab Systems)"
+
+export LS_OPTIONS='--color=auto'
+eval "\$(dircolors)"
+alias ls='ls \$LS_OPTIONS'
+alias ll='ls \$LS_OPTIONS -l'
+alias l='ls \$LS_OPTIONS -lA'
+alias rm='rm -i'
+alias cp='cp -i'
+alias mv='mv -i'
+
+export GIT_PS1_SHOWDIRTYSTATE=1
+export GIT_PS1_SHOWUNTRACKEDFILES=1
+export GIT_PS1_SHOWUPSTREAM="auto verbose"
+
+if [ ! -f "/etc/bash_completion" ]; then
+ if [ -f "/etc/bash_completion.d/git" ]; then
+ cp /etc/bash_completion.d/git ~/.git-completion.sh
+ . ~/.git-completion.sh
+ PS1='[\u@\h \W\$(__git_ps1 " (%s)")]\\$ '
+ fi
+else
+ PS1='[\u@\h \W\$(__git_ps1 " (%s)")]\\$ '
+fi
+EOF
+
+ln -sf /home/kolab/.bashrc /root/.bashrc
diff --git a/autoinstall/bootstrap/bootstrap-quantal-script.txt b/autoinstall/bootstrap/bootstrap-quantal-script.txt
index 4f14bee..6e5953c 100644
--- a/autoinstall/bootstrap/bootstrap-quantal-script.txt
+++ b/autoinstall/bootstrap/bootstrap-quantal-script.txt
@@ -1,203 +1,15 @@
#!/bin/bash
-# Add kolab user to sudo group and give sudo permissions without password
-gpasswd -a kolab sudo
-sed -r -i -e 's/%sudo.*$/%sudo ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers
-
-# Add IP address to /etc/issue
-expr="s/\s\\n\s/$(ip addr sh dev eth0 | grep -E "\s+inet\s" | awk '{print $2}')/g"
-sed -i -e $expr /etc/issue
-
# Add the kolab repository.
cat > /etc/apt/sources.list.d/kolab-3.0.list << EOF
deb http://mirror.kolabsys.com/pub/ubuntu/kolab-3.0 quantal development
deb-src http://mirror.kolabsys.com/pub/ubuntu/kolab-3.0 quantal development
EOF
-cat > /etc/apt/preferences.d/kolab << EOF
-Package: *
-Pin: origin mirror.kolabsys.com
-Pin-Priority: 501
-EOF
-
apt-get update || :
-apt-get -y --force-yes build-dep \
- 389-admin 389-adminutil 389-console 389-ds-base 389-ds-console 389-dsgw \
- apache2 cyrus-imapd jss ldapjdk libapache2-mod-nss libcalendaring libkolab \
- libkolabxml libmozilla-ldap-perl mozilla-ldap-sdk php5 pykolab roundcube \
- roundcube-plugins-extra || :
-
-apt-get -y --force-yes install \
- build-essential cowbuilder debhelper devscripts dh-make dh-autoreconf \
- fakeroot git-buildpackage libcurl4-gnutls-dev lintian openssh-server \
- pbuilder pkg-kde-tools quilt sudo vim wget || :
-
-mkdir -p /home/kolab/bin
-cat > /home/kolab/bin/reinit-cowbuilder << EOF
-#!/bin/bash
-
-for ARCH in i386 amd64; do
- for DIST in precise quantal wheezy sid; do
- . \${HOME}/.pbuilderrc
- sudo rm -rf /var/cache/pbuilder/base-\${DIST}-\${ARCH}.cow
- sudo cowbuilder --create \
- --architecture \${ARCH} --distribution \${DIST} \
- --basepath /var/cache/pbuilder/base-\${DIST}-\${ARCH}.cow \
- --mirror \${MIRRORSITE}
- done
-done
-EOF
-chmod 755 /home/kolab/bin/reinit-cowbuilder
-
-mkdir -p /root/.ssh
-cat > /root/.ssh/known_hosts << EOF
-git.kolabsys.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAoSSetGj23+QtuBaRA93W5HDofS0HW4lXmXpkxFjRQi/pzCSCfo8CmVnDN/woKBlvUfi9u4iKBMAhm0LkndvZOHYpGHxVAq65CXDcjyg9ZtS0SGOsD8EvuNa3Y+zVXHzF0h6ehoAgHI0r9lE/cSfqanJujSrzPV1Ro/jkSF+IQm7ibCXabk4dZfqSUDwp6lnde8mG+0KcHzwlkKacEQDZOThNO0RPl30nJI5uUkgWHsiY+lgzd4d2N7+IMHwlGhBN9aXwNEkShQrgZ3W5uLhpAIvHi5FkJhJwjMi6iI5K3NQGlc1TFSzoZOMy1we2NeDJk965+8cz6ZbJno0GZAz0Aw==
-EOF
-cat > /root/.ssh/authorized_keys << EOF
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuYwrguPlzuOXUNV9AwtbduNy0Waq1crncyb8ijHNEng4SX/kMhqULK4Z6g0Go5vXFzkabmQqHvRPxi5jtTN+P80xsdqEznKETbyjiPnw56qLYERf1UvTUl41yMTgrB9M7/74cD1RnpjnMKU/KRUelWtv/xzpVvYoMsNBZlS64cCRXvrE2z7tZC2hdBKPU+6yeUSe1HVwklMzhAvCpPplN7riVO6hV4J1QCdLFpS8cScIYKBo7f6Xrt3aWOsmMr9OJx2CZiJkwYLotSkbf5VFMAsJhaSnO8UTNNEOZFkIU7My0+u2oyfQX2vuaaVaJix1gsNLW4q3bqvW5+XaNJuiZ kanarip@kanarip.com
-EOF
-chmod 700 /root/.ssh
-chmod 600 /root/.ssh/authorized_keys
-
-mkdir -p /home/kolab/.ssh
-cat > /home/kolab/.ssh/known_hosts << EOF
-git.kolabsys.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAoSSetGj23+QtuBaRA93W5HDofS0HW4lXmXpkxFjRQi/pzCSCfo8CmVnDN/woKBlvUfi9u4iKBMAhm0LkndvZOHYpGHxVAq65CXDcjyg9ZtS0SGOsD8EvuNa3Y+zVXHzF0h6ehoAgHI0r9lE/cSfqanJujSrzPV1Ro/jkSF+IQm7ibCXabk4dZfqSUDwp6lnde8mG+0KcHzwlkKacEQDZOThNO0RPl30nJI5uUkgWHsiY+lgzd4d2N7+IMHwlGhBN9aXwNEkShQrgZ3W5uLhpAIvHi5FkJhJwjMi6iI5K3NQGlc1TFSzoZOMy1we2NeDJk965+8cz6ZbJno0GZAz0Aw==
-EOF
-cat > /home/kolab/.ssh/authorized_keys << EOF
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuYwrguPlzuOXUNV9AwtbduNy0Waq1crncyb8ijHNEng4SX/kMhqULK4Z6g0Go5vXFzkabmQqHvRPxi5jtTN+P80xsdqEznKETbyjiPnw56qLYERf1UvTUl41yMTgrB9M7/74cD1RnpjnMKU/KRUelWtv/xzpVvYoMsNBZlS64cCRXvrE2z7tZC2hdBKPU+6yeUSe1HVwklMzhAvCpPplN7riVO6hV4J1QCdLFpS8cScIYKBo7f6Xrt3aWOsmMr9OJx2CZiJkwYLotSkbf5VFMAsJhaSnO8UTNNEOZFkIU7My0+u2oyfQX2vuaaVaJix1gsNLW4q3bqvW5+XaNJuiZ kanarip@kanarip.com
-EOF
-chmod 700 /home/kolab/.ssh
-chmod 600 /home/kolab/.ssh/authorized_keys
-
-# Initialize the Kolab user account for building
-cat > /home/kolab/.devscripts << EOF
-DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i.git/ -I.git/ -us -uc -sa"
-EOF
-
-cat > /home/kolab/.bashrc << EOF
-# .bashrc
-
-# Source global definitions
-if [ -f /etc/bashrc ]; then
- . /etc/bashrc
-fi
-
-# Set PATH before searching for sudo_utils
-export PATH=\$HOME/bin:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
-
-# User specific aliases and functions
-export HISTSIZE=9999999
-export SVN_EDITOR=vim
-export EDITOR=vim
-export TMP=\$HOME/tmp
-export TMPDIR=\$HOME/tmp
-export DEBEMAIL=vanmeeuwen@kolabsys.com
-export DEBFULLNAME="Jeroen van Meeuwen (Kolab Systems)"
-
-export LS_OPTIONS='--color=auto'
-eval "\$(dircolors)"
-alias ls='ls \$LS_OPTIONS'
-alias ll='ls \$LS_OPTIONS -l'
-alias l='ls \$LS_OPTIONS -lA'
-alias rm='rm -i'
-alias cp='cp -i'
-alias mv='mv -i'
-
-export GIT_PS1_SHOWDIRTYSTATE=1
-export GIT_PS1_SHOWUNTRACKEDFILES=1
-export GIT_PS1_SHOWUPSTREAM="auto verbose"
-
-if [ ! -f "/etc/bash_completion" ]; then
- if [ -f "/etc/bash_completion.d/git" ]; then
- cp /etc/bash_completion.d/git ~/.git-completion.sh
- . ~/.git-completion.sh
- PS1='[\u@\h \W\$(__git_ps1 " (%s)")]\\$ '
- fi
-else
- PS1='[\u@\h \W\$(__git_ps1 " (%s)")]\\$ '
-fi
-EOF
-
-ln -sf /home/kolab/.bashrc /root/.bashrc
-
-cat > /home/kolab/.dupload.conf << EOF
-package config;
-\$preupload{'changes'} = "echo Starting %1";
-
-\$cfg{'pub-3.0-wheezy-dev'} = {
- 'fqdn' => 'mirror.kolabsys.com',
- 'method' => 'scpb',
- 'login' => 'vanmeeuwen',
- 'incoming' => '/srv/mirror/public/debian/kolab-3.0/incoming/wheezy/development/',
- 'dinstall_runs' => 1
- };
-
-1;
-EOF
-
-cat > /home/kolab/.gitignore << EOF
-[user]
- name = Jeroen van Meeuwen (Kolab Systems)
- email = vanmeeuwen
-EOF
-
-cat > /home/kolab/.pbuilderrc << EOF
-# do not specify variables when running cowbuilder --create or --update
-if [ -f debian/changelog ]; then
- [ -z "\$ARCH" ] && ARCH=\$(dpkg --print-architecture)
- [ -z "\$DIST" ] && DIST=\$(dpkg-parsechangelog | sed -n 's/^Distribution: //p')
-fi
-
-if [ "\${DIST}" == "squeeze" -o "\${DIST}" == "wheezy" -o "\${DIST}" == "sid" ]; then
- MIRRORSITE=http://ftp.uk.debian.org/debian
-else
- MIRRORSITE=http://mirror.krystal.co.uk/ubuntu/
-fi
-
-DEBOOTSTRAPOPTS[${#DEBOOTSTRAPOPTS[@]}]="--no-check-gpg"
-PDEBUILD_PBUILDER="cowbuilder --build --basepath /var/cache/pbuilder/base-\${DIST}-\${ARCH}.cow --mirror \${MIRRORSITE}"
-DEBBUILDOPTS="-us -uc -sa -d \${OPTS}"
-ARCHITECTURE=\${ARCH}
-BUILDRESULT=~/builds
-EXTRAPACKAGES="\$EXTRAPACKAGES lintian"
-AUTO_DEBSIGN=no
-HOOKDIR=\${HOME}/.pbuilder/hooks/
-PKGNAME_LOGFILE_EXTENTION="_\${ARCH}.build"
-EOF
-
-ln -sf /home/kolab/.pbuilderrc /root/.pbuilderrc
-
-# Initialize .quiltrc (from http://www.debian.org/doc/manuals/maint-guide/modify.en.html)
-cat > /home/kolab/.quiltrc << EOF
-d=. ; while [ ! -d \$d/debian -a \$(readlink -e \$d) != / ]; do d=\$d/..; done
-if [ -d \$d/debian ] && [ -z \$QUILT_PATCHES ]; then
- # if in Debian packaging tree with unset \$QUILT_PATCHES
- QUILT_PATCHES="debian/patches"
- QUILT_PATCH_OPTS="--reject-format=unified"
- QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
- QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
- QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"
- if ! [ -d \$d/debian/patches ]; then mkdir \$d/debian/patches; fi
-fi
-EOF
-
-# Set some vimrc's to the usual 4 spaces for an indentation level
-cat > /root/.vimrc << EOF
-set shiftwidth=4
-set tabstop=4
-set expandtab
-EOF
-
-cat > /home/kolab/.vimrc << EOF
-set shiftwidth=4
-set tabstop=4
-set expandtab
-EOF
-
-wget -q -O/tmp/git-clone-apt-packaging-repositories.sh "http://hosted.kolabsys.com/~vanmeeuwen/git-clone-apt-packaging-repositories.txt"
-chmod 755 /tmp/git-clone-apt-packaging-repositories.sh
-/tmp/git-clone-apt-packaging-repositories.sh
+wget -q -O/tmp/common.sh "http://git.kolab.org/kolab-scripts/plain/autoinstall/bootstrap/common.txt"
+chmod 755 /tmp/common.sh
+/tmp/common.sh
chown -R kolab:kolab ~kolab
-
diff --git a/autoinstall/bootstrap/bootstrap-sid-script.txt b/autoinstall/bootstrap/bootstrap-sid-script.txt
new file mode 100644
index 0000000..2fcc8cc
--- /dev/null
+++ b/autoinstall/bootstrap/bootstrap-sid-script.txt
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Add the kolab repository.
+cat > /etc/apt/sources.list.d/kolab-3.0.list << EOF
+deb http://mirror.kolabsys.com/pub/debian/kolab-3.0 sid development
+deb-src http://mirror.kolabsys.com/pub/debian/kolab-3.0 sid development
+EOF
+
+apt-get update || :
+
+wget -q -O/tmp/common.sh "http://git.kolab.org/kolab-scripts/plain/autoinstall/bootstrap/common.txt"
+chmod 755 /tmp/common.sh
+/tmp/common.sh
+
+chown -R kolab:kolab ~kolab
diff --git a/autoinstall/bootstrap/bootstrap-wheezy-script.txt b/autoinstall/bootstrap/bootstrap-wheezy-script.txt
index 376382d..2c363ec 100644
--- a/autoinstall/bootstrap/bootstrap-wheezy-script.txt
+++ b/autoinstall/bootstrap/bootstrap-wheezy-script.txt
@@ -1,202 +1,15 @@
#!/bin/bash
-# Add kolab user to sudo group and give sudo permissions without password
-gpasswd -a kolab sudo
-sed -r -i -e 's/%sudo.*$/%sudo ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers
-
-# Add IP address to /etc/issue
-expr="s/\s\\n\s/$(ip addr sh dev eth0 | grep -E "\s+inet\s" | awk '{print $2}')/g"
-sed -i -e $expr /etc/issue
-
# Add the kolab repository.
cat > /etc/apt/sources.list.d/kolab-3.0.list << EOF
deb http://mirror.kolabsys.com/pub/debian/kolab-3.0 wheezy development
deb-src http://mirror.kolabsys.com/pub/debian/kolab-3.0 wheezy development
EOF
-cat > /etc/apt/preferences.d/kolab << EOF
-Package: *
-Pin: origin mirror.kolabsys.com
-Pin-Priority: 501
-EOF
-
apt-get update || :
-apt-get -y --force-yes build-dep \
- 389-admin 389-adminutil 389-console 389-ds-base 389-ds-console 389-dsgw \
- apache2 cyrus-imapd jss ldapjdk libapache2-mod-nss libcalendaring libkolab \
- libkolabxml libmozilla-ldap-perl mozilla-ldap-sdk php5 pykolab roundcube \
- roundcube-plugins-extra || :
-
-apt-get -y --force-yes install \
- build-essential cowbuilder debhelper devscripts dh-make dh-autoreconf \
- fakeroot git-buildpackage libcurl4-gnutls-dev lintian openssh-server \
- pbuilder pkg-kde-tools quilt sudo vim wget || :
-
-mkdir -p /home/kolab/bin
-cat > /home/kolab/bin/reinit-cowbuilder << EOF
-#!/bin/bash
-
-for ARCH in i386 amd64; do
- for DIST in precise quantal wheezy sid; do
- . \${HOME}/.pbuilderrc
- sudo rm -rf /var/cache/pbuilder/base-\${DIST}-\${ARCH}.cow
- sudo cowbuilder --create \
- --architecture \${ARCH} --distribution \${DIST} \
- --basepath /var/cache/pbuilder/base-\${DIST}-\${ARCH}.cow \
- --mirror \${MIRRORSITE}
- done
-done
-EOF
-chmod 755 /home/kolab/bin/reinit-cowbuilder
-
-mkdir -p /root/.ssh
-cat > /root/.ssh/known_hosts << EOF
-git.kolabsys.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAoSSetGj23+QtuBaRA93W5HDofS0HW4lXmXpkxFjRQi/pzCSCfo8CmVnDN/woKBlvUfi9u4iKBMAhm0LkndvZOHYpGHxVAq65CXDcjyg9ZtS0SGOsD8EvuNa3Y+zVXHzF0h6ehoAgHI0r9lE/cSfqanJujSrzPV1Ro/jkSF+IQm7ibCXabk4dZfqSUDwp6lnde8mG+0KcHzwlkKacEQDZOThNO0RPl30nJI5uUkgWHsiY+lgzd4d2N7+IMHwlGhBN9aXwNEkShQrgZ3W5uLhpAIvHi5FkJhJwjMi6iI5K3NQGlc1TFSzoZOMy1we2NeDJk965+8cz6ZbJno0GZAz0Aw==
-EOF
-cat > /root/.ssh/authorized_keys << EOF
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuYwrguPlzuOXUNV9AwtbduNy0Waq1crncyb8ijHNEng4SX/kMhqULK4Z6g0Go5vXFzkabmQqHvRPxi5jtTN+P80xsdqEznKETbyjiPnw56qLYERf1UvTUl41yMTgrB9M7/74cD1RnpjnMKU/KRUelWtv/xzpVvYoMsNBZlS64cCRXvrE2z7tZC2hdBKPU+6yeUSe1HVwklMzhAvCpPplN7riVO6hV4J1QCdLFpS8cScIYKBo7f6Xrt3aWOsmMr9OJx2CZiJkwYLotSkbf5VFMAsJhaSnO8UTNNEOZFkIU7My0+u2oyfQX2vuaaVaJix1gsNLW4q3bqvW5+XaNJuiZ kanarip@kanarip.com
-EOF
-chmod 700 /root/.ssh
-chmod 600 /root/.ssh/authorized_keys
-
-mkdir -p /home/kolab/.ssh
-cat > /home/kolab/.ssh/known_hosts << EOF
-git.kolabsys.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAoSSetGj23+QtuBaRA93W5HDofS0HW4lXmXpkxFjRQi/pzCSCfo8CmVnDN/woKBlvUfi9u4iKBMAhm0LkndvZOHYpGHxVAq65CXDcjyg9ZtS0SGOsD8EvuNa3Y+zVXHzF0h6ehoAgHI0r9lE/cSfqanJujSrzPV1Ro/jkSF+IQm7ibCXabk4dZfqSUDwp6lnde8mG+0KcHzwlkKacEQDZOThNO0RPl30nJI5uUkgWHsiY+lgzd4d2N7+IMHwlGhBN9aXwNEkShQrgZ3W5uLhpAIvHi5FkJhJwjMi6iI5K3NQGlc1TFSzoZOMy1we2NeDJk965+8cz6ZbJno0GZAz0Aw==
-EOF
-cat > /home/kolab/.ssh/authorized_keys << EOF
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuYwrguPlzuOXUNV9AwtbduNy0Waq1crncyb8ijHNEng4SX/kMhqULK4Z6g0Go5vXFzkabmQqHvRPxi5jtTN+P80xsdqEznKETbyjiPnw56qLYERf1UvTUl41yMTgrB9M7/74cD1RnpjnMKU/KRUelWtv/xzpVvYoMsNBZlS64cCRXvrE2z7tZC2hdBKPU+6yeUSe1HVwklMzhAvCpPplN7riVO6hV4J1QCdLFpS8cScIYKBo7f6Xrt3aWOsmMr9OJx2CZiJkwYLotSkbf5VFMAsJhaSnO8UTNNEOZFkIU7My0+u2oyfQX2vuaaVaJix1gsNLW4q3bqvW5+XaNJuiZ kanarip@kanarip.com
-EOF
-chmod 700 /home/kolab/.ssh
-chmod 600 /home/kolab/.ssh/authorized_keys
-
-# Initialize the Kolab user account for building
-cat > /home/kolab/.devscripts << EOF
-DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i.git/ -I.git/ -us -uc -sa"
-EOF
-
-cat > /home/kolab/.bashrc << EOF
-# .bashrc
-
-# Source global definitions
-if [ -f /etc/bashrc ]; then
- . /etc/bashrc
-fi
-
-# Set PATH before searching for sudo_utils
-export PATH=\$HOME/bin:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
-
-# User specific aliases and functions
-export HISTSIZE=9999999
-export SVN_EDITOR=vim
-export EDITOR=vim
-export TMP=\$HOME/tmp
-export TMPDIR=\$HOME/tmp
-export DEBEMAIL=vanmeeuwen@kolabsys.com
-export DEBFULLNAME="Jeroen van Meeuwen (Kolab Systems)"
-
-export LS_OPTIONS='--color=auto'
-eval "\$(dircolors)"
-alias ls='ls \$LS_OPTIONS'
-alias ll='ls \$LS_OPTIONS -l'
-alias l='ls \$LS_OPTIONS -lA'
-alias rm='rm -i'
-alias cp='cp -i'
-alias mv='mv -i'
-
-export GIT_PS1_SHOWDIRTYSTATE=1
-export GIT_PS1_SHOWUNTRACKEDFILES=1
-export GIT_PS1_SHOWUPSTREAM="auto verbose"
-
-if [ ! -f "/etc/bash_completion" ]; then
- if [ -f "/etc/bash_completion.d/git" ]; then
- cp /etc/bash_completion.d/git ~/.git-completion.sh
- . ~/.git-completion.sh
- PS1='[\u@\h \W\$(__git_ps1 " (%s)")]\\$ '
- fi
-else
- PS1='[\u@\h \W\$(__git_ps1 " (%s)")]\\$ '
-fi
-EOF
-
-ln -sf /home/kolab/.bashrc /root/.bashrc
-
-cat > /home/kolab/.dupload.conf << EOF
-package config;
-\$preupload{'changes'} = "echo Starting %1";
-
-\$cfg{'pub-3.0-wheezy-dev'} = {
- 'fqdn' => 'mirror.kolabsys.com',
- 'method' => 'scpb',
- 'login' => 'vanmeeuwen',
- 'incoming' => '/srv/mirror/public/debian/kolab-3.0/incoming/wheezy/development/',
- 'dinstall_runs' => 1
- };
-
-1;
-EOF
-
-cat > /home/kolab/.gitignore << EOF
-[user]
- name = Jeroen van Meeuwen (Kolab Systems)
- email = vanmeeuwen
-EOF
-
-cat > /home/kolab/.pbuilderrc << EOF
-# do not specify variables when running cowbuilder --create or --update
-if [ -f debian/changelog ]; then
- [ -z "\$ARCH" ] && ARCH=\$(dpkg --print-architecture)
- [ -z "\$DIST" ] && DIST=\$(dpkg-parsechangelog | sed -n 's/^Distribution: //p')
-fi
-
-if [ "\${DIST}" == "squeeze" -o "\${DIST}" == "wheezy" -o "\${DIST}" == "sid" ]; then
- MIRRORSITE=http://ftp.uk.debian.org/debian
-else
- MIRRORSITE=http://mirror.krystal.co.uk/ubuntu/
-fi
-
-DEBOOTSTRAPOPTS[${#DEBOOTSTRAPOPTS[@]}]="--no-check-gpg"
-PDEBUILD_PBUILDER="cowbuilder --build --basepath /var/cache/pbuilder/base-\${DIST}-\${ARCH}.cow --mirror \${MIRRORSITE}"
-DEBBUILDOPTS="-us -uc -sa -d \${OPTS}"
-ARCHITECTURE=\${ARCH}
-BUILDRESULT=~/builds
-EXTRAPACKAGES="\$EXTRAPACKAGES lintian"
-AUTO_DEBSIGN=no
-HOOKDIR=\${HOME}/.pbuilder/hooks/
-PKGNAME_LOGFILE_EXTENTION="_\${ARCH}.build"
-EOF
-
-ln -sf /home/kolab/.pbuilderrc /root/.pbuilderrc
-
-# Initialize .quiltrc (from http://www.debian.org/doc/manuals/maint-guide/modify.en.html)
-cat > /home/kolab/.quiltrc << EOF
-d=. ; while [ ! -d \$d/debian -a \$(readlink -e \$d) != / ]; do d=\$d/..; done
-if [ -d \$d/debian ] && [ -z \$QUILT_PATCHES ]; then
- # if in Debian packaging tree with unset \$QUILT_PATCHES
- QUILT_PATCHES="debian/patches"
- QUILT_PATCH_OPTS="--reject-format=unified"
- QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
- QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
- QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"
- if ! [ -d \$d/debian/patches ]; then mkdir \$d/debian/patches; fi
-fi
-EOF
-
-# Set some vimrc's to the usual 4 spaces for an indentation level
-cat > /root/.vimrc << EOF
-set shiftwidth=4
-set tabstop=4
-set expandtab
-EOF
-
-cat > /home/kolab/.vimrc << EOF
-set shiftwidth=4
-set tabstop=4
-set expandtab
-EOF
-
-wget -q -O/tmp/git-clone-apt-packaging-repositories.sh "http://hosted.kolabsys.com/~vanmeeuwen/git-clone-apt-packaging-repositories.txt"
-chmod 755 /tmp/git-clone-apt-packaging-repositories.sh
-/tmp/git-clone-apt-packaging-repositories.sh
+wget -q -O/tmp/common.sh "http://git.kolab.org/kolab-scripts/plain/autoinstall/bootstrap/common.txt"
+chmod 755 /tmp/common.sh
+/tmp/common.sh
chown -R kolab:kolab ~kolab
diff --git a/autoinstall/bootstrap/common.txt b/autoinstall/bootstrap/common.txt
new file mode 100644
index 0000000..b953fb3
--- /dev/null
+++ b/autoinstall/bootstrap/common.txt
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+for script in \
+ apt-preferences \
+ bashrc \
+ devscripts \
+ dupload \
+ git-clone-apt-packaging-repositories \
+ gitconfig \
+ issue \
+ packages \
+ pbuilder \
+ quiltrc \
+ reinit-cowbuilder \
+ ssh \
+ sudoers \
+ vimrc; do
+
+ wget -q -O/tmp/${script}.sh "http://git.kolab.org/kolab-scripts/plain/autoinstall/bootstrap/${script}.txt" || continue
+ chmod 755 /tmp/${script}.sh || continue
+ /tmp/${script}.sh || :
+done
+
+# Disable the kdm service on runlevel 2
+
+sysv-rc-conf --level 2 kdm off
diff --git a/autoinstall/bootstrap/devscripts.txt b/autoinstall/bootstrap/devscripts.txt
new file mode 100644
index 0000000..e6c219f
--- /dev/null
+++ b/autoinstall/bootstrap/devscripts.txt
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# Initialize the Kolab user account for building
+cat > /home/kolab/.devscripts << EOF
+DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i.git/ -I.git/ -us -uc -sa"
+EOF
diff --git a/autoinstall/bootstrap/dupload.txt b/autoinstall/bootstrap/dupload.txt
new file mode 100644
index 0000000..774f710
--- /dev/null
+++ b/autoinstall/bootstrap/dupload.txt
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+cat > /home/kolab/.dupload.conf << EOF
+package config;
+\$preupload{'changes'} = "echo Starting %1";
+
+\$cfg{'pub-3.0-wheezy-dev'} = {
+ 'fqdn' => 'mirror.kolabsys.com',
+ 'method' => 'scpb',
+ 'login' => 'vanmeeuwen',
+ 'incoming' => '/srv/mirror/public/debian/kolab-3.0/incoming/wheezy/development/',
+ 'dinstall_runs' => 1
+ };
+
+1;
+EOF
diff --git a/autoinstall/bootstrap/gitconfig.txt b/autoinstall/bootstrap/gitconfig.txt
new file mode 100644
index 0000000..1c859a9
--- /dev/null
+++ b/autoinstall/bootstrap/gitconfig.txt
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+cat > /home/kolab/.gitconfig << EOF
+[user]
+ name = Jeroen van Meeuwen (Kolab Systems)
+ email = vanmeeuwen@kolabsys.com
+EOF
+
diff --git a/autoinstall/bootstrap/issue.txt b/autoinstall/bootstrap/issue.txt
new file mode 100644
index 0000000..c3c3135
--- /dev/null
+++ b/autoinstall/bootstrap/issue.txt
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# Add IP address to /etc/issue
+cat > /etc/rc.local << EOF
+sed -i "2 c\\
+ \$(ip addr sh dev eth0 | grep -E '^\s+inet\s' | awk '{print \$2}')" /etc/issue
+exit 0
+EOF
diff --git a/autoinstall/bootstrap/packages.txt b/autoinstall/bootstrap/packages.txt
new file mode 100644
index 0000000..5befaad
--- /dev/null
+++ b/autoinstall/bootstrap/packages.txt
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+apt-get -y --force-yes build-dep \
+ 389-admin 389-adminutil 389-console 389-ds-base 389-ds-console 389-dsgw \
+ apache2 cyrus-imapd jss ldapjdk libapache2-mod-nss libcalendaring libkolab \
+ libkolabxml libmozilla-ldap-perl mozilla-ldap-sdk php5 pykolab roundcube \
+ roundcube-plugins-extra || :
+
+apt-get -y --force-yes install \
+ build-essential cowbuilder debhelper devscripts dh-make dh-autoreconf \
+ fakeroot git-buildpackage kde-standard kontact libcurl4-gnutls-dev lintian \
+ pbuilder pkg-kde-tools quilt sudo sysv-rc-conf vim || :
diff --git a/autoinstall/bootstrap/pbuilder.txt b/autoinstall/bootstrap/pbuilder.txt
new file mode 100644
index 0000000..2c4d0e7
--- /dev/null
+++ b/autoinstall/bootstrap/pbuilder.txt
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+cat > /home/kolab/.pbuilderrc << EOF
+# do not specify variables when running cowbuilder --create or --update
+if [ -f debian/changelog ]; then
+ [ -z "\$ARCH" ] && ARCH=\$(dpkg --print-architecture)
+ [ -z "\$DIST" ] && DIST=\$(dpkg-parsechangelog | sed -n 's/^Distribution: //p')
+fi
+
+if [ "\${DIST}" == "squeeze" -o "\${DIST}" == "wheezy" -o "\${DIST}" == "sid" ]; then
+ MIRRORSITE=http://ftp.uk.debian.org/debian
+else
+ MIRRORSITE=http://mirror.krystal.co.uk/ubuntu/
+fi
+
+DEBOOTSTRAPOPTS[${#DEBOOTSTRAPOPTS[@]}]="--no-check-gpg"
+PDEBUILD_PBUILDER="cowbuilder --build --basepath /var/cache/pbuilder/base-\${DIST}-\${ARCH}.cow --mirror \${MIRRORSITE}"
+DEBBUILDOPTS="-us -uc -sa -d \${OPTS}"
+ARCHITECTURE=\${ARCH}
+BUILDRESULT=~/builds
+EXTRAPACKAGES="\$EXTRAPACKAGES lintian"
+AUTO_DEBSIGN=no
+HOOKDIR=\${HOME}/.pbuilder/hooks/
+PKGNAME_LOGFILE_EXTENTION="_\${ARCH}.build"
+EOF
+
+ln -sf /home/kolab/.pbuilderrc /root/.pbuilderrc
diff --git a/autoinstall/bootstrap/quiltrc.txt b/autoinstall/bootstrap/quiltrc.txt
new file mode 100644
index 0000000..e002af0
--- /dev/null
+++ b/autoinstall/bootstrap/quiltrc.txt
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Initialize .quiltrc (from http://www.debian.org/doc/manuals/maint-guide/modify.en.html)
+cat > /home/kolab/.quiltrc << EOF
+d=. ; while [ ! -d \$d/debian -a \$(readlink -e \$d) != / ]; do d=\$d/..; done
+if [ -d \$d/debian ] && [ -z \$QUILT_PATCHES ]; then
+ # if in Debian packaging tree with unset \$QUILT_PATCHES
+ QUILT_PATCHES="debian/patches"
+ QUILT_PATCH_OPTS="--reject-format=unified"
+ QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
+ QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
+ QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"
+ if ! [ -d \$d/debian/patches ]; then mkdir \$d/debian/patches; fi
+fi
+EOF
diff --git a/autoinstall/bootstrap/reinit-cowbuilder.txt b/autoinstall/bootstrap/reinit-cowbuilder.txt
new file mode 100644
index 0000000..f8d01db
--- /dev/null
+++ b/autoinstall/bootstrap/reinit-cowbuilder.txt
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+mkdir -p /home/kolab/bin
+cat > /home/kolab/bin/reinit-cowbuilder << EOF
+#!/bin/bash
+
+for ARCH in i386 amd64; do
+ for DIST in precise quantal wheezy sid; do
+ . \${HOME}/.pbuilderrc
+ sudo rm -rf /var/cache/pbuilder/base-\${DIST}-\${ARCH}.cow
+ sudo cowbuilder --create \
+ --architecture \${ARCH} --distribution \${DIST} \
+ --basepath /var/cache/pbuilder/base-\${DIST}-\${ARCH}.cow \
+ --mirror \${MIRRORSITE}
+ done
+done
+EOF
+chmod 755 /home/kolab/bin/reinit-cowbuilder
+
+# Initialize them as well
+for ARCH in i386 amd64; do
+ for DIST in precise quantal wheezy sid; do
+ . /home/kolab/.pbuilderrc
+ rm -rf /var/cache/pbuilder/base-${DIST}-${ARCH}.cow
+ cowbuilder --create \
+ --architecture ${ARCH} --distribution ${DIST} \
+ --basepath /var/cache/pbuilder/base-${DIST}-${ARCH}.cow \
+ --mirror ${MIRRORSITE}
+ done
+done
+EOF
diff --git a/autoinstall/bootstrap/ssh.txt b/autoinstall/bootstrap/ssh.txt
new file mode 100644
index 0000000..36758e2
--- /dev/null
+++ b/autoinstall/bootstrap/ssh.txt
@@ -0,0 +1,19 @@
+mkdir -p /root/.ssh
+cat > /root/.ssh/known_hosts << EOF
+git.kolabsys.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAoSSetGj23+QtuBaRA93W5HDofS0HW4lXmXpkxFjRQi/pzCSCfo8CmVnDN/woKBlvUfi9u4iKBMAhm0LkndvZOHYpGHxVAq65CXDcjyg9ZtS0SGOsD8EvuNa3Y+zVXHzF0h6ehoAgHI0r9lE/cSfqanJujSrzPV1Ro/jkSF+IQm7ibCXabk4dZfqSUDwp6lnde8mG+0KcHzwlkKacEQDZOThNO0RPl30nJI5uUkgWHsiY+lgzd4d2N7+IMHwlGhBN9aXwNEkShQrgZ3W5uLhpAIvHi5FkJhJwjMi6iI5K3NQGlc1TFSzoZOMy1we2NeDJk965+8cz6ZbJno0GZAz0Aw==
+EOF
+cat > /root/.ssh/authorized_keys << EOF
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuYwrguPlzuOXUNV9AwtbduNy0Waq1crncyb8ijHNEng4SX/kMhqULK4Z6g0Go5vXFzkabmQqHvRPxi5jtTN+P80xsdqEznKETbyjiPnw56qLYERf1UvTUl41yMTgrB9M7/74cD1RnpjnMKU/KRUelWtv/xzpVvYoMsNBZlS64cCRXvrE2z7tZC2hdBKPU+6yeUSe1HVwklMzhAvCpPplN7riVO6hV4J1QCdLFpS8cScIYKBo7f6Xrt3aWOsmMr9OJx2CZiJkwYLotSkbf5VFMAsJhaSnO8UTNNEOZFkIU7My0+u2oyfQX2vuaaVaJix1gsNLW4q3bqvW5+XaNJuiZ kanarip@kanarip.com
+EOF
+chmod 700 /root/.ssh
+chmod 600 /root/.ssh/authorized_keys
+
+mkdir -p /home/kolab/.ssh
+cat > /home/kolab/.ssh/known_hosts << EOF
+git.kolabsys.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAoSSetGj23+QtuBaRA93W5HDofS0HW4lXmXpkxFjRQi/pzCSCfo8CmVnDN/woKBlvUfi9u4iKBMAhm0LkndvZOHYpGHxVAq65CXDcjyg9ZtS0SGOsD8EvuNa3Y+zVXHzF0h6ehoAgHI0r9lE/cSfqanJujSrzPV1Ro/jkSF+IQm7ibCXabk4dZfqSUDwp6lnde8mG+0KcHzwlkKacEQDZOThNO0RPl30nJI5uUkgWHsiY+lgzd4d2N7+IMHwlGhBN9aXwNEkShQrgZ3W5uLhpAIvHi5FkJhJwjMi6iI5K3NQGlc1TFSzoZOMy1we2NeDJk965+8cz6ZbJno0GZAz0Aw==
+EOF
+cat > /home/kolab/.ssh/authorized_keys << EOF
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuYwrguPlzuOXUNV9AwtbduNy0Waq1crncyb8ijHNEng4SX/kMhqULK4Z6g0Go5vXFzkabmQqHvRPxi5jtTN+P80xsdqEznKETbyjiPnw56qLYERf1UvTUl41yMTgrB9M7/74cD1RnpjnMKU/KRUelWtv/xzpVvYoMsNBZlS64cCRXvrE2z7tZC2hdBKPU+6yeUSe1HVwklMzhAvCpPplN7riVO6hV4J1QCdLFpS8cScIYKBo7f6Xrt3aWOsmMr9OJx2CZiJkwYLotSkbf5VFMAsJhaSnO8UTNNEOZFkIU7My0+u2oyfQX2vuaaVaJix1gsNLW4q3bqvW5+XaNJuiZ kanarip@kanarip.com
+EOF
+chmod 700 /home/kolab/.ssh
+chmod 600 /home/kolab/.ssh/authorized_keys
diff --git a/autoinstall/bootstrap/sudoers.txt b/autoinstall/bootstrap/sudoers.txt
new file mode 100644
index 0000000..87fa4f5
--- /dev/null
+++ b/autoinstall/bootstrap/sudoers.txt
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# Add kolab user to sudo group and give sudo permissions without password
+gpasswd -a kolab sudo
+sed -r -i -e 's/%sudo.*$/%sudo ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers
+
diff --git a/autoinstall/bootstrap/vimrc.txt b/autoinstall/bootstrap/vimrc.txt
new file mode 100644
index 0000000..3b533f7
--- /dev/null
+++ b/autoinstall/bootstrap/vimrc.txt
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# Set some vimrc's to the usual 4 spaces for an indentation level
+cat > /root/.vimrc << EOF
+set shiftwidth=4
+set tabstop=4
+set expandtab
+EOF
+
+cat > /home/kolab/.vimrc << EOF
+set shiftwidth=4
+set tabstop=4
+set expandtab
+EOF