Compare commits

..

2 Commits

Author SHA1 Message Date
d7c5624bd6 loadbar update 2022-09-27 13:07:48 +02:00
59c99ff53e added must install files (files that get prioritised) 2022-09-27 13:07:33 +02:00
8 changed files with 59 additions and 2 deletions

View File

@ -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

View File

@ -11,6 +11,6 @@ ProgressBar() {
# program=$(printf "${_program}")
printf "\rProgress : |${fill// /▇}${empty// / }| ${_progress}%%"
printf " Installing ${program} \r"
printf " Installing ${program} \r"
}