wip
This commit is contained in:
parent
80a8909add
commit
bcc0461e58
1 changed files with 32 additions and 11 deletions
43
rofi.sh
43
rofi.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
|
||||||
|
@ -77,6 +101,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
if $silent; then
|
||||||
|
echo_warning "Executing script silently!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! getDependencies; then
|
||||||
|
echo_error "Error when installing dependencies.."
|
||||||
|
fi
|
||||||
|
|
||||||
local rofiTemp="$(mktemp -d)"
|
local rofiTemp="$(mktemp -d)"
|
||||||
if ! command_exists rofi; then
|
if ! command_exists rofi; then
|
||||||
echo_info "Cloning rofi to $rofiTemp/rofi"
|
echo_info "Cloning rofi to $rofiTemp/rofi"
|
||||||
|
@ -102,17 +134,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if getImports; then
|
if getImports; then
|
||||||
case "$@" in
|
|
||||||
--silent | -s)
|
|
||||||
silent=true
|
|
||||||
echo_warning "Running script silently!"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
silent=false
|
|
||||||
echo_warning "$@ is not a valid argument"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
getDependencies
|
|
||||||
main </dev/tty
|
main </dev/tty
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue