wip
This commit is contained in:
parent
bcc0461e58
commit
b194b822c8
1 changed files with 29 additions and 12 deletions
41
swww.sh
41
swww.sh
|
@ -6,6 +6,30 @@
|
||||||
command -v "$@" >/dev/null 2>&1
|
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:
|
# WHY:
|
||||||
# This import will give you the following variables:
|
# This import will give you the following variables:
|
||||||
# _sudo="sudo -E" <- only if non root user
|
# _sudo="sudo -E" <- only if non root user
|
||||||
|
@ -64,6 +88,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
if $silent; then
|
||||||
|
echo_warning "Executing script silently!"
|
||||||
|
fi
|
||||||
|
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
arch)
|
arch)
|
||||||
echo_info "Arch detected.. installing directly"
|
echo_info "Arch detected.. installing directly"
|
||||||
|
@ -81,18 +109,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if getImports; then
|
if getImports; then
|
||||||
case "$1" in
|
main
|
||||||
--silent | -s)
|
|
||||||
echo_info "Executing main silently.."
|
|
||||||
silent=true
|
|
||||||
;;
|
|
||||||
*) silent=false ;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command_exists swww; then
|
|
||||||
main
|
|
||||||
else
|
|
||||||
echo_warning "swww is already installed!"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue