usermod -a -G mock jenkins
fi
-mkdir /home/jenkins/.ssh /w
+mkdir /home/jenkins/.ssh
cp -r "/home/${OS}/.ssh/authorized_keys" /home/jenkins/.ssh/authorized_keys
# Generate ssh key for use by Robot jobs
echo -e 'y\n' | ssh-keygen -N "" -f /home/jenkins/.ssh/id_rsa -t rsa
-chown -R jenkins:jenkins /home/jenkins/.ssh /w
+chown -R jenkins:jenkins /home/jenkins/.ssh
chmod 700 /home/jenkins/.ssh
+
+# The '/w' volume may already be part of image
+[[ ! -d '/w' ]] && mkdir /w
+chown -R jenkins:jenkins /w
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
-dd if=/dev/zero of=/swap count=1024 bs=1MiB
+# Get the blockCount from the 'SWAP_SIZE' environmental variable
+blockCount=${SWAP_SIZE-''}
+
+# Validate SWAP_SIZE
+# Empty: Set blockCount 1
+# Zero: No Swap
+# Integer: Set blockCount
+# Else: No Swap
+case $blockCount in
+ '') blockCount=1 ;;
+ [0-9]*) blockCount=$blockCount ;;
+ *) exit ;;
+esac
+[[ $blockCount == 0 ]] && exit
+
+dd if=/dev/zero of=/swap count="${blockCount}k" bs=1MiB
chmod 600 /swap
mkswap /swap
swapon /swap
--- /dev/null
+---
+prelude:
+ - |
+ Previously the swap size was fixed at 1GB.
+features:
+ - |
+ If the environmental variable 'SWAP_SIZE' is set when the
+ 'init.sh' script is called, then a 'SWAP_SIZE' GB swap space will
+ be configured. If 'SWAP_SIZE' is '0' or is not a valid integer,
+ then no swap space is cofigured. If it is unset then 1GB of swap
+ will be configured.
--- /dev/null
+---
+prelude:
+ - |
+ The work directory (/w) was created in the '/' volume. The ownership was
+ set to 'jenkins:jenkins'.
+features:
+ - |
+ If the work directory or volume (/w) aleady exists, the ownership will be
+ recursivly set to 'jenkins:jenkins'.