initial
This commit is contained in:
commit
74ae93a96e
1 changed files with 94691 additions and 0 deletions
76
joplin notion extension/linux/endeavour os/Scripts.md
Normal file
76
joplin notion extension/linux/endeavour os/Scripts.md
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
Scripts
|
||||
|
||||
- for downloading packages from arch archive
|
||||
```sh
|
||||
#!/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
|
||||
```sh
|
||||
#!/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"
|
||||
```
|
||||
Loading…
Reference in a new issue