Skip to content

Commit 2bb4e0d

Browse files
committed
Fix Privado update script sed file paths
This fixes sed "can't read *.ovpn: No such file or directory" error when running the updateConfigs.sh script from a different directory.
1 parent 2bc5a67 commit 2bb4e0d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

openvpn/privado/updateConfigs.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
# If the script is called from elsewhere
6-
cd "$(dirname "$0")"
6+
cd "${0%/*}"
77

88
# Delete everything (not this script though)
99
find . ! -name '*.sh' -delete
@@ -13,14 +13,16 @@ curl -L https://privado.io/apps/ovpn_configs.zip -o privado_configs.zip &&
1313
unzip -j privado_configs.zip && rm -f privado_configs.zip
1414

1515
# Delete "tcp-scramble" files
16-
rm -f *.tcp-scramble.ovpn
16+
rm -f ./*.tcp-scramble.ovpn
1717

18-
# Strip out ".default" from filenames
19-
for f in *.default.ovpn; do mv -- "$f" "${f%.default.ovpn}.ovpn"; done
20-
21-
# Update configs with correct paths
22-
sed -i "s/auth-user-pass/auth-user-pass \/config\/openvpn-credentials.txt/" *.ovpn
18+
for f in *.default.ovpn; do
19+
fn="${f%.default.ovpn}.ovpn"
20+
# Strip out ".default" from filenames
21+
mv -- "$f" "$fn"
22+
# Update configs with correct paths
23+
sed -i "s/auth-user-pass/auth-user-pass \/config\/openvpn-credentials.txt/" "$fn"
24+
done
2325

2426
# Create symlink for default.ovpn using the first ams-XXX.ovpn file
2527
files=(ams-*.ovpn)
26-
ln -sf "${files[1]}" default.ovpn
28+
ln -sf "${files[1]}" default.ovpn

0 commit comments

Comments
 (0)