aboutsummaryrefslogtreecommitdiffstats
path: root/docker/firstrun.sh
diff options
context:
space:
mode:
authorStephane Desneux <stephane.desneux@iot.bzh>2016-11-30 20:33:52 +0100
committerStephane Desneux <stephane.desneux@iot.bzh>2016-11-30 20:37:12 +0100
commit6643e51c254d2dfed65f03568d1ce11e000f01c3 (patch)
tree21e49ccd23ea04e241cb5b7cd52d80164e2a3d2d /docker/firstrun.sh
parent46067f331f1acb9512795a04b6f2f095b5470ecd (diff)
Initial content
Change-Id: I330ad2e8b08a4743e752b8fe9d1ccf9fa1215f8a Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'docker/firstrun.sh')
-rw-r--r--docker/firstrun.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/docker/firstrun.sh b/docker/firstrun.sh
new file mode 100644
index 0000000..2b70a92
--- /dev/null
+++ b/docker/firstrun.sh
@@ -0,0 +1,37 @@
+#!/bin/bash -x
+
+# fail at first error !
+set -e
+
+# redirect outputs to log
+LOGFILE=/var/log/firstrun.log
+exec >$LOGFILE 2>&1
+
+echo $(date +"%Y%m%d %H:%M:%S") Starting firstrun script
+
+# source same file with .conf extension
+. ${0%.sh}.conf
+
+# run the scripts found in /root/firstrun.d
+
+for x in /root/firstrun.d/*; do
+ case $(basename $x) in
+ [0-9][0-9]_*)
+ echo "--------------------- start script $x ---------------------"
+ . $x
+ echo "--------------------- end of script $x ---------------------"
+ ;;
+ *)
+ ;;
+ esac
+
+done
+
+######################### cleanup #####################
+
+# remove firstrun
+rm -rf /root/firstrun.*
+rm -rf /etc/systemd/system/multi-user.target.wants/firstrun.*
+systemctl daemon-reload
+
+rm -f $LOGFILE