From eb84f27919e433f9b72e7ef9f6444d4a7d276ba9 Mon Sep 17 00:00:00 2001 From: luizoti Date: Sat, 7 Mar 2020 12:59:10 -0300 Subject: [PATCH] Auto install option! A external parameter to auto install without questions! --- install.sh | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 0a9d3cbc..bad1a216 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,7 @@ #! /bin/bash +INPUT=$1 + show_question() { echo -e "\033[1;34m$@\033[0m" } @@ -18,12 +20,22 @@ end() { } continue() { - 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;; + case ${INPUT} in + '-a' ) + : + ;; + '-h' ) + 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 } @@ -35,6 +47,7 @@ replace() { ( [Nn]* ) ;; ( * ) show_error "\tSorry, try again."; replace $@;; esac + } install() { @@ -113,13 +126,25 @@ remove() { } main() { - 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 + case ${INPUT} in + '-a' ) + install + ;; + '-h' ) + echo " -a - Auto-install for all users!" + ;; + * ) + 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