added extra arguments to auto install everything
This commit is contained in:
parent
5831098a67
commit
fbb683b4e3
92
install.sh
92
install.sh
@ -16,26 +16,33 @@ create_app_folder() {
|
||||
}
|
||||
|
||||
zsh_prompt() {
|
||||
# selection menu for zsh
|
||||
printf %s "$YELLOW"
|
||||
|
||||
deleteOption=""
|
||||
echo "Do you want Oh-My-ZSH as terminal extension?"
|
||||
echo "To use 'Oh-My-ZSH' enter 'y' to to continue in bash enter 'n'"
|
||||
read deleteOption
|
||||
if [[ $usezsh == "" ]]; then
|
||||
# selection menu for zsh
|
||||
printf %s "$YELLOW"
|
||||
|
||||
# check for valid input
|
||||
while [ ${deleteOption,,} != "y" ] && [ ${deleteOption,,} != "n" ]; do
|
||||
echo "Invalid input. Please press 'y' or 'n'"
|
||||
read deleteOption
|
||||
done
|
||||
zshOption=""
|
||||
echo "Do you want Oh-My-ZSH as terminal extension?"
|
||||
echo "To use 'Oh-My-ZSH' enter 'y' to to continue in bash enter 'n'"
|
||||
read zshOption
|
||||
|
||||
printf %s "$RESET"
|
||||
# check for valid input
|
||||
while [ ${zshOption,,} != "y" ] && [ ${zshOption,,} != "n" ]; do
|
||||
echo "Invalid input. Please press 'y' or 'n'"
|
||||
read zshOption
|
||||
done
|
||||
|
||||
printf %s "$RESET"
|
||||
elif [[ $usezsh == "bash" ]]; then
|
||||
zshOption="n"
|
||||
elif [[ $usezsh == "zsh" ]]; then
|
||||
zshOption="y"
|
||||
fi
|
||||
|
||||
# run option
|
||||
if [[ ${deleteOption,,} = "n" ]]; then
|
||||
if [[ ${zshOption,,} = "n" ]]; then
|
||||
return
|
||||
elif [[ ${deleteOption,,} = "y" ]]; then
|
||||
elif [[ ${zshOption,,} = "y" ]]; then
|
||||
echo "nice choice lets use zsh"
|
||||
fi
|
||||
}
|
||||
@ -61,9 +68,17 @@ get_files() {
|
||||
}
|
||||
|
||||
select_files() {
|
||||
cd ../temp
|
||||
|
||||
if $downloadall; then
|
||||
# remove all numbers from items
|
||||
sed -i 's/[^ ]* //' installations.txt
|
||||
clear
|
||||
return
|
||||
fi
|
||||
|
||||
printf %s "$YELLOW"
|
||||
# Show all the options
|
||||
cd ../temp
|
||||
echo "The following items will be installed."
|
||||
cat installations.txt
|
||||
|
||||
@ -176,23 +191,44 @@ install_files() {
|
||||
}
|
||||
|
||||
check_arguments() {
|
||||
if [[ $1 = "-h" || $1 = "-help" ]]; then
|
||||
print_logo
|
||||
print_help
|
||||
exit 1
|
||||
elif [[ $1 = "-v" || $1 = "-version" ]]; then
|
||||
print_version
|
||||
exit 1
|
||||
fi
|
||||
case $1 in
|
||||
-h|--help) # display help
|
||||
print_logo
|
||||
print_help
|
||||
exit 1
|
||||
;;
|
||||
-v|--version) # display help
|
||||
print_version
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
check_sudo_arguments() {
|
||||
check_arguments $@
|
||||
|
||||
if [[ $1 = "-d" || $1 = "-debug" ]]; then
|
||||
debug=true
|
||||
main
|
||||
fi
|
||||
while getopts ":abdz" option; do
|
||||
case $option in
|
||||
d) # enable debug
|
||||
debug=true
|
||||
;;
|
||||
a) # enable all
|
||||
downloadall=true
|
||||
;;
|
||||
z) # enable zsh
|
||||
usezsh="zsh"
|
||||
;;
|
||||
b) # enable bash
|
||||
usezsh="bash"
|
||||
;;
|
||||
*) # incorrect option
|
||||
echo "Wrong argument given, please use '-h' to see what arguments are available."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
main
|
||||
}
|
||||
|
||||
main() {
|
||||
@ -254,6 +290,8 @@ fi
|
||||
# Safe important variables
|
||||
homedir="$(getent passwd $SUDO_USER | cut -d: -f6)"
|
||||
debug=false
|
||||
downloadall=false
|
||||
usezsh=""
|
||||
|
||||
# run the program
|
||||
if [ $# -eq 0 ]; then
|
||||
|
@ -51,7 +51,10 @@ Usage: Sudo ./install.sh [command oprions]
|
||||
Command options:
|
||||
-h, -help Show a list of all commands
|
||||
-v, -version Show the current version of the application
|
||||
-d, -debug Display all the download information
|
||||
-d Run the install in debug mode
|
||||
-a Download all the files without a command prompt
|
||||
-b Use bash as main terminal
|
||||
-z Use Oh-My-Zsh as main terminal
|
||||
EOF
|
||||
# set color to default
|
||||
printf %s "$RESET"
|
||||
|
Loading…
x
Reference in New Issue
Block a user