From 59c99ff53efc841a0e4580d71c007f107a676157 Mon Sep 17 00:00:00 2001 From: Spekulaas Date: Tue, 27 Sep 2022 13:07:33 +0200 Subject: [PATCH] added must install files (files that get prioritised) --- install.sh | 59 ++++++++++++++++++- .../gcc.sh | 0 .../git.sh | 0 .../golang.sh | 0 .../node.sh | 0 .../openjdk.sh | 0 .../php.sh | 0 7 files changed, 58 insertions(+), 1 deletion(-) rename src/{applications => importantinstalls}/gcc.sh (100%) rename src/{applications => importantinstalls}/git.sh (100%) rename src/{applications => importantinstalls}/golang.sh (100%) rename src/{applications => importantinstalls}/node.sh (100%) rename src/{applications => importantinstalls}/openjdk.sh (100%) rename src/{applications => importantinstalls}/php.sh (100%) diff --git a/install.sh b/install.sh index 3875b06..4166034 100755 --- a/install.sh +++ b/install.sh @@ -50,13 +50,24 @@ zsh_prompt() { get_files() { # Create temp place where files will be stored - cd src/applications + cd src/importantinstalls + > ../temp/importantinstalls.txt > ../temp/installations.txt # File info applications="" counter=0 + + for file in *; do + # Every .sh file in application folder will be noted in installations.txt + if [[ $file == *.sh ]]; then + echo "${file%.*}" >> ../temp/importantinstalls.txt + fi + done + + cd ../applications + # Write every file name into installations for file in *; do # Every .sh file in application folder will be noted in installations.txt @@ -80,6 +91,9 @@ select_files() { printf %s "$YELLOW" # Show all the options echo "The following items will be installed." + echo "-------------Must install-------------" + cat importantinstalls.txt + echo "--------------------------------------" cat installations.txt printf %s "$RESET" @@ -117,6 +131,9 @@ select_files() { printf %s "$YELLOW" echo "The following items will be installed." + echo "-------------Must install-------------" + cat importantinstalls.txt + echo "--------------------------------------" cat installations.txt echo printf %s "$RESET" @@ -132,6 +149,20 @@ select_files() { install_files() { # Check if debug is activated if $debug; then + + # Download important files + while read line; do + + #Reading each line and execute file + if ! [ -x "$(command -v $line)" ]; then + sh ../importantinstalls/$line.sh + else + echo "$line is already installed" + fi + + done < "importantinstalls.txt" + + # Download the selected applications while read line; do #Reading each line and execute file @@ -148,6 +179,7 @@ install_files() { start=1 end=100 amount="$(wc -l < installations.txt)" + amount=$(($amount + "$(wc -l < importantinstalls.txt)")) amount=$(($end / $amount)) # set design @@ -155,10 +187,33 @@ install_files() { printf %s "$YELLOW" echo "The following items are going to be installed:" + cat importantinstalls.txt cat installations.txt echo "" printf %s "$RESET" + # download important files + while read line; do + printf %s "$YELLOW" + + ProgressBar ${start} ${end} ${line} + #Reading each line and execute file + if ! [ -x "$(command -v $line)" ]; then + sh ../importantinstalls/$line.sh >> /dev/null 2>&1 + fi + + # update progressbar + reach=$(( $start + $amount )) + for number in $(seq ${start} ${reach}); do + ProgressBar ${number} ${end} ${line} + sleep 0.02 + done + printf %s "$RESET" + start=$reach + + done < "importantinstalls.txt" + + # download selected applications while read line; do printf %s "$YELLOW" @@ -182,7 +237,9 @@ install_files() { # Completing if [[ $start != 100 ]]; then for number in $(seq ${start} 100); do + printf %s "$YELLOW" ProgressBar ${number} ${end} "..." + printf %s "$RESET" sleep 0.02 done fi diff --git a/src/applications/gcc.sh b/src/importantinstalls/gcc.sh similarity index 100% rename from src/applications/gcc.sh rename to src/importantinstalls/gcc.sh diff --git a/src/applications/git.sh b/src/importantinstalls/git.sh similarity index 100% rename from src/applications/git.sh rename to src/importantinstalls/git.sh diff --git a/src/applications/golang.sh b/src/importantinstalls/golang.sh similarity index 100% rename from src/applications/golang.sh rename to src/importantinstalls/golang.sh diff --git a/src/applications/node.sh b/src/importantinstalls/node.sh similarity index 100% rename from src/applications/node.sh rename to src/importantinstalls/node.sh diff --git a/src/applications/openjdk.sh b/src/importantinstalls/openjdk.sh similarity index 100% rename from src/applications/openjdk.sh rename to src/importantinstalls/openjdk.sh diff --git a/src/applications/php.sh b/src/importantinstalls/php.sh similarity index 100% rename from src/applications/php.sh rename to src/importantinstalls/php.sh