Backport install-gosu-binary-wrapper from dockbuid

To ensure that our custom sudo wrapper is not
overwritten by a future re-install of sudo, it
is created in /usr/loca/bin

See https://github.com/dockbuild/dockbuild/issues/52
This commit is contained in:
Jean-Christophe Fillion-Robin
2019-06-08 17:47:03 -04:00
parent f5c380f467
commit edf132509b
6 changed files with 36 additions and 36 deletions

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -ex
set -o pipefail
if ! command -v gosu &> /dev/null; then
echo >&2 'error: "gosu" not found!'
exit 1
fi
# verify that the binary works
gosu nobody true
# To ensure that our custom sudo wrapper is not
# overwritten by a future re-install of sudo, it
# is created in /usr/loca/bin
cat << EOF >> /usr/local/bin/sudo
#!/bin/sh
# Emulate the sudo command
exec gosu root:root "\$@"
EOF
chmod +x /usr/local/bin/sudo

View File

@ -44,18 +44,3 @@ fi
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc
chmod +x /usr/local/bin/gosu
# verify that the binary works
gosu nobody true
cat << EOF >> /usr/bin/sudo
#!/bin/sh
# Emulate the sudo command
exec gosu root:root "\$@"
EOF
chmod +x /usr/bin/sudo