Skip to content

Commit

Permalink
update buildroot url generate code
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
  • Loading branch information
tcler committed Aug 5, 2022
1 parent 7896e48 commit 166ff48
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 30 deletions.
36 changes: 22 additions & 14 deletions conf/default-ks.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,30 @@
verx=$(rpm -E %rhel)
case $verx in
8|9)
[[ "$verx" = 8 ]] && R8=-RHEL-8
[[ "$verx" = 9 ]] && stype=-Beta
read dtype distro <<< $(awk -F/+ '/^baseurl/ {
for (i=3;i<NF;i++) {
if ($(i+1) ~ /RHEL-/) {
d=$(i+1)
if (d ~ /RHEL-[0-9]$/)
d=$(i+2)
print($i, d)
break
}
baserepofile=$(grep BaseOS$ -r /etc/yum.repos.d/ -l)
url=$(awk '/^baseurl/{print $3}' $baserepofile)
echo $url >&2
{ read; read os arch osv ver _; } < <(tac -s ' ' <<<"${url//\// }")
debug_url=${url/\/os/\/debug\/tree}
read dtype distro <<< $(awk -F/+ '{
for (i=3;i<NF;i++) { if ($(i+1) ~ /RHEL-/) {
d=$(i+1)
if (d ~ /RHEL-[0-9]$/) d=$(i+2)
print($i, d); break }
}
}' /etc/yum.repos.d/beaker-BaseOS.repo)
dtype=nightly
}' <<<"$url")
read prefix ver time <<< ${distro//-/ }
buildrootUrl=http://download.devel.redhat.com/rhel-$verx/$dtype/BUILDROOT-$verx$stype/latest-BUILDROOT-$ver$R8/compose/Buildroot/$(arch)/os
[[ "$dtype" =~ rel-eng|nightly ]] || dtype=nightly

downhostname=download.devel.redhat.com
if [[ $verx = 8 ]]; then
buildrootUrl=http://$downhostname/rhel-$verx/$dtype/BUILDROOT-$verx/latest-BUILDROOT-$ver-RHEL-$verx/compose/Buildroot/$(arch)/os
elif [[ $verx = 9 ]]; then
dtype=nightly
buildrootUrl=http://$downhostname/rhel-$verx/$dtype/BUILDROOT-$verx/latest-BUILDROOT-$verx-RHEL-$verx/compose/Buildroot/$(arch)/os
fi

echo $buildrootUrl >&2
cat <<-EOF >/etc/yum.repos.d/beaker-buildroot.repo
[beaker-buildroot]
name=beaker-buildroot
Expand Down
38 changes: 22 additions & 16 deletions utils/enable-buildroot-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,30 @@
verx=$(rpm -E %rhel)
case $verx in
8|9)
[[ "$verx" = 8 ]] && R8=-RHEL-8
[[ "$verx" = 9 ]] && stype=-Beta
read dtype distro <<< $(awk -F/+ '/^baseurl/ {
for (i=3;i<NF;i++) {
if ($(i+1) ~ /RHEL-/) {
d=$(i+1)
if (d ~ /RHEL-[0-9]$/) {
d=$(i+2)
}
print($i, d)
break
}
baserepofile=$(grep BaseOS$ -r /etc/yum.repos.d/ -l)
url=$(awk '/^baseurl/{print $3}' $baserepofile)
echo $url >&2
{ read; read os arch osv ver _; } < <(tac -s ' ' <<<"${url//\// }")
debug_url=${url/\/os/\/debug\/tree}
read dtype distro <<< $(awk -F/+ '{
for (i=3;i<NF;i++) { if ($(i+1) ~ /RHEL-/) {
d=$(i+1)
if (d ~ /RHEL-[0-9]$/) d=$(i+2)
print($i, d); break }
}
}' /etc/yum.repos.d/beaker-BaseOS.repo)

dtype=nightly
}' <<<"$url")
read prefix ver time <<< ${distro//-/ }
buildrootUrl=http://download.devel.redhat.com/rhel-$verx/$dtype/BUILDROOT-$verx$stype/latest-BUILDROOT-$ver$R8/compose/Buildroot/$(arch)/os
[[ "$dtype" =~ rel-eng|nightly ]] || dtype=nightly

downhostname=download.devel.redhat.com
if [[ $verx = 8 ]]; then
buildrootUrl=http://$downhostname/rhel-$verx/$dtype/BUILDROOT-$verx/latest-BUILDROOT-$ver-RHEL-$verx/compose/Buildroot/$(arch)/os
elif [[ $verx = 9 ]]; then
dtype=nightly
buildrootUrl=http://$downhostname/rhel-$verx/$dtype/BUILDROOT-$verx/latest-BUILDROOT-$verx-RHEL-$verx/compose/Buildroot/$(arch)/os
fi

echo $buildrootUrl >&2
cat <<-EOF >/etc/yum.repos.d/beaker-buildroot.repo
[beaker-buildroot]
name=beaker-buildroot
Expand Down

0 comments on commit 166ff48

Please sign in to comment.