summaryrefslogtreecommitdiff
path: root/autoinstall/bootstrap/bootstrap-wheezy-script.txt
blob: 376382db4cb03e2bd16823775e631a5ad435cd0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/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

chown -R kolab:kolab ~kolab