blob: 2b70a92ac4040c86a7aa439596fb3303ab1b9807 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
|