summaryrefslogtreecommitdiffstats
path: root/update_jdn.sh
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2014-09-28 11:27:06 +0200
committerHelmut Grohne <helmut@subdivi.de>2014-09-28 11:27:06 +0200
commit23d28b7cbbea7121d063d5a39bae90fe02eb9f71 (patch)
tree67582b9e9fc26e77ef198025996ffa4d06071cfe /update_jdn.sh
parent7a6eee49d49db578d68629c75db43b78fc0381c1 (diff)
downloadjenkins.debian.net-23d28b7cbbea7121d063d5a39bae90fe02eb9f71.tar.xz
move chroot and pbuilder builds to tmpfs
For this change update_jdn.sh will only work well, if jenkins is not running. It avoids breaking running builds at the cost of potentially not applying configuration. The changes are: * /srv/workspace becomes a tmpfs mounted location * /etc/init.d/jenkins-workspace creates subdirectories on that tmpfs * Old locations for chroots and pbuilder are moved using symlinks.
Diffstat (limited to 'update_jdn.sh')
-rwxr-xr-xupdate_jdn.sh35
1 files changed, 34 insertions, 1 deletions
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