fix: respect sudo choice

This commit is contained in:
fanyx 2024-02-28 17:29:15 +01:00
parent 3ed6e5b8e2
commit 15082cac1f
1 changed files with 3 additions and 4 deletions

7
xif
View File

@ -1,8 +1,6 @@
#!/bin/sh
# vim: set ts=4 sw=4 et:
command -v fzf >/dev/null || sudo xbps-install -S fzf
[ -z "$*" ] && echo "xif: empty search term" && exit 1
filter='/^.[i*]. /d'
@ -38,12 +36,13 @@ pkgs() {
cut -d' ' -f1 | tr '\n' ' ' | sed "s/ $//"
}
SUDO=$(which_sudo)
command -v fzf >/dev/null || $SUDO xbps-install -S fzf
PKGS="$(pkgs $@)"
[ -z "$PKGS" ] && exit 130
SUDO=$(which_sudo)
install -S $PKGS
status=$?
if [ $status -eq 16 ]; then
install -u xbps &&