Skip to content

add doas/su support #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions vpsm
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ rmsg () {
}


# --------------------------------------------------------------------------------------------
SUDO=
if command -v sudo >/dev/null; then
SUDO=sudo
elif command -v doas >/dev/null && [ -f /etc/doas.conf ]; then
SUDO=doas
elif [ "$(whoami)" != root ]; then
SUDO='su root -c '\''"$@"'\'' -- -'
fi


# --------------------------------------------------------------------------------------------

setcolors on
Expand Down Expand Up @@ -138,7 +149,7 @@ elif ! [ -d $distdir ]; then
msg "Cloned!"

msg "Install xtools utility "
sudo xbps-install xtools
$SUDO xbps-install xtools

exit
else
Expand Down Expand Up @@ -259,7 +270,7 @@ usage () {
echo "update-check (upc) <pkgname> - Check upstream site of <pkgname> for new releases."
echo "update-sys (ups) - Rebuilds packages in system and updates them."
echo "xgsum <pkgname> - Generate SHA256 for <pkgname> template."
echo "xinstall (xi) <pkgname> - Like xbps-install -S <pkgname>, but take cwd repo and sudo/su into account."
echo "xinstall (xi) <pkgname> - Like xbps-install -S <pkgname>, but take cwd repo and sudo/doas/su into account."
echo
echo -n "$colorreset"
}
Expand Down Expand Up @@ -506,11 +517,11 @@ case "$cmd" in

cd /usr/bin
msg "chown root:xbuilder xbps-uchroot "
sudo chown root:xbuilder xbps-uchroot
$SUDO chown root:xbuilder xbps-uchroot
msg "chmod 4750 xbps-uchroot"
sudo chmod 4750 xbps-uchroot
$SUDO chmod 4750 xbps-uchroot
msg "usermod -a -G xbuilder $whoami"
sudo usermod -a -G xbuilder $whoami
$SUDO usermod -a -G xbuilder $whoami

# cd $OLDPWD
# msg "add void-linux/void-packages track repository "
Expand Down Expand Up @@ -604,7 +615,7 @@ case "$cmd" in
shopt -s globstar

msg "Remove package and purge distfiles -> $* "
sudo xbps-remove -v -R "$@"
$SUDO xbps-remove -v -R "$@"
rm -rf $VOID_BINPKGS/**/*$@*

shopt -u globstar
Expand Down