dotfiles/lib/lib.sh
2022-12-18 21:51:53 +01:00

27 lines
No EOL
376 B
Bash

#!/bin/sh
. ./sync.conf || . ../sync.conf
DRY_RUN=${DRY_RUN:-no}
bool() {
case "$1" in
1|true|yes|on|TRUE|YES|ON) return 0 ;;
*) return 1 ;;
esac
}
run() {
if bool "$DRY_RUN"; then
echo "DRY: + $*"
else
echo "+ $*"
"$@"
fi
}
is_graphical() {
command -v $PREF_TERM && return 0 || return 1
}
command -v $SYS_SUDO || $SYS_SUDO=""