-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrun-user-script
executable file
·46 lines (39 loc) · 1.46 KB
/
run-user-script
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
38
39
40
41
42
43
44
45
46
#!/bin/sh
#
# This file is part of Celestial (https://github.com/OpenFogStack/celestial).
# Copyright (c) 2024 Tobias Pfandzelter, The OpenFogStack Team.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# if /dev/ptp0 is available, we can use it as a time source
if [ -e /dev/ptp0 ]; then
# setup chrony to use PTP as the time source
echo "refclock PHC /dev/ptp0 poll -2 dpoll -2 offset 0 trust prefer" > /etc/chrony/chrony.conf
echo "Using PTP clock /dev/ptp0 as time source"
else
echo "NOT using PTP clock /dev/ptp0 as time source"
fi
# start chronyd
rc-service chronyd start
# clock synchronization
chronyc makestep
sleep 1
chronyc makestep
# chronyc tracking
# network setup
IP=$(/sbin/ip route | awk '/default/ { print $3 }')
echo "$IP info.celestial" >> /etc/hosts
echo "Celestial: Starting user script..."
/bin/sh app.sh
echo "Celestial: User script finished, shutting down..."
reboot -f # reboot actually shuts down the microVM in Firecracker