-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_base_repos.sh
executable file
·45 lines (37 loc) · 1.22 KB
/
generate_base_repos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# URL of the CentOS 7 vault
#base_url="https://vault.centos.org/centos/7/"
base_url="https://vault.centos.org/centos/\$releasever"
# Directory to store generated .repo files
repo_dir="centos7_repos"
# Create the directory if it doesn't exist
mkdir -p "${repo_dir}"
# Fetch repository list
#repo_list=$(curl -s "${base_url}")
# Extract repository URLs from the HTML
#repos=$(echo "${repo_list}" | grep -oP '(?<=href=")[^"]+(?=/?"\>)' | grep '^atomic\|^cloud\|^config\|^cr\|^extras\|^fasttrack\|^highavailability\|^iso\|^os\|^paas\|^rt\|^sclo\|^storage\|^updates\|^virt')
# List of repositories to generate .repo files for
# Others excluded check https://vault.centos.org/centos/7/
repos=(
"atomic"
"centosplus"
"dotnet"
"extras"
"fasttrack"
"os"
"rt"
"updates"
)
# Loop through each repository and generate a .repo file
for repo_name in "${repos[@]}"; do
cat << EOF > "${repo_dir}/${repo_name}.repo"
[${repo_name}]
name=CentOS-\$releasever - ${repo_name}
baseurl=${base_url}/${repo_name}/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=0
EOF
echo "Created centos7_repos/${repo_name}.repo"
done
echo "Generated .repo files for all repositories in ${repo_dir}."