diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index dbb40a5..657fe0a 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -972,6 +972,191 @@ spcd_f_pkg_git() { # │ f │ pm = package manager │ # ╰───┴──────────────────────╯ +# ╭───┬────┬──────────────────╮ +# │ f │ pm │ conf = configure │ +# ╰───┴────┴──────────────────╯ + +spcd_step__packages_set_repositories() { + spcd_step "Set repositories" + local file + case "${SPCD_OS_ID}" in + "${SPCD_OS_ALMA}") + case "${SPCD_OS_VERSION}" in + "9") + set -- \ + "-appstream" \ + "-baseos" \ + "-crb" \ + "-extras" \ + "-highavailability" \ + "-nfv" \ + "-plus" \ + "-resilientstorage" \ + "-rt" \ + "-sap" \ + "-saphana" + ;; + "8") + set -- \ + "-ha" \ + "-nfv" \ + "-plus" \ + "-powertools" \ + "-resilientstorage" \ + "-rt" \ + "-sap" \ + "-saphana" \ + "" + ;; + *) ;; + esac + for file in "${@}"; do + spcd_os_sed "/etc/yum.repos.d/almalinux${file}.repo" \ + "|^mirrorlist|#mirrorlist|" \ + "|https://repo.almalinux.org|${SPCD_URL_ALMA}|" \ + "|^# baseurl|baseurl|" + done + ;; + "${SPCD_OS_ALPINE}") + spcd_os_write "/etc/apk/repositories" "\ +${SPCD_URL_ALPINE}/v${SPCD_OS_VERSION}/main +${SPCD_URL_ALPINE}/v${SPCD_OS_VERSION}/community +" + ;; + "${SPCD_OS_ARCH}") + spcd_os_write "/etc/pacman.d/mirrorlist" "\ +Server = ${SPCD_URL_ARCH}/\$repo/os/\$arch +" + ;; + "${SPCD_OS_DEBIAN}") + spcd_os_write "/etc/apt/sources.list" "\ +deb ${SPCD_URL_DEBIAN} ${SPCD_OS_VERSION} main +deb ${SPCD_URL_DEBIAN} ${SPCD_OS_VERSION}-backports main +deb ${SPCD_URL_DEBIAN} ${SPCD_OS_VERSION}-updates main +deb ${SPCD_URL_DEBIAN}-security ${SPCD_OS_VERSION}-security main +" + ;; + "${SPCD_OS_FEDORA}") + set -- \ + "-updates-testing" \ + "-updates" \ + "" + for file in "${@}"; do + spcd_os_sed "/etc/yum.repos.d/fedora${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|" + ;; + "${SPCD_OS_OPENSUSE}") + 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" + for file in "${@}"; do + spcd_os_sed "/etc/zypp/repos.d/repo-${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-addons" \ + "rocky-devel" \ + "rocky-extras" \ + "rocky" + ;; + "8") + # not Rocky-Media + set -- \ + "Rocky-AppStream" \ + "Rocky-BaseOS" \ + "Rocky-Debuginfo" \ + "Rocky-Devel" \ + "Rocky-Extras" \ + "Rocky-HighAvailability" \ + "Rocky-NFV" \ + "Rocky-Plus" \ + "Rocky-PowerTools" \ + "Rocky-RT" \ + "Rocky-ResilientStorage" \ + "Rocky-Sources" + ;; + *) ;; + esac + for file in "${@}"; do + spcd_os_sed "/etc/yum.repos.d/${file}.repo" \ + "|^mirrorlist|#mirrorlist|" \ + "|http://dl.rockylinux.org|${SPCD_URL_ROCKY}|" \ + "|^#baseurl|baseurl|" + done + ;; + "${SPCD_OS_UBUNTU}") + spcd_os_write "/etc/apt/sources.list" "\ +deb ${SPCD_URL_UBUNTU} ${SPCD_OS_VERSION} main universe +deb ${SPCD_URL_UBUNTU} ${SPCD_OS_VERSION}-backports main universe +deb ${SPCD_URL_UBUNTU} ${SPCD_OS_VERSION}-updates main universe +deb ${SPCD_URL_UBUNTU} ${SPCD_OS_VERSION}-security main universe +" + ;; + *) ;; + esac +} + +spcd_step__packages_set_configuration() { + spcd_step "Set configuration" + case "${SPCD_PM}" in + "${SPCD_PM_DNF}") + spcd_os_write "/etc/dnf/dnf.conf" "\ +[main] +best=True +clean_requirements_on_remove=True +gpgcheck=1 +installonly_limit=3 +skip_if_unavailable=False +" + ;; + "${SPCD_PM_APK}") ;; + "${SPCD_PM_PACMAN}") ;; + "${SPCD_PM_APT}") + spcd_os_write "/etc/apt/apt.conf.d/apt.conf" "\ +Acquire::Check-Valid-Until True; +APT::Get::Show-Versions True; +APT::Install-Recommends False; +APT::Install-Suggests False; +Dir::Etc::SourceParts \"\"; +" + ;; + "${SPCD_PM_ZYPPER}") ;; + *) ;; + esac + case "${SPCD_OS_ID}" in + "${SPCD_OS_ARCH}") + spcd_run pacman-key --init + ;; + "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") + export DEBIAN_FRONTEND="noninteractive" + spcd_os_printenv DEBIAN_FRONTEND + ;; + *) ;; + esac +} + # ╭───┬────┬───────╮ # │ f │ pm │ https │ # ╰───┴────┴───────╯ @@ -1367,191 +1552,6 @@ ${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET} esac } -# ╭──────┬──────────╮ -# │ step │ packages │ -# ╰──────┴──────────╯ - -spcd_step__packages_set_repositories() { - spcd_step "Set repositories" - local file - case "${SPCD_OS_ID}" in - "${SPCD_OS_ALMA}") - case "${SPCD_OS_VERSION}" in - "9") - set -- \ - "-appstream" \ - "-baseos" \ - "-crb" \ - "-extras" \ - "-highavailability" \ - "-nfv" \ - "-plus" \ - "-resilientstorage" \ - "-rt" \ - "-sap" \ - "-saphana" - ;; - "8") - set -- \ - "-ha" \ - "-nfv" \ - "-plus" \ - "-powertools" \ - "-resilientstorage" \ - "-rt" \ - "-sap" \ - "-saphana" \ - "" - ;; - *) ;; - esac - for file in "${@}"; do - spcd_os_sed "/etc/yum.repos.d/almalinux${file}.repo" \ - "|^mirrorlist|#mirrorlist|" \ - "|https://repo.almalinux.org|${SPCD_URL_ALMA}|" \ - "|^# baseurl|baseurl|" - done - ;; - "${SPCD_OS_ALPINE}") - spcd_os_write "/etc/apk/repositories" "\ -${SPCD_URL_ALPINE}/v${SPCD_OS_VERSION}/main -${SPCD_URL_ALPINE}/v${SPCD_OS_VERSION}/community -" - ;; - "${SPCD_OS_ARCH}") - spcd_os_write "/etc/pacman.d/mirrorlist" "\ -Server = ${SPCD_URL_ARCH}/\$repo/os/\$arch -" - ;; - "${SPCD_OS_DEBIAN}") - spcd_os_write "/etc/apt/sources.list" "\ -deb ${SPCD_URL_DEBIAN} ${SPCD_OS_VERSION} main -deb ${SPCD_URL_DEBIAN} ${SPCD_OS_VERSION}-backports main -deb ${SPCD_URL_DEBIAN} ${SPCD_OS_VERSION}-updates main -deb ${SPCD_URL_DEBIAN}-security ${SPCD_OS_VERSION}-security main -" - ;; - "${SPCD_OS_FEDORA}") - set -- \ - "-updates-testing" \ - "-updates" \ - "" - for file in "${@}"; do - spcd_os_sed "/etc/yum.repos.d/fedora${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|" - ;; - "${SPCD_OS_OPENSUSE}") - 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" - for file in "${@}"; do - spcd_os_sed "/etc/zypp/repos.d/repo-${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-addons" \ - "rocky-devel" \ - "rocky-extras" \ - "rocky" - ;; - "8") - # not Rocky-Media - set -- \ - "Rocky-AppStream" \ - "Rocky-BaseOS" \ - "Rocky-Debuginfo" \ - "Rocky-Devel" \ - "Rocky-Extras" \ - "Rocky-HighAvailability" \ - "Rocky-NFV" \ - "Rocky-Plus" \ - "Rocky-PowerTools" \ - "Rocky-RT" \ - "Rocky-ResilientStorage" \ - "Rocky-Sources" - ;; - *) ;; - esac - for file in "${@}"; do - spcd_os_sed "/etc/yum.repos.d/${file}.repo" \ - "|^mirrorlist|#mirrorlist|" \ - "|http://dl.rockylinux.org|${SPCD_URL_ROCKY}|" \ - "|^#baseurl|baseurl|" - done - ;; - "${SPCD_OS_UBUNTU}") - spcd_os_write "/etc/apt/sources.list" "\ -deb ${SPCD_URL_UBUNTU} ${SPCD_OS_VERSION} main universe -deb ${SPCD_URL_UBUNTU} ${SPCD_OS_VERSION}-backports main universe -deb ${SPCD_URL_UBUNTU} ${SPCD_OS_VERSION}-updates main universe -deb ${SPCD_URL_UBUNTU} ${SPCD_OS_VERSION}-security main universe -" - ;; - *) ;; - esac -} - -spcd_step__packages_set_configuration() { - spcd_step "Set configuration" - case "${SPCD_PM}" in - "${SPCD_PM_DNF}") - spcd_os_write "/etc/dnf/dnf.conf" "\ -[main] -best=True -clean_requirements_on_remove=True -gpgcheck=1 -installonly_limit=3 -skip_if_unavailable=False -" - ;; - "${SPCD_PM_APK}") ;; - "${SPCD_PM_PACMAN}") ;; - "${SPCD_PM_APT}") - spcd_os_write "/etc/apt/apt.conf.d/apt.conf" "\ -Acquire::Check-Valid-Until True; -APT::Get::Show-Versions True; -APT::Install-Recommends False; -APT::Install-Suggests False; -Dir::Etc::SourceParts \"\"; -" - ;; - "${SPCD_PM_ZYPPER}") ;; - *) ;; - esac - case "${SPCD_OS_ID}" in - "${SPCD_OS_ARCH}") - spcd_run pacman-key --init - ;; - "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") - export DEBIAN_FRONTEND="noninteractive" - spcd_os_printenv DEBIAN_FRONTEND - ;; - *) ;; - esac -} - # ╭──────╮ # │ main │ # ╰──────╯