opnsense-core/+POST_INSTALL
Franco Fichtner 6fd1fd0d74 pkg: move rc to /etc/rc.opnsense; closes #2416
Move /usr/local/etc/rc to /etc/rc.opnsense in order to be able
to boot without /usr mounted.  Move the /boot files along with
it since they require the same type of /usr/local-escapting.

1. This needs further testing.  :)
2. Inspect rc script for commands depend on /usr tools

Our rc.shutdown stays where it is, if we can shutdown we should be
able to access it.  If not, it's not grabbed via /etc/rc.shutdown.
2018-10-27 22:12:04 +02:00

36 lines
1.1 KiB
Text

echo "Updating /etc/shells"
cp /etc/shells /etc/shells.bak
(grep -v /usr/local/sbin/opnsense-shell /etc/shells.bak; \
echo /usr/local/sbin/opnsense-shell) > /etc/shells
rm -f /etc/shells.bak
cp /etc/shells /etc/shells.bak
(grep -v /usr/local/sbin/opnsense-installer /etc/shells.bak; \
echo /usr/local/sbin/opnsense-installer) > /etc/shells
rm -f /etc/shells.bak
echo "Registering root shell"
pw usermod -n root -s /usr/local/sbin/opnsense-shell
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 /etc/rc.opnsense ]; then exec /etc/rc.opnsense; 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 exec /usr/local/etc/rc.shutdown; fi
EOF
cat /etc/rc.shutdown.bak >> /etc/rc.shutdown
rm -f /etc/rc.shutdown.bak
/usr/local/etc/rc.d/configd start
/usr/local/etc/rc.configure_firmware