summaryrefslogtreecommitdiffhomepage
path: root/dist-assets/pkg-scripts
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2021-05-18 18:28:47 +0100
committerEmīls <emils@mullvad.net>2021-12-10 09:58:51 +0000
commit2b48ee7a513651f65e2db5ff48eeb2fdb14d881a (patch)
tree540c00042091c75de08685020d1f110182c7c920 /dist-assets/pkg-scripts
parent05ae3cad58eea7319a566323e7fdc326f8035470 (diff)
downloadmullvadvpn-2b48ee7a513651f65e2db5ff48eeb2fdb14d881a.tar.xz
mullvadvpn-2b48ee7a513651f65e2db5ff48eeb2fdb14d881a.zip
Add exclusion GID fetcher
Diffstat (limited to 'dist-assets/pkg-scripts')
-rwxr-xr-xdist-assets/pkg-scripts/preinstall13
1 files changed, 13 insertions, 0 deletions
diff --git a/dist-assets/pkg-scripts/preinstall b/dist-assets/pkg-scripts/preinstall
index ef6d953970..c8561c0730 100755
--- a/dist-assets/pkg-scripts/preinstall
+++ b/dist-assets/pkg-scripts/preinstall
@@ -30,3 +30,16 @@ fi
# There is a risk that they're incompatible with the format this version wants
rm "$NEW_CACHE_DIR/relays.json" || true
rm "$NEW_CACHE_DIR/api-ip-address.txt" || true
+
+# Create a group for mullvad-exclusion
+MULLVAD_EXCLUSION_GROUP="mullvad-exclusion"
+if ! dscl . -list /Groups | grep $MULLVAD_EXCLUSION_GROUP; then
+ dscl . -create /Groups/$MULLVAD_EXCLUSION_GROUP \
+ || echo "FAILED TO CREATE $MULLVAD_EXCLUSION_GROUP GROUP"
+fi
+if ! dscl . -read /Groups/$MULLVAD_EXCLUSION_GROUP | grep PrimaryGroupID; then
+ MULLVAD_EXCLUSION_GID=$(( RANDOM ))
+ dscl . -append /Groups/$MULLVAD_EXCLUSION_GROUP PrimaryGroupID $MULLVAD_EXCLUSION_GID \
+ && echo "Created mullvad-exclusion group with gid $MULLVAD_EXCLUSION_GID" \
+ || echo "FAILED TO CREATE 'mullvad-exclusion' group"
+fi