aboutsummaryrefslogtreecommitdiffstats
path: root/INSTALL/firstrun.sh
diff options
context:
space:
mode:
authorStephane Desneux <stephane.desneux@iot.bzh>2016-11-30 23:53:02 +0100
committerStephane Desneux <stephane.desneux@iot.bzh>2016-11-30 23:53:02 +0100
commit19828c52e5b50de79739e2c206382be74e596847 (patch)
tree1a29e87054648ae49ebd36aaf68737e8dcef0be7 /INSTALL/firstrun.sh
parent5e50ec8d65705b41140d06ec13611f0b3108f7b9 (diff)
group build files into folder INSTALL
Change-Id: Ib76d53f9ff0aed21f12ebd7aac66c1e877bea4a5 Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'INSTALL/firstrun.sh')
-rw-r--r--INSTALL/firstrun.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/INSTALL/firstrun.sh b/INSTALL/firstrun.sh
new file mode 100644
index 0000000..2b70a92
--- /dev/null
+++ b/INSTALL/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