diff options
-rwxr-xr-x | etc/init.d/jenkins-workspace | 22 | ||||
-rwxr-xr-x | update_jdn.sh | 35 |
2 files changed, 56 insertions, 1 deletions
diff --git a/etc/init.d/jenkins-workspace b/etc/init.d/jenkins-workspace new file mode 100755 index 00000000..128d828c --- /dev/null +++ b/etc/init.d/jenkins-workspace @@ -0,0 +1,22 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: jenkins-workspace +# Required-Start: $remote_fs +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: +# X-Start-Before: jenkins +# Short-Description: Create jenkins workspace directory structure +### END INIT INFO + +WORKSPACE=/srv/workspace + +case "$1" in + start) + echo "Creating jenkins workspace" + mkdir "$WORKSPACE/chroots" + chown jenkins:jenkins "$WORKSPACE/chroots" + mkdir "$WORKSPACE/pbuilder" + echo done + ;; +esac diff --git a/update_jdn.sh b/update_jdn.sh index 99438d44..f256c15a 100755 --- a/update_jdn.sh +++ b/update_jdn.sh @@ -13,14 +13,46 @@ explain() { echo } +mkdir -p /srv/workspace + +if ! grep -q '^tmpfs\s\+/srv/workspace\s'; then + echo "tmpfs /srv/workspace tmpfs defaults,size=60g 0 0" >> /etc/fstab +fi + +if ! mountpoint -q /srv/workspace; then + if test -z "$(ls -A /srv/workspace)"; then + mount /srv/workspace + else + echo "mountpoint /srv/workspace is non-empty" + fi +fi + # make sure needed directories exists -for directory in /srv/jenkins /chroots /schroots; do +for directory in /srv/jenkins /schroots; do if [ ! -d $directory ] ; then sudo mkdir $directory sudo chown jenkins.jenkins $directory fi done +if ! test -h /chroots; then + rmdir /chroots || rm -f /chroots # do not recurse + if test -e /chroots; then + echo could not clear /chroots + else + ln -s /srv/workspace/chroots /chroots + fi +fi + +if ! test -h /var/cache/pbuilder/build; then + rmdir /var/cache/pbuilder/build || rm -f /var/cache/pbuilder/build + if test -e /var/cache/pbuilder/build; then + echo could not clear /var/cache/pbuilder/build + else + ln -s /srv/workspace/pbuilder /var/cache/pbuilder/build + fi +fi + # # install packages we need # (more or less grouped into more-then-nice-to-have, needed-while-things-are-new, needed) @@ -42,6 +74,7 @@ sudo apt-get build-dep installation-guide # cd $BASEDIR sudo cp -r etc/* /etc +update-rc.d jenkins-workspace defaults # # more configuration than a simple cp can do |