Compare commits
15 commits
428d6aebf4
...
26af1a60ff
Author | SHA1 | Date | |
---|---|---|---|
26af1a60ff | |||
336bee85e2 | |||
f4f4d4c5b6 | |||
971dce2ada | |||
8246b28512 | |||
0aabefd385 | |||
9214a5f1b3 | |||
f0965a46f9 | |||
4ed549e0b9 | |||
843378cdac | |||
deff26576f | |||
d4a9f1c89e | |||
d22986d284 | |||
2995362c3d | |||
5d34df1bfe |
1 changed files with 40 additions and 53 deletions
|
@ -222,9 +222,8 @@ spcd_error_ci() {
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_error_os() {
|
spcd_error_os() {
|
||||||
spcd_error_os__variable="${1}"
|
|
||||||
printf "× OS: "
|
printf "× OS: "
|
||||||
spcd_os_printenv "${spcd_error_os__variable}"
|
spcd_os_printenv "${1}"
|
||||||
exit "${_SPCD_ERROR_OS}"
|
exit "${_SPCD_ERROR_OS}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,10 +256,9 @@ spcd_git_url() {
|
||||||
# ╰───────────┴─────────╯
|
# ╰───────────┴─────────╯
|
||||||
|
|
||||||
spcd_openssl_x509() {
|
spcd_openssl_x509() {
|
||||||
spcd_openssl_x509__file="${1}"
|
if [ -f "${1}" ]; then
|
||||||
if [ -f "${spcd_openssl_x509__file}" ]; then
|
|
||||||
openssl x509 \
|
openssl x509 \
|
||||||
-in "${spcd_openssl_x509__file}" \
|
-in "${1}" \
|
||||||
-noout -text
|
-noout -text
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -278,20 +276,16 @@ spcd_os_grep() {
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_os_ls() {
|
spcd_os_ls() {
|
||||||
spcd_os_ls__path="${1}"
|
if [ -n "${1}" ]; then
|
||||||
if [ -n "${spcd_os_ls__path}" ]; then
|
_spcd_frame_open "${1}"
|
||||||
_spcd_frame_open "${spcd_os_ls__path}"
|
ls -a -l "${1}"
|
||||||
ls -a -l "${spcd_os_ls__path}"
|
_spcd_frame_shut "${1}"
|
||||||
_spcd_frame_shut "${spcd_os_ls__path}"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_os_mkdir() {
|
spcd_os_mkdir() {
|
||||||
spcd_os_mkdir__path="${1}"
|
echo "→ ${1}"
|
||||||
if [ -n "${spcd_os_mkdir__path}" ]; then
|
mkdir --parents "${1}"
|
||||||
echo "→ ${spcd_os_mkdir__path}"
|
|
||||||
mkdir --parents "${spcd_os_mkdir__path}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_os_printenv() {
|
spcd_os_printenv() {
|
||||||
|
@ -335,30 +329,6 @@ spcd_os_write() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭───────────┬────────╮
|
|
||||||
# │ functions │ python │
|
|
||||||
# ╰───────────┴────────╯
|
|
||||||
|
|
||||||
spcd_python_ln() {
|
|
||||||
spcd_python_ln__command="${1}"
|
|
||||||
if [ -n "${spcd_python_ln__command}" ]; then
|
|
||||||
echo "→ ${SPCD_PYTHON_ALIAS} → ${spcd_python_ln__command}"
|
|
||||||
ln -f -s "${spcd_python_ln__command}" \
|
|
||||||
"/usr/bin/${SPCD_PYTHON_ALIAS}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
spcd_python_pip() {
|
|
||||||
if [ -n "${1}" ]; then
|
|
||||||
spcd_pp__name="$(basename "${1}")"
|
|
||||||
spcd_pp__path="$(spcd_git_clone "${1}")"
|
|
||||||
spcd_pp__path="${spcd_pp__path}/${spcd_pp__name}"
|
|
||||||
spcd_pp__target="${SPCD_PYTHON_VENV_PACKAGES}"
|
|
||||||
cp --recursive "${spcd_pp__path}" "${spcd_pp__target}"
|
|
||||||
echo "${spcd_pp__target}/${spcd_pp__name}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# ╭───────────┬───────╮
|
# ╭───────────┬───────╮
|
||||||
# │ functions │ split │
|
# │ functions │ split │
|
||||||
# ╰───────────┴───────╯
|
# ╰───────────┴───────╯
|
||||||
|
@ -416,9 +386,6 @@ SPCD_PM_DNF="dnf"
|
||||||
SPCD_PM_PACMAN="pacman"
|
SPCD_PM_PACMAN="pacman"
|
||||||
SPCD_PM_ZYPPER="zypper"
|
SPCD_PM_ZYPPER="zypper"
|
||||||
|
|
||||||
SPCD_PYTHON_VENV="/opt/venv"
|
|
||||||
SPCD_PYTHON_VENV_BINARIES="${SPCD_PYTHON_VENV}/bin"
|
|
||||||
|
|
||||||
# ╭───────┬─────────────╮
|
# ╭───────┬─────────────╮
|
||||||
# │ steps │ environment │
|
# │ steps │ environment │
|
||||||
# ╰───────┴─────────────╯
|
# ╰───────┴─────────────╯
|
||||||
|
@ -514,9 +481,6 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
|
||||||
#
|
#
|
||||||
spcd_os_printenv "SPCD_PROJECT_BRANCH" \
|
spcd_os_printenv "SPCD_PROJECT_BRANCH" \
|
||||||
"SPCD_PROJECT_ROOT" "SPCD_PROJECT_PATH" "SPCD_PROJECT_NAME"
|
"SPCD_PROJECT_ROOT" "SPCD_PROJECT_PATH" "SPCD_PROJECT_NAME"
|
||||||
# set path
|
|
||||||
SPCD_PATH="$(realpath "${0}")"
|
|
||||||
spcd_os_printenv "SPCD_PATH"
|
|
||||||
# set operating system id
|
# set operating system id
|
||||||
SPCD_OS_ID="$(spcd_os_grep ID)"
|
SPCD_OS_ID="$(spcd_os_grep ID)"
|
||||||
case "${SPCD_OS_ID}" in
|
case "${SPCD_OS_ID}" in
|
||||||
|
@ -594,11 +558,6 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
|
||||||
esac
|
esac
|
||||||
spcd_split
|
spcd_split
|
||||||
spcd_os_printenv "SPCD_OS_ID" "SPCD_OS_VERSION"
|
spcd_os_printenv "SPCD_OS_ID" "SPCD_OS_VERSION"
|
||||||
# universal
|
|
||||||
SPCD_DNS_FILE="/etc/resolv.conf"
|
|
||||||
SPCD_PYTHON_ALIAS="python3"
|
|
||||||
spcd_split
|
|
||||||
spcd_os_printenv "SPCD_DNS_FILE" "SPCD_PYTHON_ALIAS"
|
|
||||||
# set package manager
|
# set package manager
|
||||||
case "${SPCD_OS_ID}" in
|
case "${SPCD_OS_ID}" in
|
||||||
"${SPCD_OS_ALPINE}")
|
"${SPCD_OS_ALPINE}")
|
||||||
|
@ -618,9 +577,9 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
# set package manager variables
|
|
||||||
spcd_split
|
spcd_split
|
||||||
spcd_os_printenv "SPCD_PM"
|
spcd_os_printenv "SPCD_PM"
|
||||||
|
# set package manager variables
|
||||||
case "${SPCD_PM}" in
|
case "${SPCD_PM}" in
|
||||||
"${SPCD_PM_DNF}")
|
"${SPCD_PM_DNF}")
|
||||||
SPCD_PM_HTTPS_PATH="/etc/dnf/dnf.conf.d/https.conf"
|
SPCD_PM_HTTPS_PATH="/etc/dnf/dnf.conf.d/https.conf"
|
||||||
|
@ -719,6 +678,10 @@ Acquire::https::Verify-Peer False;
|
||||||
esac
|
esac
|
||||||
spcd_split
|
spcd_split
|
||||||
spcd_os_printenv "SPCD_URL_DEFAULT" "SPCD_URL_CHOSEN"
|
spcd_os_printenv "SPCD_URL_DEFAULT" "SPCD_URL_CHOSEN"
|
||||||
|
# set python alias
|
||||||
|
SPCD_PYTHON_ALIAS="python3"
|
||||||
|
spcd_split
|
||||||
|
spcd_os_printenv "SPCD_PYTHON_ALIAS"
|
||||||
# set python command & package
|
# set python command & package
|
||||||
case "${SPCD_OS_ID}" in
|
case "${SPCD_OS_ID}" in
|
||||||
"${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}")
|
"${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}")
|
||||||
|
@ -788,6 +751,9 @@ Acquire::https::Verify-Peer False;
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
# set python virtual environment
|
||||||
|
SPCD_PYTHON_VENV="/opt/venv"
|
||||||
|
SPCD_PYTHON_VENV_BINARIES="${SPCD_PYTHON_VENV}/bin"
|
||||||
SPCD_PYTHON_VENV_PACKAGES="\
|
SPCD_PYTHON_VENV_PACKAGES="\
|
||||||
${SPCD_PYTHON_VENV}/lib/${SPCD_PYTHON_COMMAND}/site-packages"
|
${SPCD_PYTHON_VENV}/lib/${SPCD_PYTHON_COMMAND}/site-packages"
|
||||||
spcd_split
|
spcd_split
|
||||||
|
@ -831,6 +797,26 @@ spcd_install_package() {
|
||||||
spcd_clean_cache
|
spcd_clean_cache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spcd_python_ln() {
|
||||||
|
spcd_python_ln__command="${1}"
|
||||||
|
if [ -n "${spcd_python_ln__command}" ]; then
|
||||||
|
echo "→ ${SPCD_PYTHON_ALIAS} → ${spcd_python_ln__command}"
|
||||||
|
ln -f -s "${spcd_python_ln__command}" \
|
||||||
|
"/usr/bin/${SPCD_PYTHON_ALIAS}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
spcd_python_pip() {
|
||||||
|
if [ -n "${1}" ]; then
|
||||||
|
spcd_pp__name="$(basename "${1}")"
|
||||||
|
spcd_pp__path="$(spcd_git_clone "${1}")"
|
||||||
|
spcd_pp__path="${spcd_pp__path}/${spcd_pp__name}"
|
||||||
|
spcd_pp__target="${SPCD_PYTHON_VENV_PACKAGES}"
|
||||||
|
cp --recursive "${spcd_pp__path}" "${spcd_pp__target}"
|
||||||
|
echo "${spcd_pp__target}/${spcd_pp__name}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
spcd_query_package() {
|
spcd_query_package() {
|
||||||
case "${SPCD_PM}" in
|
case "${SPCD_PM}" in
|
||||||
"${SPCD_PM_APK}") apk info "${1}" ;;
|
"${SPCD_PM_APK}") apk info "${1}" ;;
|
||||||
|
@ -856,7 +842,7 @@ spcd_dns() {
|
||||||
nameserver ${spcd_sdr__value}
|
nameserver ${spcd_sdr__value}
|
||||||
"
|
"
|
||||||
done
|
done
|
||||||
spcd_os_write "${SPCD_DNS_FILE}" "${spcd_sdr__text}"
|
spcd_os_write "/etc/resolv.conf" "${spcd_sdr__text}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭───────┬──────────╮
|
# ╭───────┬──────────╮
|
||||||
|
@ -1223,8 +1209,9 @@ SPCD_STEP = ${spcd_wpm__index}
|
||||||
spcd_python_switch() {
|
spcd_python_switch() {
|
||||||
spcd_step "Switch"
|
spcd_step "Switch"
|
||||||
spcd_stp__name="$(basename "${SPCD_GIT_MAIN}")"
|
spcd_stp__name="$(basename "${SPCD_GIT_MAIN}")"
|
||||||
|
spcd_stp__path="$(realpath "${0}")"
|
||||||
echo "\
|
echo "\
|
||||||
${SPCD_PATH}
|
${spcd_stp__path}
|
||||||
↓
|
↓
|
||||||
${SPCD_PYTHON_ALIAS} / ${spcd_stp__name}"
|
${SPCD_PYTHON_ALIAS} / ${spcd_stp__name}"
|
||||||
"${SPCD_PYTHON_ALIAS}" -m "${spcd_stp__name}"
|
"${SPCD_PYTHON_ALIAS}" -m "${spcd_stp__name}"
|
||||||
|
|
Loading…
Reference in a new issue