Compare commits

..

No commits in common. "ab4de9b5367a821180064291db356f4a723483b5" and "86d07730bc2e5e7652937b130b8d94e12943dec3" have entirely different histories.

View file

@ -199,7 +199,7 @@ _spcd_step_wipe() {
_SPCD_TXT_CHARSET="UTF-8" _SPCD_TXT_CHARSET="UTF-8"
_SPCD_TXT_LOCALE_DEFAULT="C" _SPCD_TXT_LOCALE_DEFAULT="C"
_spcd_txt() { _spcd_txt_pick() {
case "${SPCD_TXT_LOCALE}" in case "${SPCD_TXT_LOCALE}" in
"${SPCD_TXT_LOCALE_ENGLISH}") echo "${1}" ;; "${SPCD_TXT_LOCALE_ENGLISH}") echo "${1}" ;;
"${SPCD_TXT_LOCALE_FRENCH}") echo "${2}" ;; "${SPCD_TXT_LOCALE_FRENCH}") echo "${2}" ;;
@ -342,9 +342,9 @@ spcd_step_out() {
SPCD_TXT_LOCALE_ENGLISH="en_US" SPCD_TXT_LOCALE_ENGLISH="en_US"
SPCD_TXT_LOCALE_FRENCH="fr_FR" SPCD_TXT_LOCALE_FRENCH="fr_FR"
spcd_txt() { spcd_txt_get() {
case "${1}" in case "${1}" in
"set") _spcd_txt "Set" "Définir" ;; "set") _spcd_txt_pick "Set" "Définir" ;;
*) ;; *) ;;
esac esac
} }
@ -376,8 +376,39 @@ SPCD_PM_ZYPPER="zypper"
# │ e │ functions │ # │ e │ functions │
# ╰───┴───────────╯ # ╰───┴───────────╯
spcd_e_default() { spcd_step__environment_print() {
spcd_step "$(spcd_txt "set")" spcd_f_ca "list"
spcd_f_dns "list"
set -- \
"GIT_RWX" \
"GIT_SPCD" \
"GIT_SHUNIT" \
"REF_FEATURE" \
"REF_RELEASE" \
"REF_STAGING" \
"TXT_LOCALE" \
"URL_ALMA" \
"URL_ALPINE" \
"URL_ARCH" \
"URL_DEBIAN" \
"URL_EPEL" \
"URL_FEDORA" \
"URL_OPENSUSE" \
"URL_PYTHON" \
"URL_ROCKY" \
"URL_UBUNTU"
local item name value
for item in "${@}"; do
name="SPCD_${item}"
eval "value=\"\${${name}}\""
if [ -n "${value}" ]; then
spcd_os_printenv "${name}"
fi
done
}
spcd_step__environment_defaults_set() {
spcd_step "$(spcd_txt_get "set")"
[ -n "${SPCD_DNS_1}" ] || SPCD_DNS_1="9.9.9.9" [ -n "${SPCD_DNS_1}" ] || SPCD_DNS_1="9.9.9.9"
@ -405,7 +436,6 @@ spcd_e_default() {
# /$repo/os/$arch # /$repo/os/$arch
SPCD_URL_ARCH="https://geo.mirror.pkgbuild.com" SPCD_URL_ARCH="https://geo.mirror.pkgbuild.com"
[ -n "${SPCD_URL_DEBIAN}" ] || [ -n "${SPCD_URL_DEBIAN}" ] ||
# /dists/…
SPCD_URL_DEBIAN="https://deb.debian.org/debian" SPCD_URL_DEBIAN="https://deb.debian.org/debian"
[ -n "${SPCD_URL_EPEL}" ] || [ -n "${SPCD_URL_EPEL}" ] ||
# /$releasever/Everything/… # /$releasever/Everything/…
@ -429,11 +459,10 @@ spcd_e_default() {
# /$contentdir/$releasever/… # /$contentdir/$releasever/…
SPCD_URL_ROCKY="https://dl.rockylinux.org" SPCD_URL_ROCKY="https://dl.rockylinux.org"
[ -n "${SPCD_URL_UBUNTU}" ] || [ -n "${SPCD_URL_UBUNTU}" ] ||
# /dists/…
SPCD_URL_UBUNTU="https://ubuntu.mirrors.ovh.net/ubuntu" SPCD_URL_UBUNTU="https://ubuntu.mirrors.ovh.net/ubuntu"
} }
spcd_e_set() { spcd_step__environment_set_variables() {
spcd_step "Set variables" spcd_step "Set variables"
# check script first # check script first
[ -n "${SPCD}" ] || spcd_error_ci "SPCD" [ -n "${SPCD}" ] || spcd_error_ci "SPCD"
@ -896,37 +925,6 @@ spcd_f_ca_update() {
# │ f │ env = environment │ # │ f │ env = environment │
# ╰───┴───────────────────╯ # ╰───┴───────────────────╯
spcd_f_env_list() {
spcd_f_ca "list"
spcd_f_dns "list"
set -- \
"GIT_RWX" \
"GIT_SPCD" \
"GIT_SHUNIT" \
"REF_FEATURE" \
"REF_RELEASE" \
"REF_STAGING" \
"TXT_LOCALE" \
"URL_ALMA" \
"URL_ALPINE" \
"URL_ARCH" \
"URL_DEBIAN" \
"URL_EPEL" \
"URL_FEDORA" \
"URL_OPENSUSE" \
"URL_PYTHON" \
"URL_ROCKY" \
"URL_UBUNTU"
local item name value
for item in "${@}"; do
name="SPCD_${item}"
eval "value=\"\${${name}}\""
if [ -n "${value}" ]; then
spcd_os_printenv "${name}"
fi
done
}
spcd_f_env_workspace() { spcd_f_env_workspace() {
spcd_os_ls "$(realpath .)" spcd_os_ls "$(realpath .)"
} }
@ -974,191 +972,6 @@ spcd_f_pkg_git() {
# │ f │ pm = package manager │ # │ f │ pm = package manager │
# ╰───┴──────────────────────╯ # ╰───┴──────────────────────╯
# ╭───┬────┬──────────────────╮
# │ f │ pm │ conf = configure │
# ╰───┴────┴──────────────────╯
spcd_f_pm_conf() {
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
}
spcd_f_pm_conf_repos() {
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
}
# ╭───┬────┬───────╮ # ╭───┬────┬───────╮
# │ f │ pm │ https │ # │ f │ pm │ https │
# ╰───┴────┴───────╯ # ╰───┴────┴───────╯
@ -1554,6 +1367,191 @@ ${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
esac 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 │ # │ main │
# ╰──────╯ # ╰──────╯
@ -1563,12 +1561,12 @@ spcd_main() {
spcd_step_in "Environment" spcd_step_in "Environment"
spcd_step_in "Defaults" spcd_step_in "Defaults"
spcd_step "Print defined" spcd_step "Print defined"
spcd_f_env_list spcd_step__environment_print
spcd_e_default spcd_step__environment_defaults_set
spcd_step "Print effective" spcd_step "Print effective"
spcd_f_env_list spcd_step__environment_print
spcd_step_out spcd_step_out
spcd_e_set spcd_step__environment_set_variables
spcd_step "List workspace" spcd_step "List workspace"
spcd_f_env_workspace spcd_f_env_workspace
spcd_step_out spcd_step_out
@ -1577,8 +1575,8 @@ spcd_main() {
spcd_f_dns "write" spcd_f_dns "write"
# packages # packages
spcd_step_in "Packages" spcd_step_in "Packages"
spcd_f_pm_conf_repos spcd_step__packages_set_repositories
spcd_f_pm_conf spcd_step__packages_set_configuration
spcd_f_pm_https_trust spcd_f_pm_https_trust
spcd_f_pm_pkg_update spcd_f_pm_pkg_update
spcd_f_pm_pkg_install spcd_f_pm_pkg_install