From 14fdb67d862c8eca7e09eefed247270b6e954b8c Mon Sep 17 00:00:00 2001 From: "LevitatingBusinessMan (Rein Fernhout)" Date: Tue, 26 Nov 2024 13:57:15 +0100 Subject: [PATCH 1/2] brl-fetch: add opensuse tumbleweed --- .../share/brl-fetch/distros/.opensuse | 117 ------------------ .../share/brl-fetch/distros/opensuse | 110 ++++++++++++++++ 2 files changed, 110 insertions(+), 117 deletions(-) delete mode 100644 src/slash-bedrock/share/brl-fetch/distros/.opensuse create mode 100644 src/slash-bedrock/share/brl-fetch/distros/opensuse diff --git a/src/slash-bedrock/share/brl-fetch/distros/.opensuse b/src/slash-bedrock/share/brl-fetch/distros/.opensuse deleted file mode 100644 index e8fa5f69..00000000 --- a/src/slash-bedrock/share/brl-fetch/distros/.opensuse +++ /dev/null @@ -1,117 +0,0 @@ -#!/bedrock/libexec/busybox sh -# -# openSUSE bootstrap support -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# -# Copyright (c) 2016-2019 Daniel Thau -# - -# -# Some package has a dependency on "this-is-only-for-build-envs" but a -# corresponding provider does not appear in the repository. Given this, the -# fetch fails. Thus, this is disabled. -# - -. /bedrock/share/common-code -trap 'fetch_abort "Unexpected error occurred."' EXIT - -check_supported() { - false -} - -speed_test_url() { - echo "distribution/leap/${target_release:-}/repo/oss/suse/repodata/appdata-screenshots.tar" -} - -list_mirrors() { - # from https://mirrors.opensuse.org/ - # - # The master download server, download.opensuse.org, automatically redirects you to a server near you - # - echo "https://download.opensuse.org" -} - -# Could not find adequate evidence of support for non-x86_64 architectures. For example, the repo here: -# -# https://download.opensuse.org/distribution/leap/15.1/repo/oss/ -# -# only lists the x86_64 architecture. -brl_arch_to_distro() { - case "${1}" in - "x86_64") echo "x86_64" ;; - *) abort "brl does not know how to translate arch \"${1}\" to ${distro:-} format" ;; - esac -} - -list_architectures() { - echo "x86_64" -} - -# -# OpenSUSE 14 was named 42. However, the following version went back 15. For -# sorting purposes, place 42 where 14 would normally go. -# - -default_release() { - list_releases | - sed 's/^42\>/14/' | - sort -n | - sed 's/^14\>/42/' | - tail -n1 -} - -list_releases() { - wget -O- 'https://download.opensuse.org/distribution/leap/' 2>/dev/null | - awk '/folder/,/<\/table>/' | - list_links | - grep '^[0-9][0-9.]*/$' | - sed 's,/$,,' | - sed 's/^42\>/14/' | - sort -n | - sed 's/^14\>/42/' | - uniq -} - -fetch() { - step "Downloading package information database" - url="$(find_link "${target_mirror:-}/distribution/leap/${target_release:-}/repo/oss/repodata/" "primary.xml.gz")" - wget -O "${bootstrap_dir:-}/primary.xml.gz" "${url}" - - step "Converting distro package information database to brl format" - gunzip "${bootstrap_dir:-}/primary.xml.gz" - rpmdb_to_brldb "${bootstrap_dir:-}/primary.xml" "${bootstrap_dir:-}/brldb" - - step "Calculating required bootstrap packages" - brldb_calculate_paths_with_deps "${bootstrap_dir:-}/brldb" "${bootstrap_dir:-}/package_paths" "zypper rpm openSUSE-release filesystem ca-certificates ca-certificates-cacert" - - step "Downloading bootstrap packages" - download_files "${bootstrap_dir:-}" "$(awk -v"m=${target_mirror:-}/distribution/leap/${target_release:-}/repo/oss/" '{print m"/"$0}' "${bootstrap_dir:-}/package_paths")" - - step "Extracting bootstrap packages" - # This round is just to bootstrap the distro's rpm. - # Next step we'll use the distro's rpm to install everything properly. - # Need to extract filesystem first to ensure symlinks are set up - extract_rpms "${bootstrap_dir:-}" "${bootstrap_dir:-}"/filesystem*.rpm "${bootstrap_dir:-}"/*.rpm - - step "Installing bootstrap packages" - setup_chroot "${bootstrap_dir:-}" - LC_ALL=C chroot "${bootstrap_dir:-}" rpm -i ./*.rpm - - step "Running bootstrap software" - chroot "${bootstrap_dir:-}" rpm -i --root=/target-root --nodeps openSUSE-release-*.rpm - chroot "${bootstrap_dir:-}" zypper --non-interactive --root=/target-root ar -f "http://download.opensuse.org/distribution/leap/${target_release:-}/repo/oss/" repo-oss - chroot "${bootstrap_dir:-}" zypper --non-interactive --root=/target-root ar -f "http://download.opensuse.org/update/leap/${target_release:-}/oss/" update-oss - chroot "${bootstrap_dir:-}" zypper --non-interactive --gpg-auto-import-keys --root=/target-root refresh - chroot "${bootstrap_dir:-}" zypper --non-interactive --gpg-auto-import-keys --root=/target-root install -f zypper rpm openSUSE-release filesystem ca-certificates ca-certificates-cacert - - step "Configuring" - # Some pre/post install hooks do not seem to take from the bootstrap environment. Need to be installed in the environment proper. - setup_chroot "${target_dir:-}" - chroot "${target_dir:-}" zypper --non-interactive ar -f "http://download.opensuse.org/distribution/leap/${target_release:-}/repo/oss/" repo-oss || true - chroot "${target_dir:-}" zypper --non-interactive ar -f "http://download.opensuse.org/update/leap/${target_release:-}/oss/" update-oss || true - chroot "${target_dir:-}" zypper --non-interactive --gpg-auto-import-keys refresh - chroot "${target_dir:-}" zypper --non-interactive --gpg-auto-import-keys install -f zypper rpm openSUSE-release filesystem ca-certificates ca-certificates-cacert -} diff --git a/src/slash-bedrock/share/brl-fetch/distros/opensuse b/src/slash-bedrock/share/brl-fetch/distros/opensuse new file mode 100644 index 00000000..7572d17f --- /dev/null +++ b/src/slash-bedrock/share/brl-fetch/distros/opensuse @@ -0,0 +1,110 @@ +#!/bedrock/libexec/busybox sh +# +# OpenSUSE bootstrap support +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 as published by the Free Software Foundation. +# +# Copyright (c) 2016-2021 Rein Fernhout (LevitatingBusinessMan) +# + +# shellcheck source=src/slash-bedrock/libexec/brl-fetch +. /bedrock/share/common-code +trap 'fetch_abort "Unexpected error occurred."' EXIT + +check_supported() { + true +} + +speed_test_url() { + echo "/tumbleweed/repo/oss/INDEX.gz" +} + +list_mirrors() { + # https://en.opensuse.org/openSUSE:Mirrors + # downloads from the master download server are redirect to the fastest mirror + echo "https://download.opensuse.org" +} + +brl_arch_to_distro() { + case "${1}" in + "x86_64") echo "x86_64" ;; + *) abort "brl does not know how to translate arch \"${1}\" to ${distro} format" ;; + esac +} + +list_architectures() { + # other architectures do exist and can be found at + # https://download.opensuse.org/ports/ + cat </\1/p' "${bootstrap_dir}/repomd.xml") + primary_url="${repo}/${primary_location}" + download "${primary_url}" "${bootstrap_dir}/primary.xml.zst" + + step "Extracting package information database" + zstd -d "${bootstrap_dir}/primary.xml.zst" + + step "Converting distro package information database to brl format" + rpmdb_to_brldb "${bootstrap_dir}/primary.xml" "${bootstrap_dir}/brldb" + + step "Removing blacklisted packages from brldb" + # brldb_calculate_required_packages find the first provider for a dependency. + # With openSUSE some packages should not be installed. + # For instance these packages require "this-is-only-for-build-envs" which has no provider. + # Here we remove these packages from brldb so that brldb_calculate_required_packages does not try to use them. + find "${bootstrap_dir}/brldb" -type f -exec sed -i -e '/bash-legacybin/d' -e '/libudev-mini1/d' -e '/glib2-stage1-devel/d' {} + + + step "Calculating required bootstrap packages" + # rpm is linked to libz.so.1 + # this isn't always installed for some reason + bootstrap_deps="rpm filesystem zypper zlib" + brldb_calculate_required_packages "${bootstrap_dir}/brldb" "${bootstrap_dir}/required_packages" "${bootstrap_deps}" + + step "Downloading bootstrap packages" + checksum_downloads "${cache}/packages/" "$(awk -v"m=${repo}" '{print m"/"$0}' "${bootstrap_dir}/required_packages")" + + step "Extracting bootstrap packages" + # This round is just to bootstrap the distro's rpm. + # In the next step we'll use the distro's rpm to install everything properly. + # We extract the filesystem first to ensure the directories are set up. + bootstrap_packages="$(awk -v"d=${cache}/packages/" '{sub(/^.*\//,d);print $1}' "${bootstrap_dir}/required_packages")" + # shellcheck disable=SC2086 + extract_rpms "${bootstrap_dir}" "${cache}/packages"/filesystem*.rpm "${cache}/packages"/*.rpm + + step "Installing bootstrap packages" + setup_chroot "${bootstrap_dir}" + share_cache "packages" "${bootstrap_dir}/packages" + bootstrap_packages="$(awk -v"d=/packages/" '{sub(/^.*\//,d);print $1}' "${bootstrap_dir}/required_packages")" + LC_ALL=C chroot "${bootstrap_dir}" rpm --noverify -i ${bootstrap_packages} + + step "Running bootstrap software" + chroot "${bootstrap_dir:-}" zypper -nR /target-root ar http://download.opensuse.org/tumbleweed/repo/oss/ repo-oss + chroot "${bootstrap_dir:-}" zypper -nR /target-root ar http://download.opensuse.org/update/tumbleweed/ repo-update + chroot "${bootstrap_dir:-}" zypper -nR /target-root --gpg-auto-import-keys ref + chroot "${bootstrap_dir:-}" zypper -nR /target-root install filesystem openSUSE-release + chroot "${bootstrap_dir:-}" zypper -nR /target-root install -t pattern base +} From e3ab456e715cf217e816bd99a2cc0fab323b4472 Mon Sep 17 00:00:00 2001 From: "LevitatingBusinessMan (Rein Fernhout)" Date: Tue, 26 Nov 2024 15:56:56 +0100 Subject: [PATCH 2/2] add more repos for opensuse --- src/slash-bedrock/share/brl-fetch/distros/opensuse | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/slash-bedrock/share/brl-fetch/distros/opensuse b/src/slash-bedrock/share/brl-fetch/distros/opensuse index 7572d17f..4bf07941 100644 --- a/src/slash-bedrock/share/brl-fetch/distros/opensuse +++ b/src/slash-bedrock/share/brl-fetch/distros/opensuse @@ -102,8 +102,12 @@ fetch() { LC_ALL=C chroot "${bootstrap_dir}" rpm --noverify -i ${bootstrap_packages} step "Running bootstrap software" - chroot "${bootstrap_dir:-}" zypper -nR /target-root ar http://download.opensuse.org/tumbleweed/repo/oss/ repo-oss - chroot "${bootstrap_dir:-}" zypper -nR /target-root ar http://download.opensuse.org/update/tumbleweed/ repo-update + chroot "${bootstrap_dir:-}" zypper -nR /target-root ar -d -n openSUSE-Tumbleweed-Debug http://download.opensuse.org/debug/tumbleweed/repo/oss/ repo-debug + chroot "${bootstrap_dir:-}" zypper -nR /target-root ar -f -n openSUSE-Tumbleweed-Non-Oss http://download.opensuse.org/tumbleweed/repo/non-oss/ repo-non-oss + chroot "${bootstrap_dir:-}" zypper -nR /target-root ar -f -n "Open H.264 Codec (openSUSE Tumbleweed)" http://codecs.opensuse.org/openh264/openSUSE_Tumbleweed repo-openh264 + chroot "${bootstrap_dir:-}" zypper -nR /target-root ar -f -n openSUSE-Tumbleweed-Oss http://download.opensuse.org/tumbleweed/repo/oss/ repo-oss + chroot "${bootstrap_dir:-}" zypper -nR /target-root ar -d -n openSUSE-Tumbleweed-Source http://download.opensuse.org/source/tumbleweed/repo/oss/ repo-source + chroot "${bootstrap_dir:-}" zypper -nR /target-root ar -f -n openSUSE-Tumbleweed-Update http://download.opensuse.org/update/tumbleweed/ repo-update chroot "${bootstrap_dir:-}" zypper -nR /target-root --gpg-auto-import-keys ref chroot "${bootstrap_dir:-}" zypper -nR /target-root install filesystem openSUSE-release chroot "${bootstrap_dir:-}" zypper -nR /target-root install -t pattern base