diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 10482e6..ca516b2 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -1,43 +1,5 @@ #! /usr/bin/env sh -# ╭──────────╮ -# │ defaults │ -# ╰──────────╯ - -[ -n "${SPCD_CMD_SUM}" ] || SPCD_CMD_SUM="sha512sum" - -[ -n "${SPCD_DNS_1}" ] || SPCD_DNS_1="9.9.9.9" - -[ -n "${SPCD_GIT_MAIN}" ] || SPCD_GIT_MAIN="spcd" -[ -n "${SPCD_GIT_ROOT}" ] || SPCD_GIT_ROOT="rwx" - -[ -n "${SPCD_GIT_SHUNIT}" ] || SPCD_GIT_SHUNIT="shunit2" - -[ -n "${SPCD_REF_FEATURE}" ] || SPCD_REF_FEATURE="f" -[ -n "${SPCD_REF_RELEASE}" ] || SPCD_REF_RELEASE="main" -[ -n "${SPCD_REF_STAGING}" ] || SPCD_REF_STAGING="dev" - -[ -n "${SPCD_URL_ALMA}" ] || - SPCD_URL_ALMA="https://repo.almalinux.org" -[ -n "${SPCD_URL_ALPINE}" ] || - SPCD_URL_ALPINE="https://dl-cdn.alpinelinux.org/alpine" -[ -n "${SPCD_URL_ARCH}" ] || - SPCD_URL_ARCH="https://geo.mirror.pkgbuild.com/\$repo/os/\$arch" -[ -n "${SPCD_URL_DEBIAN}" ] || - SPCD_URL_DEBIAN="https://deb.debian.org/debian" -[ -n "${SPCD_URL_EPEL}" ] || - SPCD_URL_EPEL="https://dl.fedoraproject.org" -[ -n "${SPCD_URL_FEDORA}" ] || - SPCD_URL_FEDORA="https://rpmfind.net/linux/fedora/linux" -[ -n "${SPCD_URL_OPENSUSE}" ] || - SPCD_URL_OPENSUSE="https://download.opensuse.org" -[ -n "${SPCD_URL_PYTHON}" ] || - SPCD_URL_PYTHON="https://pypi.org/simple" -[ -n "${SPCD_URL_ROCKY}" ] || - SPCD_URL_ROCKY="https://dl.rockylinux.org" -[ -n "${SPCD_URL_UBUNTU}" ] || - SPCD_URL_UBUNTU="https://ubuntu.mirrors.ovh.net/ubuntu" - # ╭───╮ # │ _ │ # ╰───╯ @@ -643,6 +605,57 @@ ${SPCD_PYTHON_VENV}/lib/${SPCD_PYTHON_COMMAND}/site-packages" spcd_os_printenv "SPCD_DL" } +spcd_step__environment_defaults() { + [ -n "${SPCD_CMD_SUM}" ] || SPCD_CMD_SUM="sha512sum" + + [ -n "${SPCD_DNS_1}" ] || SPCD_DNS_1="9.9.9.9" + + [ -n "${SPCD_GIT_MAIN}" ] || SPCD_GIT_MAIN="spcd" + [ -n "${SPCD_GIT_ROOT}" ] || SPCD_GIT_ROOT="rwx" + + [ -n "${SPCD_GIT_SHUNIT}" ] || SPCD_GIT_SHUNIT="shunit2" + + [ -n "${SPCD_REF_FEATURE}" ] || SPCD_REF_FEATURE="f" + [ -n "${SPCD_REF_RELEASE}" ] || SPCD_REF_RELEASE="main" + [ -n "${SPCD_REF_STAGING}" ] || SPCD_REF_STAGING="dev" + + [ -n "${SPCD_URL_ALMA}" ] || + # /almalinux/$releasever/… + # /vault/$releasever/… + SPCD_URL_ALMA="https://repo.almalinux.org" + [ -n "${SPCD_URL_ALPINE}" ] || + # /v?.??/community + # /v?.??/main + SPCD_URL_ALPINE="https://dl-cdn.alpinelinux.org/alpine" + [ -n "${SPCD_URL_ARCH}" ] || + # /$repo/os/$arch + SPCD_URL_ARCH="https://geo.mirror.pkgbuild.com" + [ -n "${SPCD_URL_DEBIAN}" ] || + SPCD_URL_DEBIAN="https://deb.debian.org/debian" + [ -n "${SPCD_URL_EPEL}" ] || + # /$releasever/Everything/… + # /testing/$releasever/Everything/… + SPCD_URL_EPEL="https://dl.fedoraproject.org/pub/epel" + [ -n "${SPCD_URL_FEDORA}" ] || + # /releases/$releasever/Everything/… + # /updates/$releasever/Everything/… + # /updates/testing/$releasever/Everything/… + SPCD_URL_FEDORA="https://rpmfind.net/linux/fedora/linux" + [ -n "${SPCD_URL_OPENSUSE}" ] || + # /debug/… + # /distribution/… + # /source/… + # /update/… + SPCD_URL_OPENSUSE="https://download.opensuse.org" + [ -n "${SPCD_URL_PYTHON}" ] || + SPCD_URL_PYTHON="https://pypi.org/simple" + [ -n "${SPCD_URL_ROCKY}" ] || + # /$contentdir/$releasever/… + SPCD_URL_ROCKY="https://dl.rockylinux.org" + [ -n "${SPCD_URL_UBUNTU}" ] || + SPCD_URL_UBUNTU="https://ubuntu.mirrors.ovh.net/ubuntu" +} + spcd_step__environment_list_workspace() { spcd_step "List workspace" spcd_lwd__path="$(realpath .)" @@ -780,7 +793,6 @@ spcd_step__packages_set_repositories() { ;; "8") set -- \ - "" \ "-ha" \ "-nfv" \ "-plus" \ @@ -788,13 +800,14 @@ spcd_step__packages_set_repositories() { "-resilientstorage" \ "-rt" \ "-sap" \ - "-saphana" + "-saphana" \ + "" ;; *) ;; esac for spcd_spr__file in "${@}"; do spcd_os_sed "/etc/yum.repos.d/almalinux${spcd_spr__file}.repo" \ - "|^mirrorlist|# mirrorlist|" \ + "|^mirrorlist|#mirrorlist|" \ "|https://repo.almalinux.org|${SPCD_URL_ALMA}|" \ "|^# baseurl|baseurl|" done @@ -807,7 +820,7 @@ ${SPCD_URL_ALPINE}/v${SPCD_OS_VERSION}/community ;; "${SPCD_OS_ARCH}") spcd_os_write "/etc/pacman.d/mirrorlist" "\ -Server = ${SPCD_URL_ARCH} +Server = ${SPCD_URL_ARCH}/\$repo/os/\$arch " ;; "${SPCD_OS_DEBIAN}") @@ -819,41 +832,52 @@ deb ${SPCD_URL_DEBIAN}-security ${SPCD_OS_VERSION}-security main " ;; "${SPCD_OS_FEDORA}") - for spcd_spr__file in \ - "fedora" \ - "fedora-updates" \ - "fedora-updates-testing"; do - spcd_os_sed "/etc/yum.repos.d/${spcd_spr__file}.repo" \ - "|^metalink|# metalink|" "\ + set -- \ + "-updates-testing" \ + "-updates" \ + "" + for spcd_spr__file in "${@}"; do + spcd_os_sed "/etc/yum.repos.d/fedora${spcd_spr__file}.repo" \ + "|^metalink|#metalink|" "\ |http://download.example/pub/fedora/linux|${SPCD_URL_FEDORA}|" \ "|^#baseurl|baseurl|" done spcd_os_sed "/etc/yum.repos.d/fedora-cisco-openh264.repo" \ - "|^enabled=1|# enabled=0|" + "|^enabled=1|#enabled=0|" ;; "${SPCD_OS_OPENSUSE}") - for spcd_spr__file in \ + set -- \ + "backports-debug-update" \ "backports-update" \ + "debug-non-oss" \ + "debug-update-non-oss" \ + "debug-update" \ + "debug" \ "non-oss" \ "oss" \ + "sle-debug-update" \ "sle-update" \ + "source" \ "update-non-oss" \ - "update" \ - "openh264"; do + "update" + for spcd_spr__file in "${@}"; do spcd_os_sed "/etc/zypp/repos.d/repo-${spcd_spr__file}.repo" \ "|http://download.opensuse.org|${SPCD_URL_OPENSUSE}|" done + spcd_os_sed "/etc/zypp/repos.d/repo-openh264.repo" \ + "|^enabled=1|#enabled=0|" ;; "${SPCD_OS_ROCKY}") case "${SPCD_OS_VERSION}" in "9") set -- \ - "rocky" \ "rocky-addons" \ "rocky-devel" \ - "rocky-extras" + "rocky-extras" \ + "rocky" ;; "8") + # not Rocky-Media set -- \ "Rocky-AppStream" \ "Rocky-BaseOS" \ @@ -872,7 +896,7 @@ deb ${SPCD_URL_DEBIAN}-security ${SPCD_OS_VERSION}-security main esac for spcd_spr__file in "${@}"; do spcd_os_sed "/etc/yum.repos.d/${spcd_spr__file}.repo" \ - "|^mirrorlist|# mirrorlist|" \ + "|^mirrorlist|#mirrorlist|" \ "|http://dl.rockylinux.org|${SPCD_URL_ROCKY}|" \ "|^#baseurl|baseurl|" done @@ -1129,12 +1153,32 @@ spcd_step__install_packages() { case "${SPCD_OS_ID}" in "${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}") spcd_install_package "epel-release" - [ -n "${SPCD_URL_EPEL}" ] && spcd_ip__epel="${SPCD_URL_EPEL}" || - spcd_ip__epel="https://dl.fedoraproject.org" - spcd_os_sed "/etc/yum.repos.d/epel.repo" \ - "|^metalink|# metalink|" \ - "|https://download.example|${spcd_ip__epel}|" \ - "|^#baseurl|baseurl|" + case "${SPCD_OS_VERSION}" in + "9") + set -- \ + "-testing" \ + "" + ;; + "8") + set -- \ + "-modular" \ + "-testing-modular" \ + "-testing" \ + "" + ;; + *) ;; + esac + for spcd_spr__file in "${@}"; do + spcd_os_sed "/etc/yum.repos.d/epel${spcd_spr__file}.repo" \ + "|^metalink|#metalink|" \ + "|https://download.example/pub/epel|${SPCD_URL_EPEL}|" \ + "|^#baseurl|baseurl|" + done + spcd_spr__file="/etc/yum.repos.d/epel-cisco-openh264.repo" + if [ -f "${spcd_spr__file}" ]; then + spcd_os_sed "${spcd_spr__file}" \ + "|^enabled=1|#enabled=0|" + fi ;; *) ;; esac @@ -1221,6 +1265,7 @@ spcd_main() { # environment spcd_step_in "Environment" spcd_step__environment_set_variables + spcd_step__environment_defaults spcd_step__environment_list_workspace spcd_step_out # dns