aboutsummaryrefslogtreecommitdiffstats
path: root/INSTALL/setup_image.sh
diff options
context:
space:
mode:
Diffstat (limited to 'INSTALL/setup_image.sh')
-rwxr-xr-xINSTALL/setup_image.sh25
1 files changed, 20 insertions, 5 deletions
diff --git a/INSTALL/setup_image.sh b/INSTALL/setup_image.sh
index 7f2099b..ad79e10 100755
--- a/INSTALL/setup_image.sh
+++ b/INSTALL/setup_image.sh
@@ -18,13 +18,25 @@ function debug() {
set -x
return 0 # continue
}
+
+function crash() {
+ set +x
+ echo " -------------------------"
+ echo "| CRASH HANDLER TRIGGERED |"
+ echo " -------------------------"
+ exit 1
+}
+
# get the INSTALL dir (the one where we were launched)
INSTDIR=$(cd $(dirname $0) && pwd -P)
echo "Detected container install dir = $INSTDIR"
if [[ -f $INSTDIR/DEBUG ]]; then
- echo "#### DEBUG MODE IS ACTIVE ####"
+ echo "#### INTERACTIVE DEBUG MODE IS ACTIVE ####"
trap debug ERR # on error, run a sleep tp debug container
+else
+ echo "#### JENKINS MODE MODE IS ACTIVE ####"
+ trap crash ERR # on error, simply crash
fi
@@ -36,6 +48,10 @@ fi
# source flavour config file (generated by top Makefile)
. $INSTDIR/flavour.conf
+if [[ -z "$CONTAINER_TYPE" ]]; then
+ grep -q docker /proc/self/cgroup && CONTAINER_TYPE="docker"
+fi
+
################################## install docker endpoint #####################
# install the entrypoint script in /usr/bin
@@ -53,7 +69,7 @@ if [[ "$FIRSTRUN" == "yes" ]]; then
cat <<EOF >/etc/systemd/system/multi-user.target.wants/firstrun.service
[Unit]
Description=Firstrun service
-After=network.target
+After=network.target
[Service]
Type=oneshot
@@ -84,7 +100,7 @@ ln -sf ../usr/share/zoneinfo/$TIMEZONE /etc/localtime
################################## run other scripts in turn ##############
function enumerate_tasks() {
- for script in $INSTDIR/common.d/*; do
+ for script in $INSTDIR/common.d/*; do
case $(basename $script) in
[0-9][0-9]_*)
echo $(basename $script):$script
@@ -119,9 +135,8 @@ rm -rf /var/lib/apt/lists/*
rm -rf $INSTDIR # yes, I can auto-terminate myself !
# cleanup /tmp without removing the dir
-for x in $(find /tmp -mindepth 1); do
+for x in $(find /tmp -mindepth 1); do
rm -rf $x || true
done
echo "------------------------ $(basename $0) finished -----------------------"
-