added must install files (files that get prioritised)

This commit is contained in:
Ryan Bakkes 2022-09-27 13:07:33 +02:00
parent fb948873c6
commit 59c99ff53e
7 changed files with 58 additions and 1 deletions

View File

@ -50,13 +50,24 @@ zsh_prompt() {
get_files() { get_files() {
# Create temp place where files will be stored # Create temp place where files will be stored
cd src/applications cd src/importantinstalls
> ../temp/importantinstalls.txt
> ../temp/installations.txt > ../temp/installations.txt
# File info # File info
applications="" applications=""
counter=0 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 # Write every file name into installations
for file in *; do for file in *; do
# Every .sh file in application folder will be noted in installations.txt # Every .sh file in application folder will be noted in installations.txt
@ -80,6 +91,9 @@ select_files() {
printf %s "$YELLOW" printf %s "$YELLOW"
# Show all the options # Show all the options
echo "The following items will be installed." echo "The following items will be installed."
echo "-------------Must install-------------"
cat importantinstalls.txt
echo "--------------------------------------"
cat installations.txt cat installations.txt
printf %s "$RESET" printf %s "$RESET"
@ -117,6 +131,9 @@ select_files() {
printf %s "$YELLOW" printf %s "$YELLOW"
echo "The following items will be installed." echo "The following items will be installed."
echo "-------------Must install-------------"
cat importantinstalls.txt
echo "--------------------------------------"
cat installations.txt cat installations.txt
echo echo
printf %s "$RESET" printf %s "$RESET"
@ -132,6 +149,20 @@ select_files() {
install_files() { install_files() {
# Check if debug is activated # Check if debug is activated
if $debug; then 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 while read line; do
#Reading each line and execute file #Reading each line and execute file
@ -148,6 +179,7 @@ install_files() {
start=1 start=1
end=100 end=100
amount="$(wc -l < installations.txt)" amount="$(wc -l < installations.txt)"
amount=$(($amount + "$(wc -l < importantinstalls.txt)"))
amount=$(($end / $amount)) amount=$(($end / $amount))
# set design # set design
@ -155,10 +187,33 @@ install_files() {
printf %s "$YELLOW" printf %s "$YELLOW"
echo "The following items are going to be installed:" echo "The following items are going to be installed:"
cat importantinstalls.txt
cat installations.txt cat installations.txt
echo "" echo ""
printf %s "$RESET" 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 while read line; do
printf %s "$YELLOW" printf %s "$YELLOW"
@ -182,7 +237,9 @@ install_files() {
# Completing # Completing
if [[ $start != 100 ]]; then if [[ $start != 100 ]]; then
for number in $(seq ${start} 100); do for number in $(seq ${start} 100); do
printf %s "$YELLOW"
ProgressBar ${number} ${end} "..." ProgressBar ${number} ${end} "..."
printf %s "$RESET"
sleep 0.02 sleep 0.02
done done
fi fi