(feat) add help menu and some pacman checks
This commit is contained in:
parent
1937426dcb
commit
44afad7241
25
brick.sh
25
brick.sh
|
@ -40,7 +40,7 @@ brickdb() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_installed() {
|
pkg_installed() {
|
||||||
if [ ! -z $(echo "$BRICKS_INSTALLED" | grep "$1") ]; then
|
if [ ! -z $(echo "$BRICKS_INSTALLED" | grep -E "^$1 \\\\d") ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
|
@ -53,7 +53,7 @@ user_confirm() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -r -n 1 -p "${1:-Continue?} [Y/n]: " REPLY
|
read -r -n 1 -p "$(inf "- ${1:-Continue?} [Y/n]: ")" REPLY
|
||||||
case $REPLY in
|
case $REPLY in
|
||||||
[yY]) echo ; return 0 ;;
|
[yY]) echo ; return 0 ;;
|
||||||
[nN]) echo ; return 1 ;;
|
[nN]) echo ; return 1 ;;
|
||||||
|
@ -150,6 +150,14 @@ while [[ $# -gt 0 ]]; do
|
||||||
echo "https://git.blek.codes/blek/os"
|
echo "https://git.blek.codes/blek/os"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
-h|--help)
|
||||||
|
echo "brick $version (gpl 3 only)"
|
||||||
|
inf "Usage: $0 [PACKAGES]"
|
||||||
|
inf "$(inf "-h --help \t - Display this message")"
|
||||||
|
inf "$(inf "-v --version \t - Print version and exit")"
|
||||||
|
inf "$(inf "-L \t - List all packages")"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
-*)
|
-*)
|
||||||
# meh domt need unkonw args
|
# meh domt need unkonw args
|
||||||
shift;;
|
shift;;
|
||||||
|
@ -186,8 +194,11 @@ if [ "${#PKGS[@]}" == "0" ]; then
|
||||||
inf "nothing to do"
|
inf "nothing to do"
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
inf "Packages to install: ${PKGS[@]}"
|
inf "packages to install: ${PKGS[@]}"
|
||||||
user_confirm
|
if ! user_confirm; then
|
||||||
|
inf "canceled"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PACDEPS=()
|
PACDEPS=()
|
||||||
|
@ -220,6 +231,12 @@ if [ "${#PACDEPS[@]}" != "0" ]; then
|
||||||
|
|
||||||
# then there might actually be no work to be done
|
# then there might actually be no work to be done
|
||||||
if [ "$TO_INSTALL" != "" ]; then
|
if [ "$TO_INSTALL" != "" ]; then
|
||||||
|
|
||||||
|
if [ -f /var/lib/pacman/db.lck ]; then
|
||||||
|
errcho "pacman is running now; can't install pacman deps"
|
||||||
|
errcho "if you are sure that pacman is not running, delete /var/lib/pacman/db.lck manually"
|
||||||
|
fi
|
||||||
|
|
||||||
inf "installing pacman packages:"
|
inf "installing pacman packages:"
|
||||||
inf "$TO_INSTALL"
|
inf "$TO_INSTALL"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue