This commit is contained in:
pika 2025-05-18 18:11:45 +02:00
parent bcc0461e58
commit b194b822c8

41
swww.sh
View file

@ -6,6 +6,30 @@
command -v "$@" >/dev/null 2>&1
}
# ─< package variable >───────────────────────────────────────────────────────────────────
unset PACKAGE
# ─< argument list variables >────────────────────────────────────────────────────────────
silent=false
sleep 0.1
PACKAGE=packagename
if command_exists "$PACKAGE"; then
echo_warning "$PACKAGE is already installed!"
echo_warning "Exiting now!"
exit 69
fi
# ─< parse arguments and get variable contents >──────────────────────────────────────────
for arg in "$@"; do
case "$arg" in
--silent | -s)
export silent=true
;;
esac
done
# WHY:
# This import will give you the following variables:
# _sudo="sudo -E" <- only if non root user
@ -64,6 +88,10 @@
}
main() {
if $silent; then
echo_warning "Executing script silently!"
fi
case "$distro" in
arch)
echo_info "Arch detected.. installing directly"
@ -81,18 +109,7 @@
}
if getImports; then
case "$1" in
--silent | -s)
echo_info "Executing main silently.."
silent=true
;;
*) silent=false ;;
esac
main
fi
if ! command_exists swww; then
main
else
echo_warning "swww is already installed!"
fi
}