From 535d1c31fda1a272181380543b332e4b0d49f362 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Mon, 8 Jun 2015 07:23:21 +0000 Subject: [PATCH 1/6] (configd) fix usage to changed implementation --- src/etc/devd/carp.conf | 4 ++-- src/etc/devd/ifnet.conf | 8 ++++---- src/etc/inc/gwlb.inc | 4 ++-- src/etc/inc/interfaces.inc | 2 +- src/etc/inc/system.inc | 2 +- src/etc/inc/vpn.inc | 2 +- src/sbin/ovpn-linkdown | 2 +- src/sbin/ovpn-linkup | 4 ++-- src/sbin/ppp-linkdown | 2 +- src/sbin/ppp-linkup | 8 ++++---- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/etc/devd/carp.conf b/src/etc/devd/carp.conf index 9451eaee0..7c8e41527 100644 --- a/src/etc/devd/carp.conf +++ b/src/etc/devd/carp.conf @@ -6,11 +6,11 @@ notify 100 { match "system" "CARP"; match "type" "MASTER"; - action "/usr/local/opnsense/service/configd_ctl.py 'interface carpmaster $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py interface carpmaster $subsystem"; }; notify 100 { match "system" "CARP"; match "type" "BACKUP"; - action "/usr/local/opnsense/service/configd_ctl.py 'interface carpbackup $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py interface carpbackup $subsystem"; }; diff --git a/src/etc/devd/ifnet.conf b/src/etc/devd/ifnet.conf index ef56acaea..cf92f0d43 100644 --- a/src/etc/devd/ifnet.conf +++ b/src/etc/devd/ifnet.conf @@ -7,28 +7,28 @@ notify 101 { match "system" "IFNET"; match "type" "LINK_UP"; media-type "ethernet"; - action "/usr/local/opnsense/service/configd_ctl.py 'interface linkup start $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py interface linkup start $subsystem"; }; notify 101 { match "system" "IFNET"; match "type" "LINK_DOWN"; media-type "ethernet"; - action "/usr/local/opnsense/service/configd_ctl.py 'interface linkup stop $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py interface linkup stop $subsystem"; }; notify 101 { match "system" "IFNET"; match "type" "LINK_UP"; media-type "802.11"; - action "/usr/local/opnsense/service/configd_ctl.py 'interface linkup start $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py interface linkup start $subsystem"; }; notify 101 { match "system" "IFNET"; match "type" "LINK_DOWN"; media-type "802.11"; - action "/usr/local/opnsense/service/configd_ctl.py 'interface linkup stop $subsystem'"; + action "/usr/local/opnsense/service/configd_ctl.py interface linkup stop $subsystem"; }; # diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index 13841e8c8..5973f4069 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -103,8 +103,8 @@ rrd interval 60s; ## These parameters can be overridden in a specific alarm configuration alarm default { - command on "/usr/local/opnsense/service/configd_ctl.py 'dyndns reload %T' 'ipsecdns reload' 'openvpn reload %T' 'filter reload' " - command off "/usr/local/opnsense/service/configd_ctl.py 'dyndns reload %T' 'ipsecdns reload' 'openvpn reload %T' 'filter reload' " + command on "/usr/local/opnsense/service/configd_ctl.py -m 'dyndns reload %T' 'ipsecdns reload' 'openvpn reload %T' 'filter reload' " + command off "/usr/local/opnsense/service/configd_ctl.py -m 'dyndns reload %T' 'ipsecdns reload' 'openvpn reload %T' 'filter reload' " combine 10s } diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index e9af055d3..cf0297e09 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -5198,7 +5198,7 @@ function interface_setup_pppoe_reset_file($pppif, $iface = '') if(!empty($iface) && !empty($pppif)){ $cron_cmd = <<> /var/etc/nameserver_${1} route change "${DNS2}" ${4} fi - /usr/local/opnsense/service/configd_ctl.py 'dns reload' + /usr/local/opnsense/service/configd_ctl.py dns reload sleep 1 fi - /usr/local/opnsense/service/configd_ctl.py "interface newip ${1}" + /usr/local/opnsense/service/configd_ctl.py interface newip ${1} elif [ "${2}" == "inet6" ]; then # let the configuration system know that the ipv6 has changed. @@ -53,10 +53,10 @@ elif [ "${2}" == "inet6" ]; then echo "${DNS2}" >> /var/etc/nameserver_v6${1} route change -inet6 "${DNS2}" ${4} fi - /usr/local/opnsense/service/configd_ctl.py 'dns reload' + /usr/local/opnsense/service/configd_ctl.py dns reload sleep 1 fi - /usr/local/opnsense/service/configd_ctl.py "interface newipv6 ${1}" + /usr/local/opnsense/service/configd_ctl.py interface newipv6 ${1} fi exit 0 From cd831222f3a7b8e5bbe27a96e4dceeb406e81835 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Mon, 8 Jun 2015 07:26:41 +0000 Subject: [PATCH 2/6] (configd) add configdctl as symlink to sbin for easier usage when using the shell, it's now possible to trigger configd actions in a more natrual way, for example: configdctl configd actions (to list all registered actions) --- src/sbin/configdctl | 1 + 1 file changed, 1 insertion(+) create mode 120000 src/sbin/configdctl diff --git a/src/sbin/configdctl b/src/sbin/configdctl new file mode 120000 index 000000000..fcebdfd12 --- /dev/null +++ b/src/sbin/configdctl @@ -0,0 +1 @@ +/usr/local/opnsense/service/configd_ctl.py \ No newline at end of file From efea84d9489e12d4c7a56e4dd5bf2be7e493b1cf Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 8 Jun 2015 09:52:58 +0200 Subject: [PATCH 3/6] firmware: fold package updates into opnsense-update(8) --- src/etc/rc.initial.firmware | 13 +++++-------- src/opnsense/scripts/pkg_upgrade.sh | 16 +++++++--------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/etc/rc.initial.firmware b/src/etc/rc.initial.firmware index 837f28e2e..713d60e9b 100755 --- a/src/etc/rc.initial.firmware +++ b/src/etc/rc.initial.firmware @@ -42,9 +42,7 @@ esac echo # upgrade all packages if possible -pkg upgrade -y -pkg autoremove -y -pkg clean -y +opnsense-update -p echo @@ -54,8 +52,7 @@ echo echo # if we can update base, we'll do that as well -if opnsense-update -c; then - opnsense-update && /usr/local/etc/rc.reboot -else - opnsense-update -fi +REBOOT= +opnsense-update -c -bk && REBOOT=1 +opnsense-update -bk +[ -n "${REBOOT}" ] /usr/local/etc/rc.reboot diff --git a/src/opnsense/scripts/pkg_upgrade.sh b/src/opnsense/scripts/pkg_upgrade.sh index 8868cbab5..2b3471a6b 100755 --- a/src/opnsense/scripts/pkg_upgrade.sh +++ b/src/opnsense/scripts/pkg_upgrade.sh @@ -40,18 +40,16 @@ if [ -z "$pkg_running" ]; then echo '***STARTING UPGRADE***' >> ${PKG_PROGRESS_FILE} if [ "$package" == "all" ]; then # update all installed packages - pkg upgrade -y >> ${PKG_PROGRESS_FILE} - pkg autoremove -y >> ${PKG_PROGRESS_FILE} - pkg clean -y >> ${PKG_PROGRESS_FILE} + opnsense-update -p >> ${PKG_PROGRESS_FILE} # restart the web server /usr/local/etc/rc.restart_webgui >> ${PKG_PROGRESS_FILE} # if we can update base, we'll do that as well - if opnsense-update -c; then - echo "!!!!!!!!!!!! ATTENTION !!!!!!!!!!!" >> ${PKG_PROGRESS_FILE} - echo "A kernel/base upgrade is required." >> ${PKG_PROGRESS_FILE} - echo "try to perform immediately" >> ${PKG_PROGRESS_FILE} - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> ${PKG_PROGRESS_FILE} - if opnsense-update >> ${PKG_PROGRESS_FILE}; then + if opnsense-update -c -bk; then + echo "!!!!!!!!!!!! ATTENTION !!!!!!!!!!!!!!" >> ${PKG_PROGRESS_FILE} + echo "A kernel/base upgrade is in progress." >> ${PKG_PROGRESS_FILE} + echo "Please do not turn off the system." >> ${PKG_PROGRESS_FILE} + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> ${PKG_PROGRESS_FILE} + if opnsense-update -bk >> ${PKG_PROGRESS_FILE}; then REBOOT=1 fi fi From b232cf7d7474bdc039249c92eb7575538bdf9c78 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 8 Jun 2015 09:59:29 +0200 Subject: [PATCH 4/6] python: always launch via env(1) --- src/etc/rc.d/configd | 2 +- src/opnsense/service/configd.py | 2 +- src/opnsense/service/configd_ctl.py | 2 +- src/opnsense/service/execute_command.py | 2 +- src/opnsense/service/modules/daemonize.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/etc/rc.d/configd b/src/etc/rc.d/configd index e4c13ee90..5cc03e887 100755 --- a/src/etc/rc.d/configd +++ b/src/etc/rc.d/configd @@ -24,7 +24,7 @@ configd_load_rc_config() required_files="" command_args="${required_args}" command=/usr/local/opnsense/service/configd.py - command_interpreter=/usr/local/bin/python2.7 + command_interpreter="/usr/bin/env python2.7" } # diff --git a/src/opnsense/service/configd.py b/src/opnsense/service/configd.py index a5ac09b92..94c53e5b1 100755 --- a/src/opnsense/service/configd.py +++ b/src/opnsense/service/configd.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/bin/env python2.7 """ Copyright (c) 2014 Ad Schellevis diff --git a/src/opnsense/service/configd_ctl.py b/src/opnsense/service/configd_ctl.py index 09ff1891d..ab5129a56 100755 --- a/src/opnsense/service/configd_ctl.py +++ b/src/opnsense/service/configd_ctl.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/bin/env python2.7 """ Copyright (c) 2015 Ad Schellevis diff --git a/src/opnsense/service/execute_command.py b/src/opnsense/service/execute_command.py index c28a7063e..d71404a29 100755 --- a/src/opnsense/service/execute_command.py +++ b/src/opnsense/service/execute_command.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/bin/env python2.7 """ Copyright (c) 2014 Ad Schellevis diff --git a/src/opnsense/service/modules/daemonize.py b/src/opnsense/service/modules/daemonize.py index 07846b7cc..118008b5a 100644 --- a/src/opnsense/service/modules/daemonize.py +++ b/src/opnsense/service/modules/daemonize.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python2.7 # original source from https://github.com/thesharp/daemonize From 01870edad79902925fb4e60f1317d62455a1a634 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 8 Jun 2015 10:04:21 +0200 Subject: [PATCH 5/6] configctl: launcher for the real deal --- src/sbin/configctl | 4 ++++ src/sbin/configdctl | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100755 src/sbin/configctl delete mode 120000 src/sbin/configdctl diff --git a/src/sbin/configctl b/src/sbin/configctl new file mode 100755 index 000000000..e4a6997a3 --- /dev/null +++ b/src/sbin/configctl @@ -0,0 +1,4 @@ +#!/bin/sh + +# launch the real utility from here +/usr/local/opnsense/service/configd_ctl.py "${@}" diff --git a/src/sbin/configdctl b/src/sbin/configdctl deleted file mode 120000 index fcebdfd12..000000000 --- a/src/sbin/configdctl +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opnsense/service/configd_ctl.py \ No newline at end of file From 4d101e7cab1b9d8cd2efbef51631e5d1d21f5c3d Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 8 Jun 2015 10:55:29 +0200 Subject: [PATCH 6/6] firmware: folded message into opnsense-update(8) --- src/opnsense/scripts/pkg_upgrade.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/opnsense/scripts/pkg_upgrade.sh b/src/opnsense/scripts/pkg_upgrade.sh index 2b3471a6b..ad78b61da 100755 --- a/src/opnsense/scripts/pkg_upgrade.sh +++ b/src/opnsense/scripts/pkg_upgrade.sh @@ -45,10 +45,6 @@ if [ -z "$pkg_running" ]; then /usr/local/etc/rc.restart_webgui >> ${PKG_PROGRESS_FILE} # if we can update base, we'll do that as well if opnsense-update -c -bk; then - echo "!!!!!!!!!!!! ATTENTION !!!!!!!!!!!!!!" >> ${PKG_PROGRESS_FILE} - echo "A kernel/base upgrade is in progress." >> ${PKG_PROGRESS_FILE} - echo "Please do not turn off the system." >> ${PKG_PROGRESS_FILE} - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> ${PKG_PROGRESS_FILE} if opnsense-update -bk >> ${PKG_PROGRESS_FILE}; then REBOOT=1 fi