.sh/CIDD
This commit is contained in:
parent
6aedbd3c7c
commit
5486b279a1
1 changed files with 301 additions and 301 deletions
602
cidd.sh
602
cidd.sh
|
@ -1,11 +1,11 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
# defaults
|
||||
[ -n "${CD_DNS}" ] || CD_DNS="\
|
||||
[ -n "${CIDD_DNS}" ] || CIDD_DNS="\
|
||||
9.9.9.9 \
|
||||
"
|
||||
[ -n "${CD_GIT_CHILD}" ] || CD_GIT_CHILD="cd"
|
||||
[ -n "${CD_GIT_PARENT}" ] || CD_GIT_PARENT="rwx"
|
||||
[ -n "${CIDD_GIT_CHILD}" ] || CIDD_GIT_CHILD="cd"
|
||||
[ -n "${CIDD_GIT_PARENT}" ] || CIDD_GIT_PARENT="rwx"
|
||||
|
||||
# main
|
||||
cd_main () {
|
||||
|
@ -41,136 +41,136 @@ cd_main () {
|
|||
cd_set_environment_variables () {
|
||||
cd_step "Set environment variables"
|
||||
# set path
|
||||
CD_PATH="$(realpath "${0}")"
|
||||
cd_echo "CD_PATH"
|
||||
CIDD_PATH="$(realpath "${0}")"
|
||||
cd_echo "CIDD_PATH"
|
||||
# set operating system id
|
||||
CD_OS_ID="$(cd_grep_os ID)"
|
||||
case "${CD_OS_ID}" in
|
||||
"almalinux") CD_OS_ID="${CD_OS_ALMA}" ;;
|
||||
"alpine") CD_OS_ID="${CD_OS_ALPINE}" ;;
|
||||
"arch") CD_OS_ID="${CD_OS_ARCH}" ;;
|
||||
"debian") CD_OS_ID="${CD_OS_DEBIAN}" ;;
|
||||
"fedora") CD_OS_ID="${CD_OS_FEDORA}" ;;
|
||||
"rocky") CD_OS_ID="${CD_OS_ROCKY}" ;;
|
||||
"ubuntu") CD_OS_ID="${CD_OS_UBUNTU}" ;;
|
||||
*) cd_error_os "CD_OS_ID" ;;
|
||||
CIDD_OS_ID="$(cd_grep_os ID)"
|
||||
case "${CIDD_OS_ID}" in
|
||||
"almalinux") CIDD_OS_ID="${CIDD_OS_ALMA}" ;;
|
||||
"alpine") CIDD_OS_ID="${CIDD_OS_ALPINE}" ;;
|
||||
"arch") CIDD_OS_ID="${CIDD_OS_ARCH}" ;;
|
||||
"debian") CIDD_OS_ID="${CIDD_OS_DEBIAN}" ;;
|
||||
"fedora") CIDD_OS_ID="${CIDD_OS_FEDORA}" ;;
|
||||
"rocky") CIDD_OS_ID="${CIDD_OS_ROCKY}" ;;
|
||||
"ubuntu") CIDD_OS_ID="${CIDD_OS_UBUNTU}" ;;
|
||||
*) cd_error_os "CIDD_OS_ID" ;;
|
||||
esac
|
||||
# set operating system version
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALMA}"|"${CD_OS_ARCH}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}")
|
||||
CD_OS_VERSION=$(cd_grep_os VERSION_ID \
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_ALMA}"|"${CIDD_OS_ARCH}"|"${CIDD_OS_FEDORA}"|"${CIDD_OS_ROCKY}")
|
||||
CIDD_OS_VERSION=$(cd_grep_os VERSION_ID \
|
||||
| sed "s|^\([0-9]\+\)\..*|\1|")
|
||||
;;
|
||||
"${CD_OS_ALPINE}")
|
||||
CD_OS_VERSION=$(cd_grep_os VERSION_ID \
|
||||
"${CIDD_OS_ALPINE}")
|
||||
CIDD_OS_VERSION=$(cd_grep_os VERSION_ID \
|
||||
| sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|")
|
||||
;;
|
||||
"${CD_OS_DEBIAN}"|"${CD_OS_UBUNTU}")
|
||||
CD_OS_VERSION="$(cd_grep_os VERSION_CODENAME)"
|
||||
"${CIDD_OS_DEBIAN}"|"${CIDD_OS_UBUNTU}")
|
||||
CIDD_OS_VERSION="$(cd_grep_os VERSION_CODENAME)"
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
# check operating system version
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALMA}"|"${CD_OS_ROCKY}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_ALMA}"|"${CIDD_OS_ROCKY}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"8"|"9") ;;
|
||||
*) cd_error_os "CD_OS_VERSION" ;;
|
||||
*) cd_error_os "CIDD_OS_VERSION" ;;
|
||||
esac
|
||||
;;
|
||||
"${CD_OS_ALPINE}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
"${CIDD_OS_ALPINE}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"3.18"|"3.19") ;;
|
||||
*) cd_error_os "CD_OS_VERSION" ;;
|
||||
*) cd_error_os "CIDD_OS_VERSION" ;;
|
||||
esac
|
||||
;;
|
||||
"${CD_OS_ARCH}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
"${CIDD_OS_ARCH}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"20231112"|"20240101") ;;
|
||||
*) cd_error_os "CD_OS_VERSION" ;;
|
||||
*) cd_error_os "CIDD_OS_VERSION" ;;
|
||||
esac
|
||||
;;
|
||||
"${CD_OS_DEBIAN}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
"${CIDD_OS_DEBIAN}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"bookworm"|"bullseye") ;;
|
||||
*) cd_error_os "CD_OS_VERSION" ;;
|
||||
*) cd_error_os "CIDD_OS_VERSION" ;;
|
||||
esac
|
||||
;;
|
||||
"${CD_OS_FEDORA}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
"${CIDD_OS_FEDORA}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"39"|"40") ;;
|
||||
*) cd_error_os "CD_OS_VERSION" ;;
|
||||
*) cd_error_os "CIDD_OS_VERSION" ;;
|
||||
esac
|
||||
;;
|
||||
"${CD_OS_UBUNTU}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
"${CIDD_OS_UBUNTU}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"jammy"|"noble") ;;
|
||||
*) cd_error_os "CD_OS_VERSION" ;;
|
||||
*) cd_error_os "CIDD_OS_VERSION" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
cd_split
|
||||
cd_echo "CD_OS_ID" "CD_OS_VERSION"
|
||||
cd_echo "CIDD_OS_ID" "CIDD_OS_VERSION"
|
||||
# universal
|
||||
CD_DNS_FILE="/etc/resolv.conf"
|
||||
CD_PKG_CA="ca-certificates"
|
||||
CD_PKG_GIT="git"
|
||||
CIDD_DNS_FILE="/etc/resolv.conf"
|
||||
CIDD_PKG_CA="ca-certificates"
|
||||
CIDD_PKG_GIT="git"
|
||||
# TODO move to Python
|
||||
CD_PKG_RSYNC="rsync"
|
||||
CD_PYTHON_ALIAS="python3"
|
||||
CIDD_PKG_RSYNC="rsync"
|
||||
CIDD_PYTHON_ALIAS="python3"
|
||||
cd_split
|
||||
cd_echo "CD_DNS_FILE" "CD_PKG_CA" "CD_PKG_GIT" "CD_PYTHON_ALIAS"
|
||||
cd_echo "CIDD_DNS_FILE" "CIDD_PKG_CA" "CIDD_PKG_GIT" "CIDD_PYTHON_ALIAS"
|
||||
# set ca command & root
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}")
|
||||
CD_CA_ROOT="/etc/pki/ca-trust/source/anchors"
|
||||
CD_CMD_CA="update-ca-trust"
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_ALMA}"|"${CIDD_OS_FEDORA}"|"${CIDD_OS_ROCKY}")
|
||||
CIDD_CA_ROOT="/etc/pki/ca-trust/source/anchors"
|
||||
CIDD_CMD_CA="update-ca-trust"
|
||||
;;
|
||||
"${CD_OS_ALPINE}")
|
||||
CD_CA_ROOT="/usr/local/share/ca-certificates"
|
||||
CD_CMD_CA="update-ca-certificates"
|
||||
"${CIDD_OS_ALPINE}")
|
||||
CIDD_CA_ROOT="/usr/local/share/ca-certificates"
|
||||
CIDD_CMD_CA="update-ca-certificates"
|
||||
;;
|
||||
"${CD_OS_ARCH}")
|
||||
CD_CA_ROOT="/etc/ca-certificates/trust-source/anchors"
|
||||
CD_CMD_CA="update-ca-trust"
|
||||
"${CIDD_OS_ARCH}")
|
||||
CIDD_CA_ROOT="/etc/ca-certificates/trust-source/anchors"
|
||||
CIDD_CMD_CA="update-ca-trust"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}"|"${CD_OS_UBUNTU}")
|
||||
CD_CA_ROOT="/usr/local/share/ca-certificates"
|
||||
CD_CMD_CA="update-ca-certificates"
|
||||
"${CIDD_OS_DEBIAN}"|"${CIDD_OS_UBUNTU}")
|
||||
CIDD_CA_ROOT="/usr/local/share/ca-certificates"
|
||||
CIDD_CMD_CA="update-ca-certificates"
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
cd_split
|
||||
cd_echo "CD_CA_ROOT" "CD_CMD_CA"
|
||||
cd_echo "CIDD_CA_ROOT" "CIDD_CMD_CA"
|
||||
# set package manager
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALPINE}")
|
||||
CD_PM="${CD_PM_APK}"
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_ALPINE}")
|
||||
CIDD_PM="${CIDD_PM_APK}"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}"|"${CD_OS_UBUNTU}")
|
||||
CD_PM="${CD_PM_APT}"
|
||||
"${CIDD_OS_DEBIAN}"|"${CIDD_OS_UBUNTU}")
|
||||
CIDD_PM="${CIDD_PM_APT}"
|
||||
;;
|
||||
"${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}")
|
||||
CD_PM="${CD_PM_DNF}"
|
||||
"${CIDD_OS_ALMA}"|"${CIDD_OS_FEDORA}"|"${CIDD_OS_ROCKY}")
|
||||
CIDD_PM="${CIDD_PM_DNF}"
|
||||
;;
|
||||
"${CD_OS_ARCH}")
|
||||
CD_PM="${CD_PM_PACMAN}"
|
||||
"${CIDD_OS_ARCH}")
|
||||
CIDD_PM="${CIDD_PM_PACMAN}"
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
cd_split
|
||||
cd_echo "CD_PM"
|
||||
case "${CD_PM}" in
|
||||
"${CD_PM_DNF}")
|
||||
CD_PM_CLEAN="dnf clean all"
|
||||
CD_PM_INSTALL="dnf install --assumeyes"
|
||||
CD_PM_QUERY="rpm --query"
|
||||
CD_PM_UPDATE="dnf makecache"
|
||||
CD_PM_UPGRADE="dnf upgrade --assumeyes"
|
||||
CD_PKG_PKG=""
|
||||
CD_PM_CONF_PATH="/etc/dnf/dnf.conf"
|
||||
CD_PM_CONF_TEXT="\
|
||||
cd_echo "CIDD_PM"
|
||||
case "${CIDD_PM}" in
|
||||
"${CIDD_PM_DNF}")
|
||||
CIDD_PM_CLEAN="dnf clean all"
|
||||
CIDD_PM_INSTALL="dnf install --assumeyes"
|
||||
CIDD_PM_QUERY="rpm --query"
|
||||
CIDD_PM_UPDATE="dnf makecache"
|
||||
CIDD_PM_UPGRADE="dnf upgrade --assumeyes"
|
||||
CIDD_PKG_PKG=""
|
||||
CIDD_PM_CONF_PATH="/etc/dnf/dnf.conf"
|
||||
CIDD_PM_CONF_TEXT="\
|
||||
[main]
|
||||
best=True
|
||||
clean_requirements_on_remove=True
|
||||
|
@ -178,209 +178,209 @@ gpgcheck=1
|
|||
installonly_limit=3
|
||||
skip_if_unavailable=False
|
||||
"
|
||||
CD_PM_HTTPS_PATH="/etc/dnf/dnf.conf.d/https.conf"
|
||||
CD_PM_HTTPS_TEXT="\
|
||||
CIDD_PM_HTTPS_PATH="/etc/dnf/dnf.conf.d/https.conf"
|
||||
CIDD_PM_HTTPS_TEXT="\
|
||||
sslverify=False
|
||||
"
|
||||
;;
|
||||
"${CD_PM_APK}")
|
||||
CD_PM_CLEAN="apk cache purge"
|
||||
CD_PM_INSTALL="apk add"
|
||||
CD_PM_QUERY="apk info"
|
||||
CD_PM_UPDATE="apk update"
|
||||
CD_PM_UPGRADE="apk upgrade"
|
||||
CD_PKG_PKG=""
|
||||
CD_PM_CONF_PATH=""
|
||||
CD_PM_CONF_TEXT=""
|
||||
CD_PM_HTTPS_PATH="/etc/apk/repositories.d/https"
|
||||
CD_PM_HTTPS_TEXT="\
|
||||
"${CIDD_PM_APK}")
|
||||
CIDD_PM_CLEAN="apk cache purge"
|
||||
CIDD_PM_INSTALL="apk add"
|
||||
CIDD_PM_QUERY="apk info"
|
||||
CIDD_PM_UPDATE="apk update"
|
||||
CIDD_PM_UPGRADE="apk upgrade"
|
||||
CIDD_PKG_PKG=""
|
||||
CIDD_PM_CONF_PATH=""
|
||||
CIDD_PM_CONF_TEXT=""
|
||||
CIDD_PM_HTTPS_PATH="/etc/apk/repositories.d/https"
|
||||
CIDD_PM_HTTPS_TEXT="\
|
||||
--no-verify
|
||||
"
|
||||
;;
|
||||
"${CD_PM_PACMAN}")
|
||||
CD_PM_CLEAN="pacman --sync --clean --noconfirm"
|
||||
CD_PM_INSTALL="pacman --sync --noconfirm"
|
||||
CD_PM_QUERY="pacman --query"
|
||||
CD_PM_UPDATE="pacman --sync --refresh"
|
||||
CD_PM_UPGRADE="pacman --sync --sysupgrade --noconfirm"
|
||||
CD_PKG_PKG=""
|
||||
CD_PM_CONF_PATH=""
|
||||
CD_PM_CONF_TEXT=""
|
||||
CD_PM_HTTPS_PATH="/etc/pacman.d/https.conf"
|
||||
CD_PM_HTTPS_TEXT="\
|
||||
"${CIDD_PM_PACMAN}")
|
||||
CIDD_PM_CLEAN="pacman --sync --clean --noconfirm"
|
||||
CIDD_PM_INSTALL="pacman --sync --noconfirm"
|
||||
CIDD_PM_QUERY="pacman --query"
|
||||
CIDD_PM_UPDATE="pacman --sync --refresh"
|
||||
CIDD_PM_UPGRADE="pacman --sync --sysupgrade --noconfirm"
|
||||
CIDD_PKG_PKG=""
|
||||
CIDD_PM_CONF_PATH=""
|
||||
CIDD_PM_CONF_TEXT=""
|
||||
CIDD_PM_HTTPS_PATH="/etc/pacman.d/https.conf"
|
||||
CIDD_PM_HTTPS_TEXT="\
|
||||
SSLVerify = No
|
||||
"
|
||||
;;
|
||||
"${CD_PM_APT}")
|
||||
CD_PM_CLEAN="apt-get clean"
|
||||
CD_PM_INSTALL="apt-get install --assume-yes"
|
||||
CD_PM_QUERY="dpkg-query --show"
|
||||
CD_PM_UPDATE="apt-get update"
|
||||
CD_PM_UPGRADE="apt-get upgrade --assume-yes"
|
||||
CD_PKG_PKG="apt-utils"
|
||||
CD_PM_CONF_PATH="/etc/apt/apt.conf.d/apt.conf"
|
||||
CD_PM_CONF_TEXT="\
|
||||
"${CIDD_PM_APT}")
|
||||
CIDD_PM_CLEAN="apt-get clean"
|
||||
CIDD_PM_INSTALL="apt-get install --assume-yes"
|
||||
CIDD_PM_QUERY="dpkg-query --show"
|
||||
CIDD_PM_UPDATE="apt-get update"
|
||||
CIDD_PM_UPGRADE="apt-get upgrade --assume-yes"
|
||||
CIDD_PKG_PKG="apt-utils"
|
||||
CIDD_PM_CONF_PATH="/etc/apt/apt.conf.d/apt.conf"
|
||||
CIDD_PM_CONF_TEXT="\
|
||||
Acquire::Check-Valid-Until True;
|
||||
APT::Get::Show-Versions True;
|
||||
APT::Install-Recommends False;
|
||||
APT::Install-Suggests False;
|
||||
Dir::Etc::SourceParts \"\";
|
||||
"
|
||||
CD_PM_HTTPS_PATH="/etc/apt/apt.conf.d/https"
|
||||
CD_PM_HTTPS_TEXT="\
|
||||
CIDD_PM_HTTPS_PATH="/etc/apt/apt.conf.d/https"
|
||||
CIDD_PM_HTTPS_TEXT="\
|
||||
Acquire::https::Verify-Peer False;
|
||||
"
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
cd_split
|
||||
cd_echo "CD_PM_CLEAN" \
|
||||
"CD_PM_INSTALL" "CD_PM_QUERY" "CD_PM_UPDATE" "CD_PM_UPGRADE"
|
||||
cd_echo "CIDD_PM_CLEAN" \
|
||||
"CIDD_PM_INSTALL" "CIDD_PM_QUERY" "CIDD_PM_UPDATE" "CIDD_PM_UPGRADE"
|
||||
cd_split
|
||||
cd_echo "CD_PKG_PKG" "CD_PM_CONF_PATH" "CD_PM_HTTPS_PATH"
|
||||
cd_echo "CIDD_PKG_PKG" "CIDD_PM_CONF_PATH" "CIDD_PM_HTTPS_PATH"
|
||||
# specific
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALMA}")
|
||||
CD_URL_DEFAULT="https://repo.almalinux.org/almalinux"
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_ALMA}")
|
||||
CIDD_URL_DEFAULT="https://repo.almalinux.org/almalinux"
|
||||
;;
|
||||
"${CD_OS_ALPINE}")
|
||||
CD_URL_DEFAULT="https://dl-cdn.alpinelinux.org/alpine"
|
||||
"${CIDD_OS_ALPINE}")
|
||||
CIDD_URL_DEFAULT="https://dl-cdn.alpinelinux.org/alpine"
|
||||
;;
|
||||
"${CD_OS_ARCH}")
|
||||
CD_URL_DEFAULT="https://geo.mirror.pkgbuild.com"
|
||||
"${CIDD_OS_ARCH}")
|
||||
CIDD_URL_DEFAULT="https://geo.mirror.pkgbuild.com"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}")
|
||||
CD_URL_DEFAULT="http://deb.debian.org/debian"
|
||||
"${CIDD_OS_DEBIAN}")
|
||||
CIDD_URL_DEFAULT="http://deb.debian.org/debian"
|
||||
;;
|
||||
"${CD_OS_FEDORA}")
|
||||
CD_URL_DEFAULT="http://download.example/pub/fedora/linux/releases"
|
||||
"${CIDD_OS_FEDORA}")
|
||||
CIDD_URL_DEFAULT="http://download.example/pub/fedora/linux/releases"
|
||||
;;
|
||||
"${CD_OS_ROCKY}")
|
||||
CD_URL_DEFAULT="http://dl.rockylinux.org/\$contentdir"
|
||||
"${CIDD_OS_ROCKY}")
|
||||
CIDD_URL_DEFAULT="http://dl.rockylinux.org/\$contentdir"
|
||||
;;
|
||||
"${CD_OS_UBUNTU}")
|
||||
CD_URL_DEFAULT="http://archive.ubuntu.com/ubuntu"
|
||||
"${CIDD_OS_UBUNTU}")
|
||||
CIDD_URL_DEFAULT="http://archive.ubuntu.com/ubuntu"
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
CD_URL_CHOSEN="${CD_URL_DEFAULT}"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALMA}")
|
||||
[ -n "${CD_URL_ALMA}" ] && CD_URL_CHOSEN="${CD_URL_ALMA}"
|
||||
CIDD_URL_CHOSEN="${CIDD_URL_DEFAULT}"
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_ALMA}")
|
||||
[ -n "${CIDD_URL_ALMA}" ] && CIDD_URL_CHOSEN="${CIDD_URL_ALMA}"
|
||||
;;
|
||||
"${CD_OS_ALPINE}")
|
||||
[ -n "${CD_URL_ALPINE}" ] && CD_URL_CHOSEN="${CD_URL_ALPINE}"
|
||||
"${CIDD_OS_ALPINE}")
|
||||
[ -n "${CIDD_URL_ALPINE}" ] && CIDD_URL_CHOSEN="${CIDD_URL_ALPINE}"
|
||||
;;
|
||||
"${CD_OS_ARCH}")
|
||||
[ -n "${CD_URL_ARCH}" ] && CD_URL_CHOSEN="${CD_URL_ARCH}"
|
||||
"${CIDD_OS_ARCH}")
|
||||
[ -n "${CIDD_URL_ARCH}" ] && CIDD_URL_CHOSEN="${CIDD_URL_ARCH}"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}")
|
||||
[ -n "${CD_URL_DEBIAN}" ] && CD_URL_CHOSEN="${CD_URL_DEBIAN}" \
|
||||
|| CD_URL_CHOSEN="https://deb.debian.org/debian"
|
||||
"${CIDD_OS_DEBIAN}")
|
||||
[ -n "${CIDD_URL_DEBIAN}" ] && CIDD_URL_CHOSEN="${CIDD_URL_DEBIAN}" \
|
||||
|| CIDD_URL_CHOSEN="https://deb.debian.org/debian"
|
||||
;;
|
||||
"${CD_OS_FEDORA}")
|
||||
[ -n "${CD_URL_FEDORA}" ] && CD_URL_CHOSEN="${CD_URL_FEDORA}" \
|
||||
|| CD_URL_CHOSEN="https://rpmfind.net/linux/fedora/linux/releases"
|
||||
"${CIDD_OS_FEDORA}")
|
||||
[ -n "${CIDD_URL_FEDORA}" ] && CIDD_URL_CHOSEN="${CIDD_URL_FEDORA}" \
|
||||
|| CIDD_URL_CHOSEN="https://rpmfind.net/linux/fedora/linux/releases"
|
||||
;;
|
||||
"${CD_OS_ROCKY}")
|
||||
[ -n "${CD_URL_ROCKY}" ] && CD_URL_CHOSEN="${CD_URL_ROCKY}" \
|
||||
|| CD_URL_CHOSEN="https://dl.rockylinux.org/\$contentdir"
|
||||
"${CIDD_OS_ROCKY}")
|
||||
[ -n "${CIDD_URL_ROCKY}" ] && CIDD_URL_CHOSEN="${CIDD_URL_ROCKY}" \
|
||||
|| CIDD_URL_CHOSEN="https://dl.rockylinux.org/\$contentdir"
|
||||
;;
|
||||
"${CD_OS_UBUNTU}")
|
||||
[ -n "${CD_URL_UBUNTU}" ] && CD_URL_CHOSEN="${CD_URL_UBUNTU}" \
|
||||
|| CD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu"
|
||||
"${CIDD_OS_UBUNTU}")
|
||||
[ -n "${CIDD_URL_UBUNTU}" ] && CIDD_URL_CHOSEN="${CIDD_URL_UBUNTU}" \
|
||||
|| CIDD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu"
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
cd_split
|
||||
cd_echo "CD_URL_DEFAULT" "CD_URL_CHOSEN"
|
||||
cd_echo "CIDD_URL_DEFAULT" "CIDD_URL_CHOSEN"
|
||||
# set python command & package
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALMA}"|"${CD_OS_ROCKY}")
|
||||
CD_PYTHON_COMMAND="python3.11"
|
||||
CD_PYTHON_PACKAGE="python3.11"
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_ALMA}"|"${CIDD_OS_ROCKY}")
|
||||
CIDD_PYTHON_COMMAND="python3.11"
|
||||
CIDD_PYTHON_PACKAGE="python3.11"
|
||||
;;
|
||||
"${CD_OS_ALPINE}")
|
||||
CD_PYTHON_COMMAND="python3.11"
|
||||
CD_PYTHON_PACKAGE="python3"
|
||||
"${CIDD_OS_ALPINE}")
|
||||
CIDD_PYTHON_COMMAND="python3.11"
|
||||
CIDD_PYTHON_PACKAGE="python3"
|
||||
;;
|
||||
"${CD_OS_ARCH}")
|
||||
CD_PYTHON_COMMAND="python3.12"
|
||||
CD_PYTHON_PACKAGE="python"
|
||||
"${CIDD_OS_ARCH}")
|
||||
CIDD_PYTHON_COMMAND="python3.12"
|
||||
CIDD_PYTHON_PACKAGE="python"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
"bookworm") CD_PYTHON_COMMAND="python3.11" ;;
|
||||
"bullseye") CD_PYTHON_COMMAND="python3.9" ;;
|
||||
"${CIDD_OS_DEBIAN}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"bookworm") CIDD_PYTHON_COMMAND="python3.11" ;;
|
||||
"bullseye") CIDD_PYTHON_COMMAND="python3.9" ;;
|
||||
*)
|
||||
esac
|
||||
CD_PYTHON_PACKAGE="python3"
|
||||
CIDD_PYTHON_PACKAGE="python3"
|
||||
;;
|
||||
"${CD_OS_FEDORA}")
|
||||
CD_PYTHON_COMMAND="python3.12"
|
||||
CD_PYTHON_PACKAGE="python3"
|
||||
"${CIDD_OS_FEDORA}")
|
||||
CIDD_PYTHON_COMMAND="python3.12"
|
||||
CIDD_PYTHON_PACKAGE="python3"
|
||||
;;
|
||||
"${CD_OS_UBUNTU}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
"noble") CD_PYTHON_COMMAND="python3.12" ;;
|
||||
"jammy") CD_PYTHON_COMMAND="python3.10" ;;
|
||||
"${CIDD_OS_UBUNTU}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"noble") CIDD_PYTHON_COMMAND="python3.12" ;;
|
||||
"jammy") CIDD_PYTHON_COMMAND="python3.10" ;;
|
||||
*)
|
||||
esac
|
||||
CD_PYTHON_PACKAGE="python3"
|
||||
CIDD_PYTHON_PACKAGE="python3"
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
# set python packages
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}")
|
||||
CD_PYTHON_PACKAGES="/usr/lib64/${CD_PYTHON_COMMAND}/site-packages"
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_ALMA}"|"${CIDD_OS_FEDORA}"|"${CIDD_OS_ROCKY}")
|
||||
CIDD_PYTHON_PACKAGES="/usr/lib64/${CIDD_PYTHON_COMMAND}/site-packages"
|
||||
;;
|
||||
"${CD_OS_ALPINE}"|"${CD_OS_ARCH}")
|
||||
CD_PYTHON_PACKAGES="/usr/lib/${CD_PYTHON_COMMAND}/site-packages"
|
||||
"${CIDD_OS_ALPINE}"|"${CIDD_OS_ARCH}")
|
||||
CIDD_PYTHON_PACKAGES="/usr/lib/${CIDD_PYTHON_COMMAND}/site-packages"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}"|"${CD_OS_UBUNTU}")
|
||||
CD_PYTHON_PACKAGES="/usr/lib/${CD_PYTHON_ALIAS}/dist-packages"
|
||||
"${CIDD_OS_DEBIAN}"|"${CIDD_OS_UBUNTU}")
|
||||
CIDD_PYTHON_PACKAGES="/usr/lib/${CIDD_PYTHON_ALIAS}/dist-packages"
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
cd_split
|
||||
cd_echo "CD_PYTHON_COMMAND" "CD_PYTHON_PACKAGE" "CD_PYTHON_PACKAGES"
|
||||
cd_echo "CIDD_PYTHON_COMMAND" "CIDD_PYTHON_PACKAGE" "CIDD_PYTHON_PACKAGES"
|
||||
# variables
|
||||
[ -n "${CD_CA_1}" ] && CD_CA=true
|
||||
[ -n "${CIDD_CA_1}" ] && CIDD_CA=true
|
||||
# continuous integration platform
|
||||
if [ -n "${GITHUB_ACTIONS}" ] ; then
|
||||
# github → gitea → forgejo
|
||||
if [ -n "${GITHUB_SERVER_URL}" ] ; then
|
||||
CD_SERVER_URL="${GITHUB_SERVER_URL}"
|
||||
CIDD_SERVER_URL="${GITHUB_SERVER_URL}"
|
||||
else
|
||||
cd_error_ci "GITHUB_SERVER_URL"
|
||||
fi
|
||||
if [ -n "${GITHUB_REPOSITORY}" ] ; then
|
||||
CD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")"
|
||||
CD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
||||
CIDD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")"
|
||||
CIDD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
||||
else
|
||||
cd_error_ci "GITHUB_REPOSITORY"
|
||||
fi
|
||||
if [ -n "${GITHUB_REF_NAME}" ] ; then
|
||||
CD_PROJECT_BRANCH="${GITHUB_REF_NAME}"
|
||||
CIDD_PROJECT_BRANCH="${GITHUB_REF_NAME}"
|
||||
else
|
||||
cd_error_ci "GITHUB_REF_NAME"
|
||||
fi
|
||||
elif [ -n "${GITLAB_CI}" ] ; then
|
||||
# gitlab
|
||||
if [ -n "${CI_SERVER_URL}" ] ; then
|
||||
CD_SERVER_URL="${CI_SERVER_URL}"
|
||||
CIDD_SERVER_URL="${CI_SERVER_URL}"
|
||||
else
|
||||
cd_error_ci "CI_SERVER_URL"
|
||||
fi
|
||||
if [ -n "${CI_PROJECT_PATH}" ] ; then
|
||||
CD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")"
|
||||
CD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")"
|
||||
CIDD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")"
|
||||
CIDD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")"
|
||||
else
|
||||
cd_error_ci "CI_PROJECT_PATH"
|
||||
fi
|
||||
if [ -n "${CI_COMMIT_BRANCH}" ] ; then
|
||||
CD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
||||
CIDD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
||||
else
|
||||
cd_error_ci "CI_COMMIT_BRANCH"
|
||||
fi
|
||||
|
@ -388,34 +388,34 @@ Acquire::https::Verify-Peer False;
|
|||
# unsupported
|
||||
cd_error_ci "ø"
|
||||
fi
|
||||
[ -n "${CD_SERVER_URL}" ] || cd_error_ci "CD_SERVER_URL"
|
||||
[ -n "${CD_PROJECTS_GROUP}" ] || cd_error_ci "CD_PROJECTS_GROUP"
|
||||
[ -n "${CD_PROJECT_NAME}" ] || cd_error_ci "CD_PROJECT_NAME"
|
||||
[ -n "${CD_PROJECT_BRANCH}" ] || cd_error_ci "CD_PROJECT_BRANCH"
|
||||
[ -n "${CIDD_SERVER_URL}" ] || cd_error_ci "CIDD_SERVER_URL"
|
||||
[ -n "${CIDD_PROJECTS_GROUP}" ] || cd_error_ci "CIDD_PROJECTS_GROUP"
|
||||
[ -n "${CIDD_PROJECT_NAME}" ] || cd_error_ci "CIDD_PROJECT_NAME"
|
||||
[ -n "${CIDD_PROJECT_BRANCH}" ] || cd_error_ci "CIDD_PROJECT_BRANCH"
|
||||
#
|
||||
CD_PROJECTS_URL="${CD_SERVER_URL}/${CD_PROJECTS_GROUP}"
|
||||
CIDD_PROJECTS_URL="${CIDD_SERVER_URL}/${CIDD_PROJECTS_GROUP}"
|
||||
#
|
||||
cd_split
|
||||
cd_echo "CD_CA"
|
||||
cd_echo "CIDD_CA"
|
||||
cd_split
|
||||
cd_echo "CD_SERVER_URL" \
|
||||
"CD_PROJECTS_GROUP" "CD_PROJECT_NAME" "CD_PROJECT_BRANCH"
|
||||
cd_echo "CIDD_SERVER_URL" \
|
||||
"CIDD_PROJECTS_GROUP" "CIDD_PROJECT_NAME" "CIDD_PROJECT_BRANCH"
|
||||
cd_split
|
||||
cd_echo "CD_PROJECTS_URL"
|
||||
cd_echo "CIDD_PROJECTS_URL"
|
||||
# TODO move to Python
|
||||
case "${CD_PM}" in
|
||||
"${CD_PM_APK}"|"${CD_PM_APT}") CD_PKG_SSH="openssh-client" ;;
|
||||
"${CD_PM_DNF}") CD_PKG_SSH="openssh-clients" ;;
|
||||
"${CD_PM_PACMAN}") CD_PKG_SSH="openssh" ;;
|
||||
case "${CIDD_PM}" in
|
||||
"${CIDD_PM_APK}"|"${CIDD_PM_APT}") CIDD_PKG_SSH="openssh-client" ;;
|
||||
"${CIDD_PM_DNF}") CIDD_PKG_SSH="openssh-clients" ;;
|
||||
"${CIDD_PM_PACMAN}") CIDD_PKG_SSH="openssh" ;;
|
||||
*)
|
||||
esac
|
||||
}
|
||||
|
||||
cd_set_packages_repositories () {
|
||||
cd_step "Set packages repositories"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALMA}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_ALMA}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"8") \
|
||||
cd_set_packages_repositories__file="/etc/yum.repos.d/almalinux.repo" ;;
|
||||
"9") \
|
||||
|
@ -424,27 +424,27 @@ cd_set_packages_repositories__file="/etc/yum.repos.d/almalinux-baseos.repo" ;;
|
|||
esac
|
||||
cd_sed "${cd_set_packages_repositories__file}" \
|
||||
"|^mirrorlist|# mirrorlist|" \
|
||||
"|${CD_URL_DEFAULT}|${CD_URL_CHOSEN}|" \
|
||||
"|${CIDD_URL_DEFAULT}|${CIDD_URL_CHOSEN}|" \
|
||||
"|^# baseurl|baseurl|"
|
||||
;;
|
||||
"${CD_OS_ALPINE}")
|
||||
"${CIDD_OS_ALPINE}")
|
||||
cd_set_packages_repositories__file="/etc/apk/repositories"
|
||||
cd_write "${cd_set_packages_repositories__file}" "\
|
||||
${CD_URL_CHOSEN}/v${CD_OS_VERSION}/main
|
||||
${CD_URL_CHOSEN}/v${CD_OS_VERSION}/community
|
||||
${CIDD_URL_CHOSEN}/v${CIDD_OS_VERSION}/main
|
||||
${CIDD_URL_CHOSEN}/v${CIDD_OS_VERSION}/community
|
||||
"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}")
|
||||
"${CIDD_OS_DEBIAN}")
|
||||
cd_set_packages_repositories__file="/etc/apt/sources.list"
|
||||
cd_write "${cd_set_packages_repositories__file}" "\
|
||||
deb ${CD_URL_CHOSEN} ${CD_OS_VERSION} main
|
||||
deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-backports main
|
||||
deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-updates main
|
||||
deb ${CD_URL_CHOSEN}-security ${CD_OS_VERSION}-security main
|
||||
deb ${CIDD_URL_CHOSEN} ${CIDD_OS_VERSION} main
|
||||
deb ${CIDD_URL_CHOSEN} ${CIDD_OS_VERSION}-backports main
|
||||
deb ${CIDD_URL_CHOSEN} ${CIDD_OS_VERSION}-updates main
|
||||
deb ${CIDD_URL_CHOSEN}-security ${CIDD_OS_VERSION}-security main
|
||||
"
|
||||
;;
|
||||
"${CD_OS_ROCKY}")
|
||||
case "${CD_OS_VERSION}" in
|
||||
"${CIDD_OS_ROCKY}")
|
||||
case "${CIDD_OS_VERSION}" in
|
||||
"8") \
|
||||
cd_set_packages_repositories__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;;
|
||||
"9") \
|
||||
|
@ -453,16 +453,16 @@ cd_set_packages_repositories__file="/etc/yum.repos.d/rocky.repo" ;;
|
|||
esac
|
||||
cd_sed "${cd_set_packages_repositories__file}" \
|
||||
"|^mirrorlist|# mirrorlist|" \
|
||||
"|${CD_URL_DEFAULT}|${CD_URL_CHOSEN}|" \
|
||||
"|${CIDD_URL_DEFAULT}|${CIDD_URL_CHOSEN}|" \
|
||||
"|^#baseurl|baseurl|"
|
||||
;;
|
||||
"${CD_OS_UBUNTU}")
|
||||
"${CIDD_OS_UBUNTU}")
|
||||
cd_set_packages_repositories__file="/etc/apt/sources.list"
|
||||
cd_write "${cd_set_packages_repositories__file}" "\
|
||||
deb ${CD_URL_CHOSEN} ${CD_OS_VERSION} main
|
||||
deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-backports main
|
||||
deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-updates main
|
||||
deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-security main
|
||||
deb ${CIDD_URL_CHOSEN} ${CIDD_OS_VERSION} main
|
||||
deb ${CIDD_URL_CHOSEN} ${CIDD_OS_VERSION}-backports main
|
||||
deb ${CIDD_URL_CHOSEN} ${CIDD_OS_VERSION}-updates main
|
||||
deb ${CIDD_URL_CHOSEN} ${CIDD_OS_VERSION}-security main
|
||||
"
|
||||
;;
|
||||
*)
|
||||
|
@ -471,9 +471,9 @@ deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-security main
|
|||
|
||||
cd_set_packages_configuration () {
|
||||
cd_step "Set packages configuration"
|
||||
cd_write "${CD_PM_CONF_PATH}" "${CD_PM_CONF_TEXT}"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_DEBIAN}"|"${CD_OS_UBUNTU}")
|
||||
cd_write "${CIDD_PM_CONF_PATH}" "${CIDD_PM_CONF_TEXT}"
|
||||
case "${CIDD_OS_ID}" in
|
||||
"${CIDD_OS_DEBIAN}"|"${CIDD_OS_UBUNTU}")
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
;;
|
||||
*)
|
||||
|
@ -489,47 +489,47 @@ cd_list_working_directory () {
|
|||
}
|
||||
|
||||
cd_set_https_verification_off () {
|
||||
if [ -n "${CD_CA}" ] || [ "${CD_PM}" = "${CD_PM_APT}" ] ; then
|
||||
if [ -n "${CIDD_CA}" ] || [ "${CIDD_PM}" = "${CIDD_PM_APT}" ] ; then
|
||||
cd_step "Set HTTPS verification off"
|
||||
cd_mkdir "$(dirname "${CD_PM_HTTPS_PATH}")"
|
||||
cd_write "${CD_PM_HTTPS_PATH}" "${CD_PM_HTTPS_TEXT}"
|
||||
cd_mkdir "$(dirname "${CIDD_PM_HTTPS_PATH}")"
|
||||
cd_write "${CIDD_PM_HTTPS_PATH}" "${CIDD_PM_HTTPS_TEXT}"
|
||||
fi
|
||||
}
|
||||
|
||||
cd_set_dns_resolving () {
|
||||
cd_step "Set DNS resolving"
|
||||
for cd_set_dns_resolving__server in ${CD_DNS} ; do
|
||||
for cd_set_dns_resolving__server in ${CIDD_DNS} ; do
|
||||
cd_set_dns_resolving__text="${cd_set_dns_resolving__text}\
|
||||
nameserver ${cd_set_dns_resolving__server}
|
||||
"
|
||||
done
|
||||
cd_write "${CD_DNS_FILE}" "${cd_set_dns_resolving__text}"
|
||||
cd_write "${CIDD_DNS_FILE}" "${cd_set_dns_resolving__text}"
|
||||
}
|
||||
|
||||
cd_update_packages_catalog () {
|
||||
cd_step "Update packages catalog"
|
||||
${CD_PM_UPDATE} || exit
|
||||
${CIDD_PM_UPDATE} || exit
|
||||
}
|
||||
|
||||
cd_install_packages_tools () {
|
||||
cd_step "Install packages tools"
|
||||
cd_install_package "${CD_PKG_PKG}"
|
||||
cd_install_package "${CIDD_PKG_PKG}"
|
||||
}
|
||||
|
||||
cd_install_ca_certificates () {
|
||||
cd_step "Install CA"
|
||||
cd_install_package "${CD_PKG_CA}"
|
||||
cd_install_package "${CIDD_PKG_CA}"
|
||||
}
|
||||
|
||||
cd_write_ca_certificates () {
|
||||
cd_step "Write CA certificates"
|
||||
cd_mkdir "${CD_CA_ROOT}"
|
||||
cd_mkdir "${CIDD_CA_ROOT}"
|
||||
cd_write_ca_certificates__index=1
|
||||
eval "cd_write_ca_certificates__text=\
|
||||
\"\${CD_CA_${cd_write_ca_certificates__index}}\""
|
||||
\"\${CIDD_CA_${cd_write_ca_certificates__index}}\""
|
||||
while [ -n "${cd_write_ca_certificates__text}" ] ; do
|
||||
cd_write_ca_certificates__path="\
|
||||
${CD_CA_ROOT}/${cd_write_ca_certificates__index}.crt"
|
||||
${CIDD_CA_ROOT}/${cd_write_ca_certificates__index}.crt"
|
||||
cd_split
|
||||
cd_write \
|
||||
"${cd_write_ca_certificates__path}" \
|
||||
|
@ -537,52 +537,52 @@ ${CD_CA_ROOT}/${cd_write_ca_certificates__index}.crt"
|
|||
cd_openssl "${cd_write_ca_certificates__path}"
|
||||
cd_write_ca_certificates__index=$((cd_write_ca_certificates__index+1))
|
||||
eval "cd_write_ca_certificates__text=\
|
||||
\"\${CD_CA_${cd_write_ca_certificates__index}}\""
|
||||
\"\${CIDD_CA_${cd_write_ca_certificates__index}}\""
|
||||
done
|
||||
}
|
||||
|
||||
cd_update_ca_certificates () {
|
||||
cd_step "Update CA certificates"
|
||||
${CD_CMD_CA} || exit
|
||||
${CIDD_CMD_CA} || exit
|
||||
}
|
||||
|
||||
cd_set_https_verification_on () {
|
||||
cd_step "Set HTTPS verification on"
|
||||
cd_rm "${CD_PM_HTTPS_PATH}"
|
||||
cd_rm "${CIDD_PM_HTTPS_PATH}"
|
||||
}
|
||||
|
||||
cd_upgrade_packages () {
|
||||
cd_step "Upgrade packages"
|
||||
${CD_PM_UPGRADE} || exit
|
||||
${CIDD_PM_UPGRADE} || exit
|
||||
}
|
||||
|
||||
cd_install_git () {
|
||||
cd_step "Install Git"
|
||||
cd_install_package "${CD_PKG_GIT}"
|
||||
cd_install_package "${CIDD_PKG_GIT}"
|
||||
}
|
||||
|
||||
cd_install_python () {
|
||||
cd_step "Install Python"
|
||||
cd_install_package "${CD_PYTHON_PACKAGE}"
|
||||
cd_install_package "${CIDD_PYTHON_PACKAGE}"
|
||||
cd_split
|
||||
cd_ln_python "${CD_PYTHON_COMMAND}"
|
||||
cd_ln_python "${CIDD_PYTHON_COMMAND}"
|
||||
}
|
||||
|
||||
# TODO move to Python
|
||||
cd_install_rsync () {
|
||||
cd_step "Install Rsync"
|
||||
cd_install_package "${CD_PKG_RSYNC}"
|
||||
cd_install_package "${CIDD_PKG_RSYNC}"
|
||||
}
|
||||
|
||||
# TODO move to Python
|
||||
cd_install_ssh () {
|
||||
cd_step "Install SSH"
|
||||
cd_install_package "${CD_PKG_SSH}"
|
||||
cd_install_package "${CIDD_PKG_SSH}"
|
||||
}
|
||||
|
||||
cd_clean_packages_cache () {
|
||||
cd_step "Clean packages cache"
|
||||
${CD_PM_CLEAN} || exit
|
||||
${CIDD_PM_CLEAN} || exit
|
||||
}
|
||||
|
||||
cd_install_python_modules () {
|
||||
|
@ -590,10 +590,10 @@ cd_install_python_modules () {
|
|||
cd_install_python_modules__root="$(mktemp --directory)" || exit
|
||||
echo "→ ${cd_install_python_modules__root}"
|
||||
for cd_install_python_modules__repository \
|
||||
in "${CD_GIT_CHILD}" "${CD_GIT_PARENT}" ; do
|
||||
in "${CIDD_GIT_CHILD}" "${CIDD_GIT_PARENT}" ; do
|
||||
cd_split
|
||||
cd_install_python_modules__url="\
|
||||
${CD_PROJECTS_URL}/${cd_install_python_modules__repository}"
|
||||
${CIDD_PROJECTS_URL}/${cd_install_python_modules__repository}"
|
||||
echo "\
|
||||
${cd_install_python_modules__url}
|
||||
↓"
|
||||
|
@ -609,13 +609,13 @@ ${cd_install_python_modules__root}\
|
|||
echo "\
|
||||
${cd_install_python_modules__path}
|
||||
↓
|
||||
${CD_PYTHON_PACKAGES}"
|
||||
${CIDD_PYTHON_PACKAGES}"
|
||||
cp --recursive \
|
||||
"${cd_install_python_modules__path}" "${CD_PYTHON_PACKAGES}" \
|
||||
"${cd_install_python_modules__path}" "${CIDD_PYTHON_PACKAGES}" \
|
||||
|| exit
|
||||
done
|
||||
cd_split
|
||||
cd_ls "${CD_PYTHON_PACKAGES}"
|
||||
cd_ls "${CIDD_PYTHON_PACKAGES}"
|
||||
cd_split
|
||||
cd_rm "${cd_install_python_modules__root}"
|
||||
}
|
||||
|
@ -625,23 +625,23 @@ cd_write_python_module () {
|
|||
for cd_write_python_module__variable \
|
||||
in OPEN DOWN VERT SPLT __UP SHUT OS_ID OS_VERSION ; do
|
||||
cd_write_python_module__value="\
|
||||
$(cd_echo "CD_${cd_write_python_module__variable}")"
|
||||
$(cd_echo "CIDD_${cd_write_python_module__variable}")"
|
||||
cd_write_python_module__text="${cd_write_python_module__text}\
|
||||
${cd_write_python_module__value}
|
||||
"
|
||||
done
|
||||
cd_write "${CD_PYTHON_PACKAGES}/env.py" "${cd_write_python_module__text}\
|
||||
CD_STEP = $((CD_STEP+1))
|
||||
cd_write "${CIDD_PYTHON_PACKAGES}/env.py" "${cd_write_python_module__text}\
|
||||
CIDD_STEP = $((CIDD_STEP+1))
|
||||
"
|
||||
}
|
||||
|
||||
cd_switch_to_python () {
|
||||
cd_step "Switch to Python"
|
||||
echo "\
|
||||
${CD_PATH}
|
||||
${CIDD_PATH}
|
||||
↓
|
||||
${CD_PYTHON_PACKAGES}/${CD_GIT_CHILD}"
|
||||
"${CD_PYTHON_ALIAS}" -m "${CD_GIT_CHILD}" "${@}"
|
||||
${CIDD_PYTHON_PACKAGES}/${CIDD_GIT_CHILD}"
|
||||
"${CIDD_PYTHON_ALIAS}" -m "${CIDD_GIT_CHILD}" "${@}"
|
||||
}
|
||||
|
||||
# functions
|
||||
|
@ -666,14 +666,14 @@ cd_echo () {
|
|||
|
||||
cd_error_ci () {
|
||||
echo "× CI: ${*}"
|
||||
exit "${CD_ERROR_CI}"
|
||||
exit "${CIDD_ERROR_CI}"
|
||||
}
|
||||
|
||||
cd_error_os () {
|
||||
cd_error_os__variable="${1}"
|
||||
printf "× OS: "
|
||||
cd_echo "${cd_error_os__variable}"
|
||||
exit "${CD_ERROR_OS}"
|
||||
exit "${CIDD_ERROR_OS}"
|
||||
}
|
||||
|
||||
cd_grep_os () {
|
||||
|
@ -688,15 +688,15 @@ cd_grep_os () {
|
|||
cd_install_package () {
|
||||
cd_install_package__name="${1}"
|
||||
if [ -n "${cd_install_package__name}" ] ; then
|
||||
${CD_PM_INSTALL} "${cd_install_package__name}" || exit
|
||||
${CIDD_PM_INSTALL} "${cd_install_package__name}" || exit
|
||||
fi
|
||||
}
|
||||
|
||||
cd_ln_python () {
|
||||
cd_ln_python__command="${1}"
|
||||
if [ -n "${cd_ln_python__command}" ] ; then
|
||||
echo "→ ${CD_PYTHON_ALIAS} → ${cd_ln_python__command}"
|
||||
ln -f -s "${cd_ln_python__command}" "/usr/bin/${CD_PYTHON_ALIAS}" \
|
||||
echo "→ ${CIDD_PYTHON_ALIAS} → ${cd_ln_python__command}"
|
||||
ln -f -s "${cd_ln_python__command}" "/usr/bin/${CIDD_PYTHON_ALIAS}" \
|
||||
|| exit
|
||||
fi
|
||||
}
|
||||
|
@ -719,7 +719,7 @@ cd_mkdir () {
|
|||
}
|
||||
|
||||
cd_open () {
|
||||
echo "${CD_OPEN}${*}"
|
||||
echo "${CIDD_OPEN}${*}"
|
||||
}
|
||||
|
||||
cd_openssl () {
|
||||
|
@ -754,19 +754,19 @@ cd_sed () {
|
|||
}
|
||||
|
||||
cd_shut () {
|
||||
echo "${CD_SHUT}${*}"
|
||||
echo "${CIDD_SHUT}${*}"
|
||||
}
|
||||
|
||||
cd_split () {
|
||||
echo "${CD_SPLT}"
|
||||
echo "${CIDD_SPLT}"
|
||||
}
|
||||
|
||||
cd_step () {
|
||||
CD_STEP=$((CD_STEP+1))
|
||||
CIDD_STEP=$((CIDD_STEP+1))
|
||||
echo "\
|
||||
${CD_DOWN}
|
||||
${CD_VERT} ${CD_STEP} ${*}
|
||||
${CD___UP}"
|
||||
${CIDD_DOWN}
|
||||
${CIDD_VERT} ${CIDD_STEP} ${*}
|
||||
${CIDD___UP}"
|
||||
}
|
||||
|
||||
cd_write () {
|
||||
|
@ -782,36 +782,36 @@ cd_write () {
|
|||
|
||||
# constants
|
||||
|
||||
CD_BOX_DOWN="╭"
|
||||
CD_BOX_LEFT="╴"
|
||||
CD_BOX_RIGHT="╶"
|
||||
CD_BOX_UP="╰"
|
||||
CD_BOX_VERTICAL="│"
|
||||
CIDD_BOX_DOWN="╭"
|
||||
CIDD_BOX_LEFT="╴"
|
||||
CIDD_BOX_RIGHT="╶"
|
||||
CIDD_BOX_UP="╰"
|
||||
CIDD_BOX_VERTICAL="│"
|
||||
|
||||
CD_ERROR_CI=2
|
||||
CD_ERROR_OS=1
|
||||
CIDD_ERROR_CI=2
|
||||
CIDD_ERROR_OS=1
|
||||
|
||||
CD_OS_ALMA="alma"
|
||||
CD_OS_ALPINE="alpine"
|
||||
CD_OS_ARCH="arch"
|
||||
CD_OS_DEBIAN="debian"
|
||||
CD_OS_FEDORA="fedora"
|
||||
CD_OS_ROCKY="rocky"
|
||||
CD_OS_UBUNTU="ubuntu"
|
||||
CIDD_OS_ALMA="alma"
|
||||
CIDD_OS_ALPINE="alpine"
|
||||
CIDD_OS_ARCH="arch"
|
||||
CIDD_OS_DEBIAN="debian"
|
||||
CIDD_OS_FEDORA="fedora"
|
||||
CIDD_OS_ROCKY="rocky"
|
||||
CIDD_OS_UBUNTU="ubuntu"
|
||||
|
||||
CD_PM_APK="apk"
|
||||
CD_PM_APT="apt"
|
||||
CD_PM_DNF="dnf"
|
||||
CD_PM_PACMAN="pacman"
|
||||
CIDD_PM_APK="apk"
|
||||
CIDD_PM_APT="apt"
|
||||
CIDD_PM_DNF="dnf"
|
||||
CIDD_PM_PACMAN="pacman"
|
||||
|
||||
CD_HORIZONTAL="────╌╌╌╌┄┄┄┄┈┈┈┈"
|
||||
CIDD_HORIZONTAL="────╌╌╌╌┄┄┄┄┈┈┈┈"
|
||||
|
||||
CD_OPEN="${CD_BOX_DOWN}${CD_BOX_LEFT}"
|
||||
CD_DOWN="${CD_BOX_DOWN}${CD_HORIZONTAL}"
|
||||
CD_VERT="${CD_BOX_VERTICAL}"
|
||||
CD_SPLT="${CD_BOX_RIGHT}${CD_HORIZONTAL}"
|
||||
CD___UP="${CD_BOX_UP}${CD_HORIZONTAL}"
|
||||
CD_SHUT="${CD_BOX_UP}${CD_BOX_LEFT}"
|
||||
CIDD_OPEN="${CIDD_BOX_DOWN}${CIDD_BOX_LEFT}"
|
||||
CIDD_DOWN="${CIDD_BOX_DOWN}${CIDD_HORIZONTAL}"
|
||||
CIDD_VERT="${CIDD_BOX_VERTICAL}"
|
||||
CIDD_SPLT="${CIDD_BOX_RIGHT}${CIDD_HORIZONTAL}"
|
||||
CIDD___UP="${CIDD_BOX_UP}${CIDD_HORIZONTAL}"
|
||||
CIDD_SHUT="${CIDD_BOX_UP}${CIDD_BOX_LEFT}"
|
||||
|
||||
# run
|
||||
cd_main "${@}"
|
||||
|
|
Loading…
Reference in a new issue