Compare commits
21 commits
31ca2c6117
...
351c9742ef
Author | SHA1 | Date | |
---|---|---|---|
351c9742ef | |||
746f3968f2 | |||
1b71ed0c13 | |||
4974430c36 | |||
25e08725a8 | |||
5c0956c09b | |||
6be00f1655 | |||
417d22dff1 | |||
225a48ee21 | |||
c21b751b72 | |||
a599e31cb1 | |||
05636f94f3 | |||
263643ab20 | |||
1c5b7d138d | |||
014d10bf98 | |||
88f3f036b0 | |||
da24f0ccd8 | |||
2b950472ed | |||
5053dca4fb | |||
b00e8881a4 | |||
6475063e3e |
2 changed files with 129 additions and 121 deletions
|
@ -255,6 +255,7 @@ Handle project workflows in a unified way:
|
||||||
* venv
|
* venv
|
||||||
* create
|
* create
|
||||||
* activate
|
* activate
|
||||||
|
* query package
|
||||||
* relay environment module name
|
* relay environment module name
|
||||||
|
|
||||||
#### Python
|
#### Python
|
||||||
|
|
|
@ -27,9 +27,10 @@ _SPCD_BANNER_VERTICAL="│"
|
||||||
|
|
||||||
_spcd_banner_add() {
|
_spcd_banner_add() {
|
||||||
if [ -n "${1}" ]; then
|
if [ -n "${1}" ]; then
|
||||||
local text=" ${1} "
|
local text length filler
|
||||||
local length=${#text}
|
text=" ${1} "
|
||||||
local filler="$(_spcd_fill "${length}" "${_SPCD_BANNER_HORIZONTAL}")"
|
length=${#text}
|
||||||
|
filler="$(_spcd_fill "${length}" "${_SPCD_BANNER_HORIZONTAL}")"
|
||||||
if [ -n "${__SPCD_BANNER_MIDDLE}" ]; then
|
if [ -n "${__SPCD_BANNER_MIDDLE}" ]; then
|
||||||
_spcd_banner_split
|
_spcd_banner_split
|
||||||
else
|
else
|
||||||
|
@ -299,10 +300,10 @@ spcd_split() {
|
||||||
spcd_step() {
|
spcd_step() {
|
||||||
if [ -n "${1}" ]; then
|
if [ -n "${1}" ]; then
|
||||||
[ -n "${__SPCD_STEP_LEVEL}" ] || __SPCD_STEP_LEVEL=1
|
[ -n "${__SPCD_STEP_LEVEL}" ] || __SPCD_STEP_LEVEL=1
|
||||||
spcd_step__prefix="__SPCD_STEP_${__SPCD_STEP_LEVEL}"
|
local prefix="__SPCD_STEP_${__SPCD_STEP_LEVEL}"
|
||||||
spcd_step__index="${spcd_step__prefix}_INDEX"
|
local index="${prefix}_INDEX"
|
||||||
eval "${spcd_step__index}=\$((${spcd_step__index} + 1))"
|
eval "${index}=\$((${index} + 1))"
|
||||||
eval "${spcd_step__prefix}_LABEL=\"${1}\""
|
eval "${prefix}_LABEL=\"${1}\""
|
||||||
_spcd_banner_render
|
_spcd_banner_render
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -334,12 +335,14 @@ spcd_txt_get() {
|
||||||
|
|
||||||
spcd_txt_locale() {
|
spcd_txt_locale() {
|
||||||
# LANGUAGE
|
# LANGUAGE
|
||||||
|
local name
|
||||||
|
local value
|
||||||
if [ -n "${1}" ]; then
|
if [ -n "${1}" ]; then
|
||||||
spcd_step__locale__value="${1}"
|
value="${1}"
|
||||||
else
|
else
|
||||||
spcd_step__locale__value="${_SPCD_TXT_LOCALE_DEFAULT}"
|
value="${_SPCD_TXT_LOCALE_DEFAULT}"
|
||||||
fi
|
fi
|
||||||
spcd_step__locale__value="${spcd_step__locale__value}.${_SPCD_TXT_CHARSET}"
|
value="${value}.${_SPCD_TXT_CHARSET}"
|
||||||
set -- \
|
set -- \
|
||||||
"LANG" \
|
"LANG" \
|
||||||
"LC_CTYPE" \
|
"LC_CTYPE" \
|
||||||
|
@ -354,8 +357,8 @@ spcd_txt_locale() {
|
||||||
"LC_TELEPHONE" \
|
"LC_TELEPHONE" \
|
||||||
"LC_MEASUREMENT" \
|
"LC_MEASUREMENT" \
|
||||||
"LC_IDENTIFICATION"
|
"LC_IDENTIFICATION"
|
||||||
for spcd_step__locale__name in "${@}"; do
|
for name in "${@}"; do
|
||||||
export "${spcd_step__locale__name}=${spcd_step__locale__value}"
|
export "${name}=${value}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,11 +411,14 @@ spcd_step__environment_defaults_print() {
|
||||||
"URL_PYTHON" \
|
"URL_PYTHON" \
|
||||||
"URL_ROCKY" \
|
"URL_ROCKY" \
|
||||||
"URL_UBUNTU"
|
"URL_UBUNTU"
|
||||||
for spcd_step_edp__item in "${@}"; do
|
local item
|
||||||
spcd_step_edp__name="SPCD_${spcd_step_edp__item}"
|
local name
|
||||||
eval "spcd_step_edp__value=\"\${${spcd_step_edp__name}}\""
|
local value
|
||||||
if [ -n "${spcd_step_edp__value}" ]; then
|
for item in "${@}"; do
|
||||||
spcd_os_printenv "${spcd_step_edp__name}"
|
name="SPCD_${item}"
|
||||||
|
eval "value=\"\${${name}}\""
|
||||||
|
if [ -n "${value}" ]; then
|
||||||
|
spcd_os_printenv "${name}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -750,8 +756,7 @@ ${SPCD_PYTHON_VENV}/lib/${SPCD_PYTHON_COMMAND}/site-packages"
|
||||||
|
|
||||||
spcd_step__environment_list_workspace() {
|
spcd_step__environment_list_workspace() {
|
||||||
spcd_step "List workspace"
|
spcd_step "List workspace"
|
||||||
spcd_lwd__path="$(realpath .)"
|
spcd_os_ls "$(realpath .)"
|
||||||
spcd_os_ls "${spcd_lwd__path}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭──────┬───────────╮
|
# ╭──────┬───────────╮
|
||||||
|
@ -771,11 +776,12 @@ spcd_clean_cache() {
|
||||||
|
|
||||||
spcd_git_clone() {
|
spcd_git_clone() {
|
||||||
if [ -n "${1}" ]; then
|
if [ -n "${1}" ]; then
|
||||||
spcd_gc__name="$(basename "${1}")"
|
local name path url
|
||||||
spcd_gc__path="${SPCD_DL}/${spcd_gc__name}"
|
name="$(basename "${1}")"
|
||||||
spcd_gc__url="$(spcd_git_url "${1}")"
|
path="${SPCD_DL}/${name}"
|
||||||
git clone "${spcd_gc__url}" "${spcd_gc__path}"
|
url="$(spcd_git_url "${1}")"
|
||||||
echo "${spcd_gc__path}"
|
git clone "${url}" "${path}"
|
||||||
|
echo "${path}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,22 +819,23 @@ spcd_install_package() {
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_python_ln() {
|
spcd_python_ln() {
|
||||||
spcd_python_ln__command="${1}"
|
local command="${1}"
|
||||||
if [ -n "${spcd_python_ln__command}" ]; then
|
if [ -n "${command}" ]; then
|
||||||
echo "→ ${SPCD_PYTHON_ALIAS} → ${spcd_python_ln__command}"
|
echo "→ ${SPCD_PYTHON_ALIAS} → ${command}"
|
||||||
ln -f -s "${spcd_python_ln__command}" \
|
ln -f -s "${command}" \
|
||||||
"/usr/bin/${SPCD_PYTHON_ALIAS}"
|
"/usr/bin/${SPCD_PYTHON_ALIAS}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_python_pip() {
|
spcd_python_pip() {
|
||||||
if [ -n "${1}" ]; then
|
if [ -n "${1}" ]; then
|
||||||
spcd_pp__name="$(basename "${1}")"
|
local name path target
|
||||||
spcd_pp__path="$(spcd_git_clone "${1}")"
|
name="$(basename "${1}")"
|
||||||
spcd_pp__path="${spcd_pp__path}/${spcd_pp__name}"
|
path="$(spcd_git_clone "${1}")"
|
||||||
spcd_pp__target="${SPCD_PYTHON_VENV_PACKAGES}"
|
path="${path}/${name}"
|
||||||
cp --recursive "${spcd_pp__path}" "${spcd_pp__target}"
|
target="${SPCD_PYTHON_VENV_PACKAGES}"
|
||||||
echo "${spcd_pp__target}/${spcd_pp__name}"
|
cp --recursive "${path}" "${target}"
|
||||||
|
echo "${target}/${name}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,15 +856,16 @@ spcd_query_package() {
|
||||||
|
|
||||||
spcd_step__dns() {
|
spcd_step__dns() {
|
||||||
spcd_step "DNS"
|
spcd_step "DNS"
|
||||||
|
local index value text
|
||||||
while true; do
|
while true; do
|
||||||
spcd_sdr__index=$((spcd_sdr__index + 1))
|
index=$((index + 1))
|
||||||
eval "spcd_sdr__value=\"\${SPCD_DNS_${spcd_sdr__index}}\""
|
eval "value=\"\${SPCD_DNS_${index}}\""
|
||||||
[ -n "${spcd_sdr__value}" ] || break
|
[ -n "${value}" ] || break
|
||||||
spcd_sdr__text="${spcd_sdr__text}\
|
text="${text}\
|
||||||
nameserver ${spcd_sdr__value}
|
nameserver ${value}
|
||||||
"
|
"
|
||||||
done
|
done
|
||||||
spcd_os_write "/etc/resolv.conf" "${spcd_sdr__text}"
|
spcd_os_write "/etc/resolv.conf" "${text}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭──────┬──────────╮
|
# ╭──────┬──────────╮
|
||||||
|
@ -866,6 +874,7 @@ nameserver ${spcd_sdr__value}
|
||||||
|
|
||||||
spcd_step__packages_set_repositories() {
|
spcd_step__packages_set_repositories() {
|
||||||
spcd_step "Set repositories"
|
spcd_step "Set repositories"
|
||||||
|
local file
|
||||||
case "${SPCD_OS_ID}" in
|
case "${SPCD_OS_ID}" in
|
||||||
"${SPCD_OS_ALMA}")
|
"${SPCD_OS_ALMA}")
|
||||||
case "${SPCD_OS_VERSION}" in
|
case "${SPCD_OS_VERSION}" in
|
||||||
|
@ -897,8 +906,8 @@ spcd_step__packages_set_repositories() {
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
for spcd_spr__file in "${@}"; do
|
for file in "${@}"; do
|
||||||
spcd_os_sed "/etc/yum.repos.d/almalinux${spcd_spr__file}.repo" \
|
spcd_os_sed "/etc/yum.repos.d/almalinux${file}.repo" \
|
||||||
"|^mirrorlist|#mirrorlist|" \
|
"|^mirrorlist|#mirrorlist|" \
|
||||||
"|https://repo.almalinux.org|${SPCD_URL_ALMA}|" \
|
"|https://repo.almalinux.org|${SPCD_URL_ALMA}|" \
|
||||||
"|^# baseurl|baseurl|"
|
"|^# baseurl|baseurl|"
|
||||||
|
@ -928,14 +937,14 @@ deb ${SPCD_URL_DEBIAN}-security ${SPCD_OS_VERSION}-security main
|
||||||
"-updates-testing" \
|
"-updates-testing" \
|
||||||
"-updates" \
|
"-updates" \
|
||||||
""
|
""
|
||||||
for spcd_spr__file in "${@}"; do
|
for file in "${@}"; do
|
||||||
spcd_os_sed "/etc/yum.repos.d/fedora${spcd_spr__file}.repo" \
|
spcd_os_sed "/etc/yum.repos.d/fedora${file}.repo" \
|
||||||
"|^metalink|#metalink|" "\
|
"|^metalink|#metalink|" "\
|
||||||
|http://download.example/pub/fedora/linux|${SPCD_URL_FEDORA}|" \
|
|http://download.example/pub/fedora/linux|${SPCD_URL_FEDORA}|" \
|
||||||
"|^#baseurl|baseurl|"
|
"|^#baseurl|baseurl|"
|
||||||
done
|
done
|
||||||
spcd_os_sed "/etc/yum.repos.d/fedora-cisco-openh264.repo" \
|
spcd_os_sed "/etc/yum.repos.d/fedora-cisco-openh264.repo" \
|
||||||
"|^enabled=1|#enabled=0|"
|
"|^enabled=1|enabled=0|"
|
||||||
;;
|
;;
|
||||||
"${SPCD_OS_OPENSUSE}")
|
"${SPCD_OS_OPENSUSE}")
|
||||||
set -- \
|
set -- \
|
||||||
|
@ -952,12 +961,12 @@ deb ${SPCD_URL_DEBIAN}-security ${SPCD_OS_VERSION}-security main
|
||||||
"source" \
|
"source" \
|
||||||
"update-non-oss" \
|
"update-non-oss" \
|
||||||
"update"
|
"update"
|
||||||
for spcd_spr__file in "${@}"; do
|
for file in "${@}"; do
|
||||||
spcd_os_sed "/etc/zypp/repos.d/repo-${spcd_spr__file}.repo" \
|
spcd_os_sed "/etc/zypp/repos.d/repo-${file}.repo" \
|
||||||
"|http://download.opensuse.org|${SPCD_URL_OPENSUSE}|"
|
"|http://download.opensuse.org|${SPCD_URL_OPENSUSE}|"
|
||||||
done
|
done
|
||||||
spcd_os_sed "/etc/zypp/repos.d/repo-openh264.repo" \
|
spcd_os_sed "/etc/zypp/repos.d/repo-openh264.repo" \
|
||||||
"|^enabled=1|#enabled=0|"
|
"|^enabled=1|enabled=0|"
|
||||||
;;
|
;;
|
||||||
"${SPCD_OS_ROCKY}")
|
"${SPCD_OS_ROCKY}")
|
||||||
case "${SPCD_OS_VERSION}" in
|
case "${SPCD_OS_VERSION}" in
|
||||||
|
@ -986,8 +995,8 @@ deb ${SPCD_URL_DEBIAN}-security ${SPCD_OS_VERSION}-security main
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
for spcd_spr__file in "${@}"; do
|
for file in "${@}"; do
|
||||||
spcd_os_sed "/etc/yum.repos.d/${spcd_spr__file}.repo" \
|
spcd_os_sed "/etc/yum.repos.d/${file}.repo" \
|
||||||
"|^mirrorlist|#mirrorlist|" \
|
"|^mirrorlist|#mirrorlist|" \
|
||||||
"|http://dl.rockylinux.org|${SPCD_URL_ROCKY}|" \
|
"|http://dl.rockylinux.org|${SPCD_URL_ROCKY}|" \
|
||||||
"|^#baseurl|baseurl|"
|
"|^#baseurl|baseurl|"
|
||||||
|
@ -1045,28 +1054,29 @@ Dir::Etc::SourceParts \"\";
|
||||||
|
|
||||||
spcd_step__packages_trust_https() {
|
spcd_step__packages_trust_https() {
|
||||||
spcd_step "Trust HTTPS"
|
spcd_step "Trust HTTPS"
|
||||||
|
local path text
|
||||||
if [ -n "${SPCD_CA_1}" ] || [ "${SPCD_PM}" = "${SPCD_PM_APT}" ]; then
|
if [ -n "${SPCD_CA_1}" ] || [ "${SPCD_PM}" = "${SPCD_PM_APT}" ]; then
|
||||||
spcd_pth__path="$(spcd_https_path)"
|
path="$(spcd_https_path)"
|
||||||
if [ -n "${spcd_pth__path}" ]; then
|
if [ -n "${path}" ]; then
|
||||||
spcd_os_mkdir "$(dirname "${spcd_pth__path}")"
|
spcd_os_mkdir "$(dirname "${path}")"
|
||||||
case "${SPCD_PM}" in
|
case "${SPCD_PM}" in
|
||||||
"${SPCD_PM_APK}") spcd_pth__text="\
|
"${SPCD_PM_APK}") text="\
|
||||||
--no-verify
|
--no-verify
|
||||||
" ;;
|
" ;;
|
||||||
"${SPCD_PM_APT}") spcd_pth__text="\
|
"${SPCD_PM_APT}") text="\
|
||||||
Acquire::https::Verify-Peer False;
|
Acquire::https::Verify-Peer False;
|
||||||
" ;;
|
" ;;
|
||||||
"${SPCD_PM_DNF}") spcd_pth__text="\
|
"${SPCD_PM_DNF}") text="\
|
||||||
sslverify=False
|
sslverify=False
|
||||||
" ;;
|
" ;;
|
||||||
"${SPCD_PM_PACMAN}") spcd_pth__text="\
|
"${SPCD_PM_PACMAN}") text="\
|
||||||
SSLVerify = No
|
SSLVerify = No
|
||||||
" ;;
|
" ;;
|
||||||
"${SPCD_PM_ZYPPER}") ;;
|
"${SPCD_PM_ZYPPER}") ;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
[ -n "${spcd_pth__text}" ] &&
|
[ -n "${text}" ] &&
|
||||||
spcd_os_write "${spcd_pth__path}" "${spcd_pth__text}"
|
spcd_os_write "${path}" "${text}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1102,30 +1112,31 @@ spcd_step__ca_install_package() {
|
||||||
|
|
||||||
spcd_step__ca_write_certificates() {
|
spcd_step__ca_write_certificates() {
|
||||||
spcd_step "Write certificates"
|
spcd_step "Write certificates"
|
||||||
|
local root index text path
|
||||||
case "${SPCD_OS_ID}" in
|
case "${SPCD_OS_ID}" in
|
||||||
"${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}")
|
"${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}")
|
||||||
spcd_wcc__root="/etc/pki/ca-trust/source/anchors"
|
root="/etc/pki/ca-trust/source/anchors"
|
||||||
;;
|
;;
|
||||||
"${SPCD_OS_ALPINE}" | "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}")
|
"${SPCD_OS_ALPINE}" | "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}")
|
||||||
spcd_wcc__root="/usr/local/share/ca-certificates"
|
root="/usr/local/share/ca-certificates"
|
||||||
;;
|
;;
|
||||||
"${SPCD_OS_ARCH}")
|
"${SPCD_OS_ARCH}")
|
||||||
spcd_wcc__root="/etc/ca-certificates/trust-source/anchors"
|
root="/etc/ca-certificates/trust-source/anchors"
|
||||||
;;
|
;;
|
||||||
"${SPCD_OS_OPENSUSE}")
|
"${SPCD_OS_OPENSUSE}")
|
||||||
spcd_wcc__root="/etc/pki/trust/anchors"
|
root="/etc/pki/trust/anchors"
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
spcd_os_mkdir "${spcd_wcc__root}"
|
spcd_os_mkdir "${root}"
|
||||||
while true; do
|
while true; do
|
||||||
spcd_wcc__index=$((spcd_wcc__index + 1))
|
index=$((index + 1))
|
||||||
eval "spcd_wcc__text=\"\${SPCD_CA_${spcd_wcc__index}}\""
|
eval "text=\"\${SPCD_CA_${index}}\""
|
||||||
[ -n "${spcd_wcc__text}" ] || break
|
[ -n "${text}" ] || break
|
||||||
spcd_wcc__path="${spcd_wcc__root}/${spcd_wcc__index}.crt"
|
path="${root}/${index}.crt"
|
||||||
spcd_split
|
spcd_split
|
||||||
spcd_os_write "${spcd_wcc__path}" "${spcd_wcc__text}"
|
spcd_os_write "${path}" "${text}"
|
||||||
spcd_openssl_x509 "${spcd_wcc__path}"
|
spcd_openssl_x509 "${path}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1154,9 +1165,10 @@ spcd_step__ca_update_certificates() {
|
||||||
|
|
||||||
spcd_step__packages_verify_https() {
|
spcd_step__packages_verify_https() {
|
||||||
spcd_step "Verify HTTPS"
|
spcd_step "Verify HTTPS"
|
||||||
spcd_pvh__path="$(spcd_https_path)"
|
local path
|
||||||
if [ -n "${spcd_pvh__path}" ]; then
|
path="$(spcd_https_path)"
|
||||||
spcd_os_rm "${spcd_pvh__path}"
|
if [ -n "${path}" ]; then
|
||||||
|
spcd_os_rm "${path}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,21 +1180,20 @@ spcd_step__packages_install_locales() {
|
||||||
case "${SPCD_PM}" in
|
case "${SPCD_PM}" in
|
||||||
"${SPCD_PM_APK}") spcd_install_package "musl-locales" ;;
|
"${SPCD_PM_APK}") spcd_install_package "musl-locales" ;;
|
||||||
"${SPCD_PM_APT}")
|
"${SPCD_PM_APT}")
|
||||||
unset spcd_step__pil__text
|
local locale text
|
||||||
for spcd_step__pil__locale in "${@}"; do
|
for locale in "${@}"; do
|
||||||
spcd_step__pil__text="${spcd_step__pil__text}\
|
text="${text}\
|
||||||
${spcd_step__pil__locale}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
|
${locale}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
|
||||||
"
|
"
|
||||||
done
|
done
|
||||||
spcd_os_write "/etc/locale.gen" "${spcd_step__pil__text}"
|
spcd_os_write "/etc/locale.gen" "${text}"
|
||||||
spcd_install_package "locales"
|
spcd_install_package "locales"
|
||||||
;;
|
;;
|
||||||
"${SPCD_PM_DNF}")
|
"${SPCD_PM_DNF}")
|
||||||
for spcd_step__pil__locale in "${@}"; do
|
local locale language
|
||||||
spcd_step__pil__lang="$(
|
for locale in "${@}"; do
|
||||||
echo "${spcd_step__pil__locale}" | cut -d _ -f 1
|
language="$(echo "${locale}" | cut -d _ -f 1)"
|
||||||
)"
|
spcd_install_package "glibc-langpack-${language}"
|
||||||
spcd_install_package "glibc-langpack-${spcd_step__pil__lang}"
|
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
"${SPCD_PM_PACMAN}") spcd_install_package "glibc-locales" ;;
|
"${SPCD_PM_PACMAN}") spcd_install_package "glibc-locales" ;;
|
||||||
|
@ -1247,31 +1258,33 @@ index-url = ${SPCD_URL_PYTHON}/simple
|
||||||
|
|
||||||
spcd_step__python_modules() {
|
spcd_step__python_modules() {
|
||||||
spcd_step_in "Modules"
|
spcd_step_in "Modules"
|
||||||
spcd_ipm__target="${SPCD_PYTHON_VENV_PACKAGES}"
|
local target path script check
|
||||||
|
target="${SPCD_PYTHON_VENV_PACKAGES}"
|
||||||
spcd_step "List"
|
spcd_step "List"
|
||||||
spcd_os_ls "${spcd_ipm__target}"
|
spcd_os_ls "${target}"
|
||||||
spcd_step "Main"
|
spcd_step "Main"
|
||||||
spcd_ipm__path="$(spcd_python_pip "${SPCD_GIT_SPCD}")"
|
path="$(spcd_python_pip "${SPCD_GIT_SPCD}")"
|
||||||
# check matching of file and variable
|
# check matching of file and variable
|
||||||
spcd_step "Check"
|
spcd_step "Check"
|
||||||
spcd_ipm__script="${spcd_ipm__path}/bootstrap.sh"
|
script="${path}/bootstrap.sh"
|
||||||
ls -l "${spcd_ipm__script}"
|
ls -l "${script}"
|
||||||
spcd_ipm__check="${spcd_ipm__script}.${SPCD_CMD_SUM}"
|
check="${script}.${SPCD_CMD_SUM}"
|
||||||
"${SPCD_CMD_SUM}" "${spcd_ipm__script}" >"${spcd_ipm__check}"
|
"${SPCD_CMD_SUM}" "${script}" >"${check}"
|
||||||
printf "%s" "${SPCD}" >"${spcd_ipm__script}"
|
printf "%s" "${SPCD}" >"${script}"
|
||||||
ls -l "${spcd_ipm__script}"
|
ls -l "${script}"
|
||||||
dos2unix "${spcd_ipm__script}"
|
dos2unix "${script}"
|
||||||
ls -l "${spcd_ipm__script}"
|
ls -l "${script}"
|
||||||
"${SPCD_CMD_SUM}" -c "${spcd_ipm__check}" || spcd_error_ci "SPCD"
|
"${SPCD_CMD_SUM}" -c "${check}" || spcd_error_ci "SPCD"
|
||||||
spcd_step "Root"
|
spcd_step "Root"
|
||||||
spcd_python_pip "${SPCD_GIT_RWX}"
|
spcd_python_pip "${SPCD_GIT_RWX}"
|
||||||
spcd_step "List"
|
spcd_step "List"
|
||||||
spcd_os_ls "${spcd_ipm__target}"
|
spcd_os_ls "${target}"
|
||||||
spcd_step_out
|
spcd_step_out
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_step__install_packages() {
|
spcd_step__install_packages() {
|
||||||
spcd_step_in "OS packages"
|
spcd_step_in "OS packages"
|
||||||
|
local file
|
||||||
# epel
|
# epel
|
||||||
spcd_step "EPEL"
|
spcd_step "EPEL"
|
||||||
case "${SPCD_OS_ID}" in
|
case "${SPCD_OS_ID}" in
|
||||||
|
@ -1292,16 +1305,16 @@ spcd_step__install_packages() {
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
for spcd_spr__file in "${@}"; do
|
for file in "${@}"; do
|
||||||
spcd_os_sed "/etc/yum.repos.d/epel${spcd_spr__file}.repo" \
|
spcd_os_sed "/etc/yum.repos.d/epel${file}.repo" \
|
||||||
"|^metalink|#metalink|" \
|
"|^metalink|#metalink|" \
|
||||||
"|https://download.example/pub/epel|${SPCD_URL_EPEL}|" \
|
"|https://download.example/pub/epel|${SPCD_URL_EPEL}|" \
|
||||||
"|^#baseurl|baseurl|"
|
"|^#baseurl|baseurl|"
|
||||||
done
|
done
|
||||||
spcd_spr__file="/etc/yum.repos.d/epel-cisco-openh264.repo"
|
file="/etc/yum.repos.d/epel-cisco-openh264.repo"
|
||||||
if [ -f "${spcd_spr__file}" ]; then
|
if [ -f "${spcd_spr__file}" ]; then
|
||||||
spcd_os_sed "${spcd_spr__file}" \
|
spcd_os_sed "${file}" \
|
||||||
"|^enabled=1|#enabled=0|"
|
"|^enabled=1|enabled=0|"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
|
@ -1352,48 +1365,42 @@ spcd_step__install_packages() {
|
||||||
|
|
||||||
spcd_step__python_write_module() {
|
spcd_step__python_write_module() {
|
||||||
spcd_step "Write module"
|
spcd_step "Write module"
|
||||||
for spcd_wpm__variable in \
|
local variable value text index root
|
||||||
|
for variable in \
|
||||||
OS_ID OS_VERSION \
|
OS_ID OS_VERSION \
|
||||||
PROJECT_ROOT PROJECT_PATH PROJECT_NAME \
|
PROJECT_ROOT PROJECT_PATH PROJECT_NAME \
|
||||||
PYTHON_VENV_BINARIES PYTHON_VENV_PACKAGES \
|
PYTHON_VENV_BINARIES PYTHON_VENV_PACKAGES \
|
||||||
OPEN DOWN VERT SPLT __UP SHUT; do
|
OPEN DOWN VERT SPLT __UP SHUT; do
|
||||||
spcd_wpm__value="$(spcd_os_printenv "SPCD_${spcd_wpm__variable}")"
|
value="$(spcd_os_printenv "SPCD_${variable}")"
|
||||||
spcd_wpm__text="${spcd_wpm__text}${spcd_wpm__value}
|
text="${text}${value}
|
||||||
"
|
"
|
||||||
done
|
done
|
||||||
spcd_wpm__index=$((__SPCD_STEP_1_INDEX + 1))
|
index=$((__SPCD_STEP_1_INDEX + 1))
|
||||||
for spcd_wpm__root in \
|
for root in \
|
||||||
"${SPCD_PYTHON_PACKAGES}" "${SPCD_PYTHON_VENV_PACKAGES}"; do
|
"${SPCD_PYTHON_PACKAGES}" "${SPCD_PYTHON_VENV_PACKAGES}"; do
|
||||||
spcd_os_write "${spcd_wpm__root}/env.py" "${spcd_wpm__text}
|
spcd_os_write "${root}/env.py" "${text}
|
||||||
SPCD_STEP = ${spcd_wpm__index}
|
SPCD_STEP = ${index}
|
||||||
"
|
"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_step__python_switch() {
|
spcd_step__python_switch() {
|
||||||
spcd_step "Switch"
|
spcd_step "Switch"
|
||||||
spcd_stp__name="$(basename "${SPCD_GIT_SPCD}")"
|
local name path
|
||||||
spcd_stp__path="$(realpath "${0}")"
|
name="$(basename "${SPCD_GIT_SPCD}")"
|
||||||
|
path="$(realpath "${0}")"
|
||||||
echo "\
|
echo "\
|
||||||
${spcd_stp__path}
|
${path}
|
||||||
↓
|
↓
|
||||||
${SPCD_PYTHON_ALIAS} / ${spcd_stp__name}"
|
${SPCD_PYTHON_ALIAS} / ${name}"
|
||||||
"${SPCD_PYTHON_ALIAS}" -m "${spcd_stp__name}"
|
"${SPCD_PYTHON_ALIAS}" -m "${name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭──────╮
|
# ╭──────╮
|
||||||
# │ main │
|
# │ main │
|
||||||
# ╰──────╯
|
# ╰──────╯
|
||||||
|
|
||||||
spcd_test_local() {
|
|
||||||
local local_variable="KO!"
|
|
||||||
non_local_variable="OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
spcd_main() {
|
spcd_main() {
|
||||||
spcd_test_local
|
|
||||||
echo "local_variable = \"${local_variable}\""
|
|
||||||
echo "non_local_variable = \"${non_local_variable}\""
|
|
||||||
# environment
|
# environment
|
||||||
spcd_txt_locale
|
spcd_txt_locale
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue