Compare commits

..

No commits in common. "ca5de693dc18a80ad8ce26f528d50ab114fe04cf" and "4b7fb8a89f0a9f65e70797bb0a8058726056b315" have entirely different histories.

3 changed files with 237 additions and 277 deletions

View file

@ -282,7 +282,6 @@ Handle project workflows in a unified way:
### Task stack ### Task stack
* automate versions fetching * automate versions fetching
* gource, xvfb, xauth
* handle openh264 repositories * handle openh264 repositories
* tex * tex
* translate to french * translate to french

31
spcd.sh
View file

@ -1,31 +0,0 @@
#! /usr/bin/env sh
gource \
--auto-skip-seconds 0.25 \
--date-format "%Y / %m / %d ⋅ %H : %M : %S" \
--disable-input \
--font-scale 2.5 \
--frameless \
--hide mouse,usernames \
--highlight-dirs \
--key \
--multi-sampling \
--output-framerate 60 \
--output-ppm-stream - \
--seconds-per-day 0.6 \
--stop-at-end \
--viewport "1920x1080" \
| \
ffmpeg \
-codec:v ppm \
-format image2pipe \
-framerate 120 \
-i - \
-codec:v libx264 \
-preset veryslow \
-qp 28 \
-movflags \
+faststart \
-pix_fmt yuv420p \
-y \
spcd.mp4

View file

@ -836,9 +836,220 @@ spcd_python_pip() {
fi fi
} }
# ╭───┬──────────────────────╮ spcd_txt_locale() {
# │ f │ pm = package manager │ local action="${1}"
# ╰───┴──────────────────────╯ local chosen="${2}"
set -- \
"LANG" \
"LC_CTYPE" \
"LC_NUMERIC" \
"LC_TIME" \
"LC_COLLATE" \
"LC_MONETARY" \
"LC_MESSAGES"
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALPINE}") ;;
*)
set -- \
"${@}" \
"LANGUAGE" \
"LC_PAPER" \
"LC_NAME" \
"LC_ADDRESS" \
"LC_TELEPHONE" \
"LC_MEASUREMENT" \
"LC_IDENTIFICATION"
;;
esac
local name
case "${action}" in
"list")
if ! locale; then
for name in "${@}"; do
spcd_os_printenv "${name}"
done
fi
;;
"set")
spcd_txt_locale "list"
spcd_split
local locale long
if [ -n "${chosen}" ]; then
locale="${chosen}"
else
locale="${_SPCD_TXT_LOCALE_DEFAULT}"
fi
long="${locale}.${_SPCD_TXT_CHARSET}"
for name in "${@}"; do
if [ "${name}" != "LANGUAGE" ]; then
export "${name}=${long}"
else
export "${name}=$(spcd_txt_locales language "${chosen}")"
fi
done
spcd_split
spcd_txt_locale "list"
;;
"show")
local regex
for name in "${@}"; do
unset regex
case "${name}" in
# LC_CTYPE
"LC_NUMERIC") regex="^\(decimal\|thousands\|grouping\)" ;;
"LC_TIME") regex="^\(day\|mon\)" ;;
# LC_COLLATE
"LC_MONETARY")
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALPINE}") ;;
*) regex="^\(int_curr\|currency\|mon_\)" ;;
esac
;;
"LC_MESSAGES") regex="^\(yes\|no\)" ;;
"LC_PAPER") regex="^\(height\|width\)" ;;
"LC_NAME") regex="^name_m" ;;
"LC_ADDRESS") regex="^\(country\|lang\)_name" ;;
"LC_TELEPHONE") regex="^int_" ;;
"LC_MEASUREMENT") regex="^measurement=" ;;
"LC_IDENTIFICATION") regex="^\(language\|territory\|title\)" ;;
*) ;;
esac
spcd_split
spcd_os_printenv "${name}"
if [ -n "${regex}" ]; then
locale --keyword-name "${name}" | grep "${regex}"
fi
done
;;
*) ;;
esac
}
spcd_txt_locales() {
local action="${1}"
local chosen="${2}"
set -- \
"${SPCD_TXT_LOCALE_ENGLISH}" \
"${SPCD_TXT_LOCALE_FRENCH}"
local name
case "${action}" in
"install")
spcd_txt_locales "list"
spcd_split
case "${SPCD_PM}" in
"${SPCD_PM_APK}")
spcd_f_pm_install "musl-locales"
export MUSL_LOCPATH="/usr/share/i18n/locales/musl"
;;
"${SPCD_PM_APT}")
local text
for name in "${@}"; do
text="${text}\
${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
"
done
spcd_os_write "/etc/locale.gen" "${text}"
spcd_f_pm_install "locales"
;;
"${SPCD_PM_DNF}")
local language
for name in "${@}"; do
language="$(echo "${name}" | cut -d _ -f 1)"
spcd_f_pm_install "glibc-langpack-${language}"
done
;;
"${SPCD_PM_PACMAN}") spcd_f_pm_install "glibc-locales" ;;
"${SPCD_PM_ZYPPER}") spcd_f_pm_install "glibc-locale" ;;
*) ;;
esac
spcd_split
spcd_txt_locales "list"
;;
"language")
local text
if [ -n "${chosen}" ]; then
text="${chosen}"
fi
for name in "${@}"; do
if [ "${name}" != "${chosen}" ]; then
if [ -n "${text}" ]; then
text="${text}:${name}"
else
text="${name}"
fi
fi
done
;;
"list")
if ! spcd_run locale --all-locales; then
echo "No locales yet!"
fi
;;
*) ;;
esac
}
# ╭───┬────╮
# │ f │ pm │
# ╰───┴────╯
spcd_f_pm_clean() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk cache purge ;;
"${SPCD_PM_APT}") spcd_run apt-get clean ;;
"${SPCD_PM_DNF}") spcd_run dnf clean all ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --clean --noconfirm ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper clean ;;
*) ;;
esac
}
spcd_f_pm_install() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk add "${1}" ;;
"${SPCD_PM_APT}") spcd_run apt-get install --assume-yes "${1}" ;;
"${SPCD_PM_DNF}") spcd_run dnf install --assumeyes "${1}" ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --noconfirm "${1}" ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper --non-interactive install "${1}" ;;
*) ;;
esac
spcd_f_pm_clean
}
spcd_f_pm_query() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") apk info "${1}" ;;
"${SPCD_PM_APT}") dpkg-query --show "${1}" ;;
"${SPCD_PM_DNF}") rpm --query "${1}" ;;
"${SPCD_PM_PACMAN}") pacman --query "${1}" ;;
"${SPCD_PM_ZYPPER}") rpm --query "${1}" ;;
*) ;;
esac
}
spcd_f_pm_update() {
spcd_step "Update"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk update ;;
"${SPCD_PM_APT}") spcd_run apt-get update ;;
"${SPCD_PM_DNF}") spcd_run dnf makecache ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --refresh ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper refresh ;;
*) ;;
esac
}
spcd_f_pm_upgrade() {
spcd_step "Upgrade"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk upgrade ;;
"${SPCD_PM_APT}") spcd_run apt-get upgrade --assume-yes ;;
"${SPCD_PM_DNF}") spcd_run dnf upgrade --assumeyes ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --sysupgrade --noconfirm ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper --non-interactive update ;;
*) ;;
esac
}
# ╭───┬────┬───────╮ # ╭───┬────┬───────╮
# │ f │ pm │ https │ # │ f │ pm │ https │
@ -893,225 +1104,6 @@ spcd_f_pm_https_verify() {
fi fi
} }
# ╭───┬────┬─────╮
# │ f │ pm │ pkg │
# ╰───┴────┴─────╯
spcd_f_pm_pkg_clean() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk cache purge ;;
"${SPCD_PM_APT}") spcd_run apt-get clean ;;
"${SPCD_PM_DNF}") spcd_run dnf clean all ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --clean --noconfirm ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper clean ;;
*) ;;
esac
}
spcd_f_pm_pkg_install() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk add "${1}" ;;
"${SPCD_PM_APT}") spcd_run apt-get install --assume-yes "${1}" ;;
"${SPCD_PM_DNF}") spcd_run dnf install --assumeyes "${1}" ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --noconfirm "${1}" ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper --non-interactive install "${1}" ;;
*) ;;
esac
spcd_f_pm_pkg_clean
}
spcd_f_pm_pkg_query() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") apk info "${1}" ;;
"${SPCD_PM_APT}") dpkg-query --show "${1}" ;;
"${SPCD_PM_DNF}") rpm --query "${1}" ;;
"${SPCD_PM_PACMAN}") pacman --query "${1}" ;;
"${SPCD_PM_ZYPPER}") rpm --query "${1}" ;;
*) ;;
esac
}
spcd_f_pm_pkg_update() {
spcd_step "Update"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk update ;;
"${SPCD_PM_APT}") spcd_run apt-get update ;;
"${SPCD_PM_DNF}") spcd_run dnf makecache ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --refresh ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper refresh ;;
*) ;;
esac
}
spcd_f_pm_pkg_upgrade() {
spcd_step "Upgrade"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk upgrade ;;
"${SPCD_PM_APT}") spcd_run apt-get upgrade --assume-yes ;;
"${SPCD_PM_DNF}") spcd_run dnf upgrade --assumeyes ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --sysupgrade --noconfirm ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper --non-interactive update ;;
*) ;;
esac
}
# ╭───┬─────╮
# │ f │ txt │
# ╰───┴─────╯
spcd_f_txt_locale() {
local action="${1}"
local chosen="${2}"
set -- \
"LANG" \
"LC_CTYPE" \
"LC_NUMERIC" \
"LC_TIME" \
"LC_COLLATE" \
"LC_MONETARY" \
"LC_MESSAGES"
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALPINE}") ;;
*)
set -- \
"${@}" \
"LANGUAGE" \
"LC_PAPER" \
"LC_NAME" \
"LC_ADDRESS" \
"LC_TELEPHONE" \
"LC_MEASUREMENT" \
"LC_IDENTIFICATION"
;;
esac
local name
case "${action}" in
"list")
if ! locale; then
for name in "${@}"; do
spcd_os_printenv "${name}"
done
fi
;;
"set")
spcd_f_txt_locale "list"
spcd_split
local locale long
if [ -n "${chosen}" ]; then
locale="${chosen}"
else
locale="${_SPCD_TXT_LOCALE_DEFAULT}"
fi
long="${locale}.${_SPCD_TXT_CHARSET}"
for name in "${@}"; do
if [ "${name}" != "LANGUAGE" ]; then
export "${name}=${long}"
else
export "${name}=$(spcd_f_txt_locales language "${chosen}")"
fi
done
spcd_split
spcd_f_txt_locale "list"
;;
"show")
local regex
for name in "${@}"; do
unset regex
case "${name}" in
# LC_CTYPE
"LC_NUMERIC") regex="^\(decimal\|thousands\|grouping\)" ;;
"LC_TIME") regex="^\(day\|mon\)" ;;
# LC_COLLATE
"LC_MONETARY")
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALPINE}") ;;
*) regex="^\(int_curr\|currency\|mon_\)" ;;
esac
;;
"LC_MESSAGES") regex="^\(yes\|no\)" ;;
"LC_PAPER") regex="^\(height\|width\)" ;;
"LC_NAME") regex="^name_m" ;;
"LC_ADDRESS") regex="^\(country\|lang\)_name" ;;
"LC_TELEPHONE") regex="^int_" ;;
"LC_MEASUREMENT") regex="^measurement=" ;;
"LC_IDENTIFICATION") regex="^\(language\|territory\|title\)" ;;
*) ;;
esac
spcd_split
spcd_os_printenv "${name}"
if [ -n "${regex}" ]; then
locale --keyword-name "${name}" | grep "${regex}"
fi
done
;;
*) ;;
esac
}
spcd_f_txt_locales() {
local action="${1}"
local chosen="${2}"
set -- \
"${SPCD_TXT_LOCALE_ENGLISH}" \
"${SPCD_TXT_LOCALE_FRENCH}"
local name
case "${action}" in
"install")
spcd_f_txt_locales "list"
spcd_split
case "${SPCD_PM}" in
"${SPCD_PM_APK}")
spcd_f_pm_pkg_install "musl-locales"
export MUSL_LOCPATH="/usr/share/i18n/locales/musl"
;;
"${SPCD_PM_APT}")
local text
for name in "${@}"; do
text="${text}\
${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
"
done
spcd_os_write "/etc/locale.gen" "${text}"
spcd_f_pm_pkg_install "locales"
;;
"${SPCD_PM_DNF}")
local language
for name in "${@}"; do
language="$(echo "${name}" | cut -d _ -f 1)"
spcd_f_pm_pkg_install "glibc-langpack-${language}"
done
;;
"${SPCD_PM_PACMAN}") spcd_f_pm_pkg_install "glibc-locales" ;;
"${SPCD_PM_ZYPPER}") spcd_f_pm_pkg_install "glibc-locale" ;;
*) ;;
esac
spcd_split
spcd_f_txt_locales "list"
;;
"language")
local text
if [ -n "${chosen}" ]; then
text="${chosen}"
fi
for name in "${@}"; do
if [ "${name}" != "${chosen}" ]; then
if [ -n "${text}" ]; then
text="${text}:${name}"
else
text="${name}"
fi
fi
done
;;
"list")
if ! spcd_run locale --all-locales; then
echo "No locales yet!"
fi
;;
*) ;;
esac
}
# ╭───┬─────╮ # ╭───┬─────╮
# │ s │ dns │ # │ s │ dns │
# ╰───┴─────╯ # ╰───┴─────╯
@ -1309,7 +1301,7 @@ Dir::Etc::SourceParts \"\";
spcd_step__packages_install_tools() { spcd_step__packages_install_tools() {
spcd_step "Install tools" spcd_step "Install tools"
case "${SPCD_PM}" in case "${SPCD_PM}" in
"${SPCD_PM_APT}") spcd_f_pm_pkg_install "apt-utils" ;; "${SPCD_PM_APT}") spcd_f_pm_install "apt-utils" ;;
*) ;; *) ;;
esac esac
} }
@ -1317,11 +1309,11 @@ spcd_step__packages_install_tools() {
spcd_step__packages_install_locales() { spcd_step__packages_install_locales() {
spcd_step_in "Locales" spcd_step_in "Locales"
spcd_step "Install" spcd_step "Install"
spcd_f_txt_locales "install" spcd_txt_locales "install"
spcd_step "Set" spcd_step "Set"
spcd_f_txt_locale "set" "${SPCD_TXT_LOCALE}" spcd_txt_locale "set" "${SPCD_TXT_LOCALE}"
spcd_step "Show" spcd_step "Show"
spcd_f_txt_locale "show" spcd_txt_locale "show"
spcd_step_out spcd_step_out
} }
@ -1331,7 +1323,7 @@ spcd_step__packages_install_locales() {
spcd_step__ca_install_package() { spcd_step__ca_install_package() {
spcd_step "Install package" spcd_step "Install package"
spcd_f_pm_pkg_install "ca-certificates" spcd_f_pm_install "ca-certificates"
} }
spcd_step__ca_write_certificates() { spcd_step__ca_write_certificates() {
@ -1381,12 +1373,12 @@ spcd_step__ca_update_certificates() {
spcd_step__packages_install_dos2unix() { spcd_step__packages_install_dos2unix() {
spcd_step "Install dos2unix" spcd_step "Install dos2unix"
spcd_f_pm_pkg_install "dos2unix" spcd_f_pm_install "dos2unix"
} }
spcd_step__packages_install_git() { spcd_step__packages_install_git() {
spcd_step "Install Git" spcd_step "Install Git"
spcd_f_pm_pkg_install "git" spcd_f_pm_install "git"
} }
# ╭───┬────────╮ # ╭───┬────────╮
@ -1395,7 +1387,7 @@ spcd_step__packages_install_git() {
spcd_step__python_install() { spcd_step__python_install() {
spcd_step "Install package" spcd_step "Install package"
spcd_f_pm_pkg_install "${SPCD_PYTHON_PACKAGE}" spcd_f_pm_install "${SPCD_PYTHON_PACKAGE}"
spcd_step "Link alias to command" spcd_step "Link alias to command"
spcd_python_ln "${SPCD_PYTHON_COMMAND}" spcd_python_ln "${SPCD_PYTHON_COMMAND}"
# venv # venv
@ -1403,7 +1395,7 @@ spcd_step__python_install() {
spcd_step "Install package" spcd_step "Install package"
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}")
spcd_f_pm_pkg_install "python3-venv" spcd_f_pm_install "python3-venv"
;; ;;
*) ;; *) ;;
esac esac
@ -1453,7 +1445,7 @@ spcd_step__install_packages() {
spcd_step "EPEL" spcd_step "EPEL"
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}") "${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}")
spcd_f_pm_pkg_install "epel-release" spcd_f_pm_install "epel-release"
case "${SPCD_OS_VERSION}" in case "${SPCD_OS_VERSION}" in
"9") "9")
set -- \ set -- \
@ -1485,32 +1477,32 @@ spcd_step__install_packages() {
esac esac
# graphviz # graphviz
spcd_step "GraphViz" spcd_step "GraphViz"
spcd_f_pm_pkg_install "graphviz" spcd_f_pm_install "graphviz"
# openssh # openssh
spcd_step "OpenSSH" spcd_step "OpenSSH"
case "${SPCD_PM}" in case "${SPCD_PM}" in
"${SPCD_PM_APK}" | "${SPCD_PM_APT}") "${SPCD_PM_APK}" | "${SPCD_PM_APT}")
spcd_f_pm_pkg_install "openssh-client" spcd_f_pm_install "openssh-client"
;; ;;
"${SPCD_PM_DNF}" | "${SPCD_PM_ZYPPER}") "${SPCD_PM_DNF}" | "${SPCD_PM_ZYPPER}")
spcd_f_pm_pkg_install "openssh-clients" spcd_f_pm_install "openssh-clients"
;; ;;
"${SPCD_PM_PACMAN}") spcd_f_pm_pkg_install "openssh" ;; "${SPCD_PM_PACMAN}") spcd_f_pm_install "openssh" ;;
*) ;; *) ;;
esac esac
# plantuml # plantuml
spcd_step "PlantUML" spcd_step "PlantUML"
spcd_f_pm_pkg_install "plantuml" spcd_f_pm_install "plantuml"
# rsync # rsync
spcd_step "Rsync" spcd_step "Rsync"
spcd_f_pm_pkg_install "rsync" spcd_f_pm_install "rsync"
# shell check # shell check
spcd_step "ShellCheck" spcd_step "ShellCheck"
case "${SPCD_PM}" in case "${SPCD_PM}" in
"${SPCD_PM_DNF}" | "${SPCD_PM_ZYPPER}") "${SPCD_PM_DNF}" | "${SPCD_PM_ZYPPER}")
spcd_f_pm_pkg_install "ShellCheck" spcd_f_pm_install "ShellCheck"
;; ;;
*) spcd_f_pm_pkg_install "shellcheck" ;; *) spcd_f_pm_install "shellcheck" ;;
esac esac
# shfmt # shfmt
spcd_step "ShellFormat" spcd_step "ShellFormat"
@ -1519,10 +1511,10 @@ spcd_step__install_packages() {
"${SPCD_OS_DEBIAN}") "${SPCD_OS_DEBIAN}")
case "${SPCD_OS_VERSION}" in case "${SPCD_OS_VERSION}" in
"bullseye") ;; "bullseye") ;;
*) spcd_f_pm_pkg_install "shfmt" ;; *) spcd_f_pm_install "shfmt" ;;
esac esac
;; ;;
*) spcd_f_pm_pkg_install "shfmt" ;; *) spcd_f_pm_install "shfmt" ;;
esac esac
spcd_step_out spcd_step_out
} }
@ -1584,7 +1576,7 @@ spcd_main() {
spcd_step__packages_set_repositories spcd_step__packages_set_repositories
spcd_step__packages_set_configuration spcd_step__packages_set_configuration
spcd_f_pm_https_trust spcd_f_pm_https_trust
spcd_f_pm_pkg_update spcd_f_pm_update
spcd_step__packages_install_tools spcd_step__packages_install_tools
spcd_step__packages_install_locales spcd_step__packages_install_locales
spcd_step_out spcd_step_out
@ -1597,8 +1589,8 @@ spcd_main() {
# packages # packages
spcd_step_in "Packages" spcd_step_in "Packages"
spcd_f_pm_https_verify spcd_f_pm_https_verify
spcd_f_pm_pkg_update spcd_f_pm_update
spcd_f_pm_pkg_upgrade spcd_f_pm_upgrade
spcd_step__packages_install_dos2unix spcd_step__packages_install_dos2unix
spcd_step__packages_install_git spcd_step__packages_install_git
spcd_step_out spcd_step_out