Skip to content

Commit 75113c8

Browse files
committed
Script for detection openvpn device
1 parent dec5ee5 commit 75113c8

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ services:
7676

7777
|**Parameter**|**Function**|
7878
|:-----------:|:----------:|
79+
|`-e CONFIG=test.conf`|Config file name|
7980
|`-e FAIL_MODE=hard`|Restart whole container on error|
8081
|`-e PUID=1000`|for UserID - see below for explanation|
8182
|`-e PGID=1000`|for GroupID - see below for explanation|

root/etc/cont-finish.d/60-network.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010

1111
config="$(ovpn-confpath)"
1212

13-
device="$(cat $OPENVPN_DIR/$config | sed -n -re 's/^\s*dev\s*(\w+)\s*$/\1/p')"
13+
device="$(ovpn-dev)"
1414
if [ -z "$device" ]; then
1515
echo 'Interface not set'
1616
exit 1

root/etc/cont-init.d/60-network.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fi
2727
config="$(ovpn-confpath)"
2828

2929
# Configured interface
30-
device="$(cat $OPENVPN_DIR/$config | sed -n -re 's/^\s*dev\s*(\w+)\s*$/\1/p')"
30+
device="$(ovpn-dev)"
3131
if [ -z "$device" ]; then
3232
echo 'Interface not set'
3333
exit 1

root/usr/local/bin/ovpn-dev

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/with-contenv bash
2+
#
3+
# Prints OpenVPN device
4+
#
5+
6+
config=$(ovpn-confpath)
7+
if [ -z "$config" ]; then
8+
exit 0
9+
fi
10+
11+
device="$(cat $OPENVPN_DIR/$config | sed -n -re 's/^\s*dev\s*(\w+)\s*$/\1/p')"
12+
echo "$device"

0 commit comments

Comments
 (0)