Skip to content

Commit

Permalink
[MINOR] Fix issues with locating zst packages and resolve other errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Akash6222 committed Feb 27, 2024
1 parent 89700f0 commit e38f8ef
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 18 deletions.
3 changes: 1 addition & 2 deletions get_pkgbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ get_pkgbuild() {
print_message2 "14) alg-zen-cala-config"
print_message2 "15) studio-cala-config"
print_message2 "16) calamares-3.2.62"
print_message3 "Invalid choice"


if [ "$ans" == "all" ]; then
package_number=$i

Expand Down
39 changes: 34 additions & 5 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ trap perform_cleanup SIGINT
print_message1 "Updated all/few/one packages? "
read -p "Enter choice (all/few/one): " ans

# Check if input is not "all", "few", or "one"
if [[ "$ans" != "all" && "$ans" != "few" && "$ans" != "one" ]]; then
print_message4 "Invalid input. Exiting..."
exit 0
fi

# Choose server repo
print_message1 "Choose which repo you want to clone and push"
print_message2 "1) alg_repo"
Expand All @@ -64,7 +70,7 @@ read -p "Enter the number of your choice: " server_choice


if [ "$ans" == "all" ]; then
for ((i=1; i<=15; i++)); do
for ((i=1; i<=16; i++)); do
print_message1 "Updating package $i"
# package_build $i

Expand Down Expand Up @@ -126,9 +132,27 @@ if [ "$ans" == "all" ]; then

elif [ "$ans" == "few" ]; then

# Prompt the user to enter comma-separated values
echo "Enter comma-separated values:"
read -r input
# Prompt the user for a package name
print_message1 "Enter a directory name to search for: "
print_message2 "1) alg-cinnamon-settings"
print_message2 "2) alg-firefox-settings"
print_message2 "3) alg-gnome-settings"
print_message2 "4) alg-i3-settings"
print_message2 "5) alg-livecd-desktop"
print_message2 "6) alg-mate-settings"
print_message2 "7) alg-office-settings"
print_message2 "8) alg-plasma-settings"
print_message2 "9) alg-xfce-settings"
print_message2 "10) alg-net-cala-config"
print_message2 "11) alg-pure-cala-config"
print_message2 "12) alg-theme-cala-config"
print_message2 "13) alg-wm-cala-config"
print_message2 "14) alg-zen-cala-config"
print_message2 "15) studio-cala-config"
print_message2 "16) calamares-3.2.62"

# Prompt the user to enter comma-separated values and read input
read -rp "Enter comma-separated values: " input

# Split the input into an array
IFS=',' read -r -a values <<< "$input"
Expand Down Expand Up @@ -197,7 +221,8 @@ elif [ "$ans" == "few" ]; then

perform_cleanup

else
elif [ "$ans" == "one" ]; then

# Call the get_pkgbuild function
get_pkgbuild $package_name

Expand Down Expand Up @@ -252,4 +277,8 @@ else
perform_cleanup

#print_message1 "$package_name has been updated successfully."

else
print_message4 "Invalid choice"
perform_cleanup
fi
29 changes: 18 additions & 11 deletions package_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,38 @@ package_build(){
fi



# Set the file names and directory paths
zst_file=""

# Check if the zst file exists with the first naming convention
if ls $package_name-*-$current_year.$current_month-$updatedRel-any.pkg.tar.zst 1> /dev/null 2>&1; then
zst_file=$(ls $package_name-*-$current_year.$current_month-$updatedRel-any.pkg.tar.zst)
if ls "$package_name"-"$current_year.$current_month"-"$updatedRel"-any.pkg.tar.zst 1> /dev/null 2>&1; then
zst_file=$(ls "$package_name"-"$current_year.$current_month"-"$updatedRel"-any.pkg.tar.zst)
fi
# If the first pattern not found, check the second naming convention
if [ -z "$zst_file" ] && ls $package_name-*-$updatedRel-any.pkg.tar.zst 1> /dev/null 2>&1; then
zst_file=$(ls $package_name-*-$updatedRel-any.pkg.tar.zst)

# If the first pattern is not found, check the second naming convention
if [ -z "$zst_file" ] && ls "$package_name"-"$updatedRel"-any.pkg.tar.zst 1> /dev/null 2>&1; then
zst_file=$(ls "$package_name"-"$updatedRel"-any.pkg.tar.zst)
fi

# If both patterns are not found, fallback to the third naming convention
if [ -z "$zst_file" ] && ls $package_name-*-$updatedRel-x86_64.pkg.tar.zst 1> /dev/null 2>&1; then
zst_file=$(ls $package_name-*-$updatedRel-x86_64.pkg.tar.zst)
if [ -z "$zst_file" ] && ls "$package_name"-"$current_year.$current_month"-"$updatedRel"-x86_64.pkg.tar.zst 1> /dev/null 2>&1; then
zst_file=$(ls "$package_name"-"$current_year.$current_month"-"$updatedRel"-x86_64.pkg.tar.zst)
fi


# If still not found, try the fourth naming convention
if [ -z "$zst_file" ] && ls "$package_name"-"$updatedRel"-x86_64.pkg.tar.zst 1> /dev/null 2>&1; then
zst_file=$(ls "$package_name"-"$updatedRel"-x86_64.pkg.tar.zst)
fi

# If zst_file is still empty, no matching zst file found
if [ -z "$zst_file" ]; then
echo "No matching zst file found."
else
echo "Found zst file: $zst_file"
fi


#if [[ ! "$gpg_key_choice" =~ ^[1-${#gpg_keys[@]}]$ ]]; then
# print_message3 "Invalid choice. Aborting."
# perform_cleanup
Expand Down

0 comments on commit e38f8ef

Please sign in to comment.