spcd_os_write

This commit is contained in:
Marc Beninca 2024-08-25 23:12:21 +02:00
parent c062e717b7
commit ade538dc14
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -895,14 +895,14 @@ spcd_set_packages_repositories() {
;; ;;
"${SPCD_OS_ALPINE}") "${SPCD_OS_ALPINE}")
spcd_spr__file="/etc/apk/repositories" spcd_spr__file="/etc/apk/repositories"
spcd_write "${spcd_spr__file}" "\ spcd_os_write "${spcd_spr__file}" "\
${SPCD_URL_CHOSEN}/v${SPCD_OS_VERSION}/main ${SPCD_URL_CHOSEN}/v${SPCD_OS_VERSION}/main
${SPCD_URL_CHOSEN}/v${SPCD_OS_VERSION}/community ${SPCD_URL_CHOSEN}/v${SPCD_OS_VERSION}/community
" "
;; ;;
"${SPCD_OS_DEBIAN}") "${SPCD_OS_DEBIAN}")
spcd_spr__file="/etc/apt/sources.list" spcd_spr__file="/etc/apt/sources.list"
spcd_write "${spcd_spr__file}" "\ spcd_os_write "${spcd_spr__file}" "\
deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION} main deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION} main
deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION}-backports main deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION}-backports main
deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION}-updates main deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION}-updates main
@ -935,7 +935,7 @@ deb ${SPCD_URL_CHOSEN}-security ${SPCD_OS_VERSION}-security main
;; ;;
"${SPCD_OS_UBUNTU}") "${SPCD_OS_UBUNTU}")
spcd_spr__file="/etc/apt/sources.list" spcd_spr__file="/etc/apt/sources.list"
spcd_write "${spcd_spr__file}" "\ spcd_os_write "${spcd_spr__file}" "\
deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION} main universe deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION} main universe
deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION}-backports main universe deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION}-backports main universe
deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION}-updates main universe deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION}-updates main universe
@ -948,7 +948,7 @@ deb ${SPCD_URL_CHOSEN} ${SPCD_OS_VERSION}-security main universe
spcd_set_packages_configuration() { spcd_set_packages_configuration() {
spcd_step "Set packages configuration" spcd_step "Set packages configuration"
spcd_write "${SPCD_PM_CONF_PATH}" "${SPCD_PM_CONF_TEXT}" spcd_os_write "${SPCD_PM_CONF_PATH}" "${SPCD_PM_CONF_TEXT}"
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_ARCH}") "${SPCD_OS_ARCH}")
pacman-key --init pacman-key --init
@ -966,7 +966,7 @@ spcd_set_https_verification_off() {
if [ -n "${SPCD_CA}" ] || [ "${SPCD_PM}" = "${SPCD_PM_APT}" ]; then if [ -n "${SPCD_CA}" ] || [ "${SPCD_PM}" = "${SPCD_PM_APT}" ]; then
spcd_step "Set HTTPS verification off" spcd_step "Set HTTPS verification off"
spcd_os_mkdir "$(dirname "${SPCD_PM_HTTPS_PATH}")" spcd_os_mkdir "$(dirname "${SPCD_PM_HTTPS_PATH}")"
spcd_write "${SPCD_PM_HTTPS_PATH}" "${SPCD_PM_HTTPS_TEXT}" spcd_os_write "${SPCD_PM_HTTPS_PATH}" "${SPCD_PM_HTTPS_TEXT}"
fi fi
} }
@ -980,7 +980,7 @@ spcd_set_dns_resolving() {
nameserver ${spcd_sdr__value} nameserver ${spcd_sdr__value}
" "
done done
spcd_write "${SPCD_DNS_FILE}" "${spcd_sdr__text}" spcd_os_write "${SPCD_DNS_FILE}" "${spcd_sdr__text}"
} }
spcd_update_packages_catalog() { spcd_update_packages_catalog() {
@ -1011,7 +1011,7 @@ spcd_write_ca_certificates() {
[ -n "${spcd_wcc__text}" ] || break [ -n "${spcd_wcc__text}" ] || break
spcd_wcc__path="${SPCD_CA_ROOT}/${spcd_wcc__index}.crt" spcd_wcc__path="${SPCD_CA_ROOT}/${spcd_wcc__index}.crt"
spcd_split spcd_split
spcd_write "${spcd_wcc__path}" "${spcd_wcc__text}" spcd_os_write "${spcd_wcc__path}" "${spcd_wcc__text}"
spcd_openssl "${spcd_wcc__path}" spcd_openssl "${spcd_wcc__path}"
done done
} }
@ -1064,7 +1064,7 @@ spcd_install_python() {
*) ;; *) ;;
esac esac
spcd_step "Configure PIP" spcd_step "Configure PIP"
spcd_write "/etc/pip.conf" "\ spcd_os_write "/etc/pip.conf" "\
[global] [global]
index-url = ${SPCD_URL_PYTHON} index-url = ${SPCD_URL_PYTHON}
" "
@ -1178,7 +1178,7 @@ spcd_write_python_module() {
done done
for spcd_wpm__root in \ for spcd_wpm__root in \
"${SPCD_PYTHON_PACKAGES}" "${SPCD_PYTHON_VENV_PACKAGES}"; do "${SPCD_PYTHON_PACKAGES}" "${SPCD_PYTHON_VENV_PACKAGES}"; do
spcd_write "${spcd_wpm__root}/env.py" "${spcd_wpm__text} spcd_os_write "${spcd_wpm__root}/env.py" "${spcd_wpm__text}
SPCD_STEP = $((SPCD_STEP + 1)) SPCD_STEP = $((SPCD_STEP + 1))
" "
done done
@ -1230,14 +1230,15 @@ spcd_sed() {
fi fi
} }
spcd_write() { spcd_os_write() {
spcd_write__file="${1}" spcd_os_write__file="${1}"
spcd_write__text="${2}" spcd_os_write__text="${2}"
if [ -n "${spcd_write__file}" ]; then if [ -n "${spcd_os_write__file}" ]; then
[ -f "${spcd_write__file}" ] && spcd_os_cat "${spcd_write__file}" [ -f "${spcd_os_write__file}" ] &&
echo "${spcd_write__file}" spcd_os_cat "${spcd_os_write__file}"
printf "%s" "${spcd_write__text}" >"${spcd_write__file}" || exit echo "${spcd_os_write__file}"
spcd_os_cat "${spcd_write__file}" printf "%s" "${spcd_os_write__text}" >"${spcd_os_write__file}"
spcd_os_cat "${spcd_os_write__file}"
fi fi
} }