bazzite/just_scripts/sudoif.sh
m2 532190ecce
feat(dev): add easy local iso and vscode integration (#1127)
* feat(dev): add easy local iso and vscode integration

* fix: remove unused variables.
2024-05-15 09:43:05 -07:00

15 lines
404 B
Bash
Executable File

#!/usr/bin/bash
function sudoif(){
if [[ "${TERM_PROGRAM}" == "vscode" && \
! -f /run/.containerenv && \
! -f /.dockerenv ]]; then
[[ $(command -v systemd-run) ]] && \
/usr/bin/systemd-run --uid=0 --gid=0 -d -E TERM="$TERM" -t -q -P -G "$@" \
|| exit 1
else
[[ $(command -v sudo) ]] && \
/usr/bin/sudo "$@" \
|| exit 1
fi
}