dotfiles/lib/lib.sh

27 lines
375 B
Bash
Raw Normal View History

2022-12-16 14:23:28 +01:00
#!/bin/sh
2022-12-16 15:33:59 +01:00
. ./sync.conf || . ../sync.conf
2022-12-16 14:23:28 +01:00
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
}
2022-12-16 15:33:59 +01:00
is_graphical() {
command -v $PREF_TERM && return 0 || return 1
2022-12-18 21:51:53 +01:00
}
2022-12-18 22:03:55 +01:00
command -v $SYS_SUDO || SYS_SUDO=""