joplin-notes/joplin notion extension/linux/endeavour os/Scripts.md
2026-11-04 00:33:23 +05:30

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.txt Then to install these all sudo pacman -U $(< packages.txt) or sudo pacman -U *.zst

    new 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"