Auto install option!

A external parameter to auto install without questions!
This commit is contained in:
luizoti 2020-03-07 12:59:10 -03:00 committed by GitHub
parent 27cd3d4da4
commit eb84f27919
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,7 @@
#! /bin/bash #! /bin/bash
INPUT=$1
show_question() { show_question() {
echo -e "\033[1;34m$@\033[0m" echo -e "\033[1;34m$@\033[0m"
} }
@ -18,12 +20,22 @@ end() {
} }
continue() { continue() {
show_question "\nDo you want to continue? (Y)es, (N)o : \n" case ${INPUT} in
read INPUT '-a' )
case $INPUT in :
( [Yy]* ) ;; ;;
( [Nn]* ) end;; '-h' )
( * ) show_error "\nSorry, try again."; continue;; echo " -a - Auto-install for all users!"
;;
* )
show_question "\nDo you want to continue? (Y)es, (N)o : \n"
read INPUT
case $INPUT in
( [Yy]* ) ;;
( [Nn]* ) end;;
( * ) show_error "\nSorry, try again."; continue;;
esac
;;
esac esac
} }
@ -35,6 +47,7 @@ replace() {
( [Nn]* ) ;; ( [Nn]* ) ;;
( * ) show_error "\tSorry, try again."; replace $@;; ( * ) show_error "\tSorry, try again."; replace $@;;
esac esac
} }
install() { install() {
@ -113,13 +126,25 @@ remove() {
} }
main() { main() {
show_question "What you want to do: (I)nstall, (R)emove : \n" case ${INPUT} in
read INPUT '-a' )
case $INPUT in install
( [Ii]* ) install;; ;;
( [Rr]* ) remove;; '-h' )
( * ) show_error "\nSorry, try again."; main;; echo " -a - Auto-install for all users!"
esac ;;
* )
show_question "What you want to do: (I)nstall, (R)emove : \n"
read INPUT
case $INPUT in
( [Ii]* ) install;;
( [Rr]* ) remove;;
( * ) show_error "\nSorry, try again."; main;;
esac
;;
esac
} }
ROOT_UID=0 ROOT_UID=0