1.6 KiB
1.6 KiB
Scripts
-
for downloading packages from arch archive
#!/bin/bash # Check if the input file is provided if [ -z "$1" ]; then echo "Usage: $0 <file_with_package_names>" exit 1 fi # Check if the file exists if [ ! -f "$1" ]; then echo "File '$1' not found!" exit 1 fi # Read the file line by line while IFS= read -r package; do # If the line is not empty if [ -n "$package" ]; then # Construct the URL based on the pattern url="https://archive.archlinux.org/packages/${package:0:1}/$package" # Output the URL echo "Downloading: $url" # Download the package using wget wget "$url" fi done < "$1"(this one is not working) Running it:
bash download_packages.sh packages.txtThen to install these allsudo pacman -U $(< packages.txt)orsudo pacman -U *.zstnew one
#!/bin/bash
# Check if the input file is provided
if [ -z "$1" ]; then
echo "Usage: $0 <file_with_package_names>"
exit 1
fi
# Check if the file exists
if [ ! -f "$1" ]; then
echo "File '$1' not found!"
exit 1
fi
# Read the file line by line
while IFS= read -r package; do
# If the line is not empty
if [ -n "$package" ]; then
# Extract the package name (e.g., "binaryen" from "binaryen-1:120-1-x86_64.pkg.tar.zst")
package_name=$(echo "$package" | cut -d '-' -f 1)
# Construct the URL based on the pattern
url="https://archive.archlinux.org/packages/${package_name:0:1}/$package_name/$package"
# Output the URL
echo "Downloading: $url"
# Download the package using wget
wget "$url"
fi
done < "$1"