forked from opnsense/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
+POST_INSTALL
45 lines (39 loc) · 1.44 KB
/
+POST_INSTALL
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
echo "Updating /etc/shells"
cp /etc/shells /etc/shells.bak
(grep -v /usr/local/etc/rc.initial /etc/shells.bak; \
echo /usr/local/etc/rc.initial) > /etc/shells
rm -f /etc/shells.bak
cp /etc/shells /etc/shells.bak
(grep -v /usr/local/etc/rc.installer /etc/shells.bak; \
echo /usr/local/etc/rc.installer) > /etc/shells
rm -f /etc/shells.bak
echo "Registering root shell"
pw usermod -n root -s /usr/local/etc/rc.initial
echo "Hooking into /etc/rc"
cp /etc/rc /etc/rc.bak
cat > /etc/rc <<EOF
#!/bin/sh
# OPNsense rc(8) hook was automatically installed:
if [ -f /usr/local/etc/rc ]; then /usr/local/etc/rc; exit 0; fi
EOF
cat /etc/rc.bak >> /etc/rc
rm -f /etc/rc.bak
echo "Hooking into /etc/rc.shutdown"
cp /etc/rc.shutdown /etc/rc.shutdown.bak
cat > /etc/rc.shutdown <<EOF
#!/bin/sh
# OPNsense rc(8) hook was automatically installed:
if [ -f /usr/local/etc/rc.shutdown ]; then /usr/local/etc/rc.shutdown; exit 0; fi
EOF
cat /etc/rc.shutdown.bak >> /etc/rc.shutdown
rm -f /etc/rc.shutdown.bak
echo "Writing package metadata"
mkdir -p /usr/local/opnsense/version
if [ -f /usr/local/opnsense/version/opnsense ]; then
mv /usr/local/opnsense/version/opnsense /usr/local/opnsense/version/opnsense.last
fi
echo "%%CORE_COMMIT%%" > /usr/local/opnsense/version/opnsense
echo "%%CORE_NAME%%" > /usr/local/opnsense/version/opnsense.name
echo "%%CORE_ABI%%" > /usr/local/opnsense/version/opnsense.abi
/usr/local/etc/rc.d/configd start
/usr/local/etc/rc.configure_firmware