Compare commits

..

9 commits

Author SHA1 Message Date
ab4de9b536
txt/get,pick
Some checks failed
/ arch (push) Successful in 2m59s
/ alpine (push) Successful in 2m41s
/ fedora (push) Successful in 5m57s
/ debian (push) Failing after 3m57s
/ opensuse (push) Successful in 2m19s
/ ubuntu (push) Successful in 6m9s
/ alma (push) Successful in 6m36s
/ rocky (push) Successful in 7m31s
2024-09-09 02:48:42 +02:00
377dbc977a
dists/debian,ubuntu 2024-09-09 02:44:50 +02:00
8e56f25ade
e/set 2024-09-09 02:42:40 +02:00
94afae0ce3
e/default 2024-09-09 02:41:15 +02:00
24f19e46ef
env/list 2024-09-09 02:37:48 +02:00
f8490994d9
conf/repos 2024-09-09 02:34:22 +02:00
9a302a4d4f
pm/conf 2024-09-09 02:33:20 +02:00
9b8470f7cb
swap 2024-09-09 02:31:55 +02:00
ef83f1a828
mv 2024-09-09 02:31:04 +02:00

View file

@ -199,7 +199,7 @@ _spcd_step_wipe() {
_SPCD_TXT_CHARSET="UTF-8"
_SPCD_TXT_LOCALE_DEFAULT="C"
_spcd_txt_pick() {
_spcd_txt() {
case "${SPCD_TXT_LOCALE}" in
"${SPCD_TXT_LOCALE_ENGLISH}") echo "${1}" ;;
"${SPCD_TXT_LOCALE_FRENCH}") echo "${2}" ;;
@ -342,9 +342,9 @@ spcd_step_out() {
SPCD_TXT_LOCALE_ENGLISH="en_US"
SPCD_TXT_LOCALE_FRENCH="fr_FR"
spcd_txt_get() {
spcd_txt() {
case "${1}" in
"set") _spcd_txt_pick "Set" "Définir" ;;
"set") _spcd_txt "Set" "Définir" ;;
*) ;;
esac
}
@ -376,39 +376,8 @@ SPCD_PM_ZYPPER="zypper"
# │ e │ functions │
# ╰───┴───────────╯
spcd_step__environment_print() {
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")"
spcd_e_default() {
spcd_step "$(spcd_txt "set")"
[ -n "${SPCD_DNS_1}" ] || SPCD_DNS_1="9.9.9.9"
@ -436,6 +405,7 @@ spcd_step__environment_defaults_set() {
# /$repo/os/$arch
SPCD_URL_ARCH="https://geo.mirror.pkgbuild.com"
[ -n "${SPCD_URL_DEBIAN}" ] ||
# /dists/…
SPCD_URL_DEBIAN="https://deb.debian.org/debian"
[ -n "${SPCD_URL_EPEL}" ] ||
# /$releasever/Everything/…
@ -459,10 +429,11 @@ spcd_step__environment_defaults_set() {
# /$contentdir/$releasever/…
SPCD_URL_ROCKY="https://dl.rockylinux.org"
[ -n "${SPCD_URL_UBUNTU}" ] ||
# /dists/…
SPCD_URL_UBUNTU="https://ubuntu.mirrors.ovh.net/ubuntu"
}
spcd_step__environment_set_variables() {
spcd_e_set() {
spcd_step "Set variables"
# check script first
[ -n "${SPCD}" ] || spcd_error_ci "SPCD"
@ -925,6 +896,37 @@ spcd_f_ca_update() {
# │ 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_os_ls "$(realpath .)"
}
@ -972,6 +974,191 @@ spcd_f_pkg_git() {
# │ 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 │
# ╰───┴────┴───────╯
@ -1367,191 +1554,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 │
# ╰──────╯
@ -1561,12 +1563,12 @@ spcd_main() {
spcd_step_in "Environment"
spcd_step_in "Defaults"
spcd_step "Print defined"
spcd_step__environment_print
spcd_step__environment_defaults_set
spcd_f_env_list
spcd_e_default
spcd_step "Print effective"
spcd_step__environment_print
spcd_f_env_list
spcd_step_out
spcd_step__environment_set_variables
spcd_e_set
spcd_step "List workspace"
spcd_f_env_workspace
spcd_step_out
@ -1575,8 +1577,8 @@ spcd_main() {
spcd_f_dns "write"
# packages
spcd_step_in "Packages"
spcd_step__packages_set_repositories
spcd_step__packages_set_configuration
spcd_f_pm_conf_repos
spcd_f_pm_conf
spcd_f_pm_https_trust
spcd_f_pm_pkg_update
spcd_f_pm_pkg_install