Skip to content

Commit

Permalink
fix: cd before exec for argument (#51)
Browse files Browse the repository at this point in the history
* fix: cd before exec for argument

* fix: Use pushd/popd
  • Loading branch information
Gu1nness authored Oct 3, 2024
1 parent 6a0792e commit faa8a20
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions snap/local/drop_priv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@

export PBM_MONGODB_URI="$(snapctl get pbm-uri)"

pushd "${SNAP}" > /dev/null

if [[ $(id -u) == "0" ]]; then
exec bash -c "cd ${SNAP} && \
${SNAP}/usr/bin/setpriv \
exec "${SNAP}"/usr/bin/setpriv \
--clear-groups \
--reuid snap_daemon \
--regid snap_daemon \
-- \
${SNAP}/usr/bin/$*"
"${SNAP}/usr/bin/$@"
else
exec bash -c "cd ${SNAP} && \
${SNAP}/usr/bin/$*"
exec "${SNAP}/usr/bin/$@"
fi

popd > /dev/null

0 comments on commit faa8a20

Please sign in to comment.