Package: openvpn Version: 2.3.2-5 Tags: patch This patch moves all openvpn /var/run files down into a subdirectory. This change is in support of running openvpn in a chroot: it allows that subdirectory to be moved into the chroot tree and still be soft-linked from the real /var/run (and thus visible to this script).
This patch is a subset of the patch in bug 614036. I hope this small and more focused patch will be easier to review and that you will thus be able to apply it now. Although it is a trivial change, this patch is invasive in that it touches lines throughout the script. Getting it merged upstream would greatly ease the burden of carrying forward the patch in 614036 until you have a chance to consider its more complicated behavior. < Stephen --- debian/openvpn.init.d-2.3.2-5 2013-07-15 07:10:04.000000000 -0700 +++ debian/openvpn.init.d 2013-11-06 22:25:23.400062084 -0800 @@ -55,9 +55,11 @@ STATUSARG="" else # prepare default status file - STATUSARG="--status /var/run/openvpn.$NAME.status $STATUSREFRESH" + STATUSARG="--status /var/run/openvpn/$NAME.status $STATUSREFRESH" fi + mkdir -p /var/run/openvpn + # tun using the "subnet" topology confuses the routing code that wrongly # emits ICMP redirects for client to client communications SAVED_DEFAULT_SEND_REDIRECTS=0 @@ -82,12 +84,12 @@ STATUS=0 start-stop-daemon --start --quiet --oknodo \ - --pidfile /var/run/openvpn.$NAME.pid \ - --exec $DAEMON -- $OPTARGS --writepid /var/run/openvpn.$NAME.pid \ + --pidfile /var/run/openvpn/$NAME.pid \ + --exec $DAEMON -- $OPTARGS --writepid /var/run/openvpn/$NAME.pid \ $DAEMONARG $STATUSARG --cd $CONFIG_DIR \ --config $CONFIG_DIR/$NAME.conf || STATUS=1 - [ "$OMIT_SENDSIGS" -ne 1 ] || ln -s /var/run/openvpn.$NAME.pid /run/sendsigs.omit.d/openvpn.$NAME.pid + [ "$OMIT_SENDSIGS" -ne 1 ] || ln -s /var/run/openvpn/$NAME.pid /run/sendsigs.omit.d/openvpn.$NAME.pid # Set the back the original default value of send_redirects if it was changed if [ "$SAVED_DEFAULT_SEND_REDIRECTS" -ne 0 ]; then @@ -100,7 +102,7 @@ if [ "$?" -eq 0 ]; then rm -f $PIDFILE [ "$OMIT_SENDSIGS" -ne 1 ] || rm -f /run/sendsigs.omit.d/openvpn.$NAME.pid - rm -f /var/run/openvpn.$NAME.status 2> /dev/null + rm -f /var/run/openvpn/$NAME.status 2> /dev/null fi } @@ -152,7 +154,7 @@ log_daemon_msg "Stopping $DESC" if test -z "$2" ; then - for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do + for PIDFILE in `ls /var/run/openvpn/*.pid 2> /dev/null`; do NAME=`echo $PIDFILE | cut -c18-` NAME=${NAME%%.pid} stop_vpn @@ -161,8 +163,8 @@ else while shift ; do [ -z "$1" ] && break - if test -e /var/run/openvpn.$1.pid ; then - PIDFILE=`ls /var/run/openvpn.$1.pid 2> /dev/null` + if test -e /var/run/openvpn/$1.pid ; then + PIDFILE=`ls /var/run/openvpn/$1.pid 2> /dev/null` NAME=`echo $PIDFILE | cut -c18-` NAME=${NAME%%.pid} stop_vpn @@ -177,7 +179,7 @@ # Only 'reload' running VPNs. New ones will only start with 'start' or 'restart'. reload|force-reload) log_daemon_msg "Reloading $DESC" - for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do + for PIDFILE in `ls /var/run/openvpn/*.pid 2> /dev/null`; do NAME=`echo $PIDFILE | cut -c18-` NAME=${NAME%%.pid} # If openvpn if running under a different user than root we'll need to restart @@ -196,7 +198,7 @@ # Only 'soft-restart' running VPNs. New ones will only start with 'start' or 'restart'. soft-restart) log_daemon_msg "$DESC sending SIGUSR1" - for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do + for PIDFILE in `ls /var/run/openvpn/*.pid 2> /dev/null`; do NAME=`echo $PIDFILE | cut -c18-` NAME=${NAME%%.pid} kill -USR1 `cat $PIDFILE` || true @@ -212,7 +214,7 @@ ;; cond-restart) log_daemon_msg "Restarting $DESC." - for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do + for PIDFILE in `ls /var/run/openvpn/*.pid 2> /dev/null`; do NAME=`echo $PIDFILE | cut -c18-` NAME=${NAME%%.pid} stop_vpn @@ -259,9 +261,9 @@ fi if test "x$AUTOVPN" = "x1" ; then # If it is autostarted, then it contributes to global status - status_of_proc -p /var/run/openvpn.${NAME}.pid openvpn "VPN '${NAME}'" || GLOBAL_STATUS=1 + status_of_proc -p /var/run/openvpn/${NAME}.pid openvpn "VPN '${NAME}'" || GLOBAL_STATUS=1 else - status_of_proc -p /var/run/openvpn.${NAME}.pid openvpn "VPN '${NAME}' (non autostarted)" || true + status_of_proc -p /var/run/openvpn/${NAME}.pid openvpn "VPN '${NAME}' (non autostarted)" || true fi done else @@ -272,7 +274,7 @@ NAME=$1 if test -e $CONFIG_DIR/$NAME.conf ; then # Config exists - status_of_proc -p /var/run/openvpn.${NAME}.pid openvpn "VPN '${NAME}'" || GLOBAL_STATUS=1 + status_of_proc -p /var/run/openvpn/${NAME}.pid openvpn "VPN '${NAME}'" || GLOBAL_STATUS=1 else # Config does not exist log_warning_msg "VPN '$NAME': missing $CONFIG_DIR/$NAME.conf file !" -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org