From 96e621b959e7609b92ccd62da8153e2c3e2bef3c Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Wed, 2 Jan 2019 11:39:40 +0100 Subject: [PATCH] gh-131: Fix postinstall ambiguous FreeBSD detection --- pkg/postinstall | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pkg/postinstall b/pkg/postinstall index 4823521..aa148b5 100755 --- a/pkg/postinstall +++ b/pkg/postinstall @@ -10,7 +10,9 @@ rm -f /etc/udev/rules.d/70-persistent-net.rules # Reload udev rules udevadm control --reload >/dev/null 2>&1 || : -# Enable services + +### Enable services ######################################## + if which systemctl >/dev/null 2>&1 && \ [ -d /etc/systemd ] && \ [ -f /usr/lib/systemd/system/one-context.service ]; @@ -46,14 +48,16 @@ elif which rc-update >/dev/null 2>&1; then rc-update add "${S}" boot >/dev/null 2>&1 done -elif [ -f /etc/rc.conf ]; then +elif [ -x /bin/freebsd-version ]; then : else echo 'WARNING: Contextualization service not enabled automatically' >&2 fi -# Cleanup network configuration + +### Cleanup network configuration ########################## + if [ "${NETWORK}" != 'yes' ]; then exit fi @@ -137,13 +141,15 @@ fi # FreeBSD based distros #TODO: pfsense paths? -if [ -f /etc/rc.conf ]; then +if [ -x /bin/freebsd-version ]; then rm -f /etc/rc.conf.d/network /etc/rc.conf.d/routing - sed -i '' \ - -e '/^ifconfig_/d' \ - -e '/^route_/d' \ - -e '/^static_routes/d' \ - -e '/^defaultrouter/d' \ - /etc/rc.conf + if [ -f /etc/rc.conf ]; then + sed -i '' \ + -e '/^ifconfig_/d' \ + -e '/^route_/d' \ + -e '/^static_routes/d' \ + -e '/^defaultrouter/d' \ + /etc/rc.conf + fi fi