manned/util/centos.sh
EmilySeville7cfg b4926b8d07 Refresh centos:
- remove non POSIX `local` keyword
- fix quoting
- fix indentation
2022-11-24 21:13:31 +10:00

294 lines
6.5 KiB
Bash
Executable file

#!/bin/sh
. ./common.sh
VMIRROR="http://vault.centos.org/"
CMIRROR="http://centos.mirrors.ovh.net/ftp.centos.org/"
# Centos 3.1 - 3.6 (doesn't have useful repo metadata)
centa() {
centa_version="$1"
index rpmdir --sys "centos-$centa_version" --cat os --mirror "$VMIRROR$centa_version/os/i386/RedHat/RPMS/"
index rpmdir --sys "centos-$centa_version" --cat os --mirror "$VMIRROR$centa_version/updates/i386/RPMS/"
index rpmdir --sys "centos-$centa_version" --cat extras --mirror "$VMIRROR$centa_version/extras/i386/RPMS/"
index rpmdir --sys "centos-$centa_version" --cat addons --mirror "$VMIRROR$centa_version/addons/i386/RPMS/"
index rpmdir --sys "centos-$centa_version" --cat contrib --mirror "$VMIRROR$centa_version/contrib/i386/RPMS/"
}
# Centos 3.7+ (same structure, but has more repos and metadata we can use)
centb() {
centb_version="$1"
centb_mirror="${2:-$VMIRROR}"
index rpm --sys "centos-$centb_version" --cat os --mirror "$centb_mirror$centb_version/os/i386/"
index rpm --sys "centos-$centb_version" --cat os --mirror "$centb_mirror$centb_version/updates/i386/"
index rpm --sys "centos-$centb_version" --cat extras --mirror "$centb_mirror$centb_version/extras/i386/"
index rpm --sys "centos-$centb_version" --cat addons --mirror "$centb_mirror$centb_version/addons/i386/" # not present in 6.0+
index rpm --sys "centos-$centb_version" --cat contrib --mirror "$centb_mirror$centb_version/contrib/i386/" # not present in some 5.x releases
index rpm --sys "centos-$centb_version" --cat centosplus --mirror "$centb_mirror$centb_version/centosplus/i386/"
}
# CentOS 7.0+ (different versioning, using x86_64)
centc() {
centc_version="$1"
centc_directory="$2"
centc_mirror="${3:-$VMIRROR}"
index rpm --sys "centos-$centc_version" --cat os --mirror "$centc_mirror$centc_directory/os/x86_64/"
index rpm --sys "centos-$centc_version" --cat os --mirror "$centc_mirror$centc_directory/updates/x86_64/"
index rpm --sys "centos-$centc_version" --cat extras --mirror "$centc_mirror$centc_directory/extras/x86_64/"
index rpm --sys "centos-$centc_version" --cat centosplus --mirror "$centc_mirror$centc_directory/centosplus/x86_64/"
}
# CentOS 8.0+
centd() {
centd_version="$1"
centd_directory=$2
centd_mirror="${3:-$VMIRROR}"
index rpm --sys "centos-$centd_version" --cat BaseOS --mirror "$centd_mirror$centd_directory/BaseOS/x86_64/os/"
index rpm --sys "centos-$centd_version" --cat AppStream --mirror "$centd_mirror$centd_directory/AppStream/x86_64/os/"
index rpm --sys "centos-$centd_version" --cat PowerTools --mirror "$centd_mirror$centd_directory/PowerTools/x86_64/os/"
index rpm --sys "centos-$centd_version" --cat extras --mirror "$centd_mirror$centd_directory/extras/x86_64/os/"
index rpm --sys "centos-$centd_version" --cat centosplus --mirror "$centd_mirror$centd_directory/centosplus/x86_64/os/"
}
case "$1" in
2.1)
index rpmdir --sys centos-2.1 --cat core --mirror "${VMIRROR}2.1/final/i386/CentOS/RPMS/"
;;
3.1)
centa 3.1
;;
3.3)
centa 3.3
;;
3.4)
centa 3.4
;;
3.5)
centa 3.5
;;
3.6)
centa 3.6
;;
3.7)
centb 3.7
;;
3.8)
centb 3.8
;;
3.9)
centb 3.9
;;
4.0)
centb 4.0
;;
4.1)
centb 4.1
;;
4.2)
centb 4.2
;;
4.3)
centb 4.3
;;
4.4)
centb 4.4
;;
4.5)
centb 4.5
;;
4.6)
centb 4.6
;;
4.7)
centb 4.7
;;
4.8)
centb 4.8
;;
4.9)
centb 4.9
;;
5.0)
centb 5.0
;;
5.1)
centb 5.1
;;
5.2)
centb 5.2
;;
5.3)
centb 5.3
;;
5.4)
centb 5.4
;;
5.5)
centb 5.5
;;
5.6)
centb 5.6
;;
5.7)
centb 5.7
;;
5.8)
centb 5.8
;;
5.9)
centb 5.9
;;
5.10)
centb 5.10
;;
5.11)
centb 5.11
;;
6.0)
centb 6.0
;;
6.1)
centb 6.1
;;
6.2)
centb 6.2
;;
6.3)
centb 6.3
;;
6.4)
centb 6.4
;;
6.5)
centb 6.5
;;
6.6)
centb 6.6
;;
6.7)
centb 6.7
;;
6.8)
centb 6.8
;;
6.9)
centb 6.9 "$CMIRROR"
;;
6.10)
centb 6.10 "$CMIRROR"
;;
7.0)
centc 7.0 7.0.1406
;;
7.1)
centc 7.1 7.1.1503
;;
7.2)
centc 7.2 7.2.1511
;;
7.3)
centc 7.3 7.3.1611
;;
7.4)
centc 7.4 7.4.1708
;;
7.5)
centc 7.5 7.5.1804 "$CMIRROR"
;;
7.6)
centc 7.6 7.6.1810 "$CMIRROR"
;;
7.7)
centc 7.7 7.7.1908 "$CMIRROR"
;;
7.8)
centc 7.8 7.8.2003 "$CMIRROR"
;;
7.9)
centc 7.9 7.9.2009 "$CMIRROR"
;;
8.0)
centd 8.0 8.0.1905 "$CMIRROR"
;;
8.1)
centd 8.1 8.1.1911 "$CMIRROR"
;;
8.2)
centd 8.2 8.2.2004 "$CMIRROR"
;;
8.3)
centd 8.3 8.3.2011 "$CMIRROR"
;;
8.4)
centd 8.4 8.4.2105 "$CMIRROR"
;;
8.5)
centd 8.5 8.5.2111 "$CMIRROR"
;;
old)
"$0" 2.1
"$0" 3.1
"$0" 3.3
"$0" 3.4
"$0" 3.5
"$0" 3.6
"$0" 3.7
"$0" 3.8
"$0" 3.9
"$0" 4.0
"$0" 4.1
"$0" 4.2
"$0" 4.3
"$0" 4.4
"$0" 4.5
"$0" 4.6
"$0" 4.7
"$0" 4.8
"$0" 4.9
"$0" 5.0
"$0" 5.1
"$0" 5.2
"$0" 5.3
"$0" 5.4
"$0" 5.5
"$0" 5.6
"$0" 5.7
"$0" 5.8
"$0" 5.9
"$0" 5.10
"$0" 5.11
"$0" 6.0
"$0" 6.1
"$0" 6.2
"$0" 6.3
"$0" 6.4
"$0" 6.5
"$0" 6.6
"$0" 6.7
"$0" 6.8
"$0" 6.9
"$0" 6.10
"$0" 7.0
"$0" 7.1
"$0" 7.2
"$0" 7.3
"$0" 7.4
"$0" 7.5
"$0" 7.6
"$0" 7.7
"$0" 7.8
"$0" 8.0
"$0" 8.1
"$0" 8.2
"$0" 8.3
"$0" 8.4
"$0" 8.5
;;
current)
"$0" 7.9 # till 2024-06-30
;;
all)
"$0" old
"$0" current
;;
esac