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