Compare commits

..

15 commits

Author SHA1 Message Date
26af1a60ff
alias
All checks were successful
/ job (push) Successful in 11m55s
2024-08-26 18:31:23 +02:00
336bee85e2
venv 2024-08-26 18:27:58 +02:00
f4f4d4c5b6
pm 2024-08-26 18:23:53 +02:00
971dce2ada
mv 2024-08-26 18:20:47 +02:00
8246b28512
python 2024-08-26 18:18:41 +02:00
0aabefd385
ln 2024-08-26 18:18:10 +02:00
9214a5f1b3
mkdir 2024-08-26 18:14:26 +02:00
f0965a46f9
mkdir/1 2024-08-26 18:13:39 +02:00
4ed549e0b9
ls/1 2024-08-26 18:12:55 +02:00
843378cdac
os/1 2024-08-26 18:11:10 +02:00
deff26576f
x509/1 2024-08-26 18:09:58 +02:00
d4a9f1c89e
pip 2024-08-26 18:03:06 +02:00
d22986d284
resolv 2024-08-26 17:14:50 +02:00
2995362c3d
python3 2024-08-26 17:07:05 +02:00
5d34df1bfe
switch/path 2024-08-26 17:02:59 +02:00

View file

@ -222,9 +222,8 @@ spcd_error_ci() {
}
spcd_error_os() {
spcd_error_os__variable="${1}"
printf "× OS: "
spcd_os_printenv "${spcd_error_os__variable}"
spcd_os_printenv "${1}"
exit "${_SPCD_ERROR_OS}"
}
@ -257,10 +256,9 @@ spcd_git_url() {
# ╰───────────┴─────────╯
spcd_openssl_x509() {
spcd_openssl_x509__file="${1}"
if [ -f "${spcd_openssl_x509__file}" ]; then
if [ -f "${1}" ]; then
openssl x509 \
-in "${spcd_openssl_x509__file}" \
-in "${1}" \
-noout -text
fi
}
@ -278,20 +276,16 @@ spcd_os_grep() {
}
spcd_os_ls() {
spcd_os_ls__path="${1}"
if [ -n "${spcd_os_ls__path}" ]; then
_spcd_frame_open "${spcd_os_ls__path}"
ls -a -l "${spcd_os_ls__path}"
_spcd_frame_shut "${spcd_os_ls__path}"
if [ -n "${1}" ]; then
_spcd_frame_open "${1}"
ls -a -l "${1}"
_spcd_frame_shut "${1}"
fi
}
spcd_os_mkdir() {
spcd_os_mkdir__path="${1}"
if [ -n "${spcd_os_mkdir__path}" ]; then
echo "${spcd_os_mkdir__path}"
mkdir --parents "${spcd_os_mkdir__path}"
fi
echo "${1}"
mkdir --parents "${1}"
}
spcd_os_printenv() {
@ -335,30 +329,6 @@ spcd_os_write() {
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 │
# ╰───────────┴───────╯
@ -416,9 +386,6 @@ SPCD_PM_DNF="dnf"
SPCD_PM_PACMAN="pacman"
SPCD_PM_ZYPPER="zypper"
SPCD_PYTHON_VENV="/opt/venv"
SPCD_PYTHON_VENV_BINARIES="${SPCD_PYTHON_VENV}/bin"
# ╭───────┬─────────────╮
# │ steps │ environment │
# ╰───────┴─────────────╯
@ -514,9 +481,6 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
#
spcd_os_printenv "SPCD_PROJECT_BRANCH" \
"SPCD_PROJECT_ROOT" "SPCD_PROJECT_PATH" "SPCD_PROJECT_NAME"
# set path
SPCD_PATH="$(realpath "${0}")"
spcd_os_printenv "SPCD_PATH"
# set operating system id
SPCD_OS_ID="$(spcd_os_grep ID)"
case "${SPCD_OS_ID}" in
@ -594,11 +558,6 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
esac
spcd_split
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
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALPINE}")
@ -618,9 +577,9 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
;;
*) ;;
esac
# set package manager variables
spcd_split
spcd_os_printenv "SPCD_PM"
# set package manager variables
case "${SPCD_PM}" in
"${SPCD_PM_DNF}")
SPCD_PM_HTTPS_PATH="/etc/dnf/dnf.conf.d/https.conf"
@ -719,6 +678,10 @@ Acquire::https::Verify-Peer False;
esac
spcd_split
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
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}")
@ -788,6 +751,9 @@ Acquire::https::Verify-Peer False;
;;
*) ;;
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}/lib/${SPCD_PYTHON_COMMAND}/site-packages"
spcd_split
@ -831,6 +797,26 @@ spcd_install_package() {
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() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") apk info "${1}" ;;
@ -856,7 +842,7 @@ spcd_dns() {
nameserver ${spcd_sdr__value}
"
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_step "Switch"
spcd_stp__name="$(basename "${SPCD_GIT_MAIN}")"
spcd_stp__path="$(realpath "${0}")"
echo "\
${SPCD_PATH}
${spcd_stp__path}
${SPCD_PYTHON_ALIAS} / ${spcd_stp__name}"
"${SPCD_PYTHON_ALIAS}" -m "${spcd_stp__name}"