Compare commits
No commits in common. "26af1a60ff2911998b7c83b93bd4cdfc4dc74fee" and "428d6aebf414c99250084878a6ed88ea6e59e016" have entirely different histories.
26af1a60ff
...
428d6aebf4
1 changed files with 53 additions and 40 deletions
|
@ -222,8 +222,9 @@ spcd_error_ci() {
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_error_os() {
|
spcd_error_os() {
|
||||||
|
spcd_error_os__variable="${1}"
|
||||||
printf "× OS: "
|
printf "× OS: "
|
||||||
spcd_os_printenv "${1}"
|
spcd_os_printenv "${spcd_error_os__variable}"
|
||||||
exit "${_SPCD_ERROR_OS}"
|
exit "${_SPCD_ERROR_OS}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,9 +257,10 @@ spcd_git_url() {
|
||||||
# ╰───────────┴─────────╯
|
# ╰───────────┴─────────╯
|
||||||
|
|
||||||
spcd_openssl_x509() {
|
spcd_openssl_x509() {
|
||||||
if [ -f "${1}" ]; then
|
spcd_openssl_x509__file="${1}"
|
||||||
|
if [ -f "${spcd_openssl_x509__file}" ]; then
|
||||||
openssl x509 \
|
openssl x509 \
|
||||||
-in "${1}" \
|
-in "${spcd_openssl_x509__file}" \
|
||||||
-noout -text
|
-noout -text
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -276,16 +278,20 @@ spcd_os_grep() {
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_os_ls() {
|
spcd_os_ls() {
|
||||||
if [ -n "${1}" ]; then
|
spcd_os_ls__path="${1}"
|
||||||
_spcd_frame_open "${1}"
|
if [ -n "${spcd_os_ls__path}" ]; then
|
||||||
ls -a -l "${1}"
|
_spcd_frame_open "${spcd_os_ls__path}"
|
||||||
_spcd_frame_shut "${1}"
|
ls -a -l "${spcd_os_ls__path}"
|
||||||
|
_spcd_frame_shut "${spcd_os_ls__path}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_os_mkdir() {
|
spcd_os_mkdir() {
|
||||||
echo "→ ${1}"
|
spcd_os_mkdir__path="${1}"
|
||||||
mkdir --parents "${1}"
|
if [ -n "${spcd_os_mkdir__path}" ]; then
|
||||||
|
echo "→ ${spcd_os_mkdir__path}"
|
||||||
|
mkdir --parents "${spcd_os_mkdir__path}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
spcd_os_printenv() {
|
spcd_os_printenv() {
|
||||||
|
@ -329,6 +335,30 @@ 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 │
|
||||||
# ╰───────────┴───────╯
|
# ╰───────────┴───────╯
|
||||||
|
@ -386,6 +416,9 @@ 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 │
|
||||||
# ╰───────┴─────────────╯
|
# ╰───────┴─────────────╯
|
||||||
|
@ -481,6 +514,9 @@ ${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
|
||||||
|
@ -558,6 +594,11 @@ ${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}")
|
||||||
|
@ -577,9 +618,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"
|
||||||
|
@ -678,10 +719,6 @@ 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}")
|
||||||
|
@ -751,9 +788,6 @@ 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
|
||||||
|
@ -797,26 +831,6 @@ 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}" ;;
|
||||||
|
@ -842,7 +856,7 @@ spcd_dns() {
|
||||||
nameserver ${spcd_sdr__value}
|
nameserver ${spcd_sdr__value}
|
||||||
"
|
"
|
||||||
done
|
done
|
||||||
spcd_os_write "/etc/resolv.conf" "${spcd_sdr__text}"
|
spcd_os_write "${SPCD_DNS_FILE}" "${spcd_sdr__text}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭───────┬──────────╮
|
# ╭───────┬──────────╮
|
||||||
|
@ -1209,9 +1223,8 @@ 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_stp__path}
|
${SPCD_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