home
·
contact
·
privacy
projects
/
config
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d06982a
)
Minor code improvements.
master
author
Christian Heller
<c.heller@plomlompom.de>
Sat, 22 Mar 2025 04:17:41 +0000
(
05:17
+0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Sat, 22 Mar 2025 04:17:41 +0000
(
05:17
+0100)
testing/home/desktop/.local/bin/borgplom
patch
|
blob
|
history
testing/home/desktop/.local/bin/vol
patch
|
blob
|
history
testing/home/desktop/.nonpath_bins/plomlib.sh.desktop
patch
|
blob
|
history
testing/home/t490s/.nonpath_bins/status.sh
patch
|
blob
|
history
testing/scripts/_config_scripts_lib.sh
patch
|
blob
|
history
testing/scripts/_setup_secrets_user.sh
patch
|
blob
|
history
testing/scripts/setup_desktop.sh
patch
|
blob
|
history
testing/scripts/setup_secrets.sh
patch
|
blob
|
history
diff --git
a/testing/home/desktop/.local/bin/borgplom
b/testing/home/desktop/.local/bin/borgplom
index cd48a0b02a588b3f1a01683b280c055f340e1e2a..53afe44735b24d6b6b144ff9a33cb2c5797d6bb6 100755
(executable)
--- a/
testing/home/desktop/.local/bin/borgplom
+++ b/
testing/home/desktop/.local/bin/borgplom
@@
-1,6
+1,8
@@
#!/bin/sh
set -e
#!/bin/sh
set -e
+
. "${HOME}/.nonpath_bins/plomlib.sh"
. "${HOME}/.nonpath_bins/plomlib.sh"
+# for: get_passphrase
PATH_BORGKEYS="${HOME}/.config/borg/keys"
NAME_REPO=borg
PATH_BORGKEYS="${HOME}/.config/borg/keys"
NAME_REPO=borg
@@
-22,8
+24,7
@@
if [ "$1" = "orgpull" ]; then
REPO="${NAME_SERVER}:${NAME_REPO}"
while true; do
if [ -z "${BORG_PASSPHRASE}" ]; then
REPO="${NAME_SERVER}:${NAME_REPO}"
while true; do
if [ -z "${BORG_PASSPHRASE}" ]; then
- get_passphrase
- export BORG_PASSPHRASE="${PASSPHRASE}"
+ export BORG_PASSPHRASE="$(get_passphrase)"
fi
set +e
ARCHIVES=$(borg list "${REPO}") # separate step so we may fail early on bad passphrase
fi
set +e
ARCHIVES=$(borg list "${REPO}") # separate step so we may fail early on bad passphrase
@@
-35,7
+36,7
@@
if [ "$1" = "orgpull" ]; then
echo "Aborting due to unexpected ${NAME_BORGAPP} error."
exit 1
fi
echo "Aborting due to unexpected ${NAME_BORGAPP} error."
exit 1
fi
- export BORG_PASSPHRASE=
""
+ export BORG_PASSPHRASE=
done
ARCHIVE=$(echo "${ARCHIVES}" | grep "${NAME_ARCHIVE}" | tail -1 | cut -f1 -d' ')
echo "Pulling archive: ${ARCHIVE}"
done
ARCHIVE=$(echo "${ARCHIVES}" | grep "${NAME_ARCHIVE}" | tail -1 | cut -f1 -d' ')
echo "Pulling archive: ${ARCHIVE}"
diff --git
a/testing/home/desktop/.local/bin/vol
b/testing/home/desktop/.local/bin/vol
index 2cb591d413bc654b853930cc78073c9a4353d492..0ae80778298e96db205565517f257bab8171e78e 100755
(executable)
--- a/
testing/home/desktop/.local/bin/vol
+++ b/
testing/home/desktop/.local/bin/vol
@@
-1,8
+1,8
@@
#!/bin/sh
set -e
#!/bin/sh
set -e
-# for: audio_dev_is_mute
. "${HOME}/.nonpath_bins/plomlib.sh"
. "${HOME}/.nonpath_bins/plomlib.sh"
+# for: audio_dev_is_mute
MAX_LOUDNESS=150
MAX_LOUDNESS=150
diff --git
a/testing/home/desktop/.nonpath_bins/plomlib.sh.desktop
b/testing/home/desktop/.nonpath_bins/plomlib.sh.desktop
index 43acf0073bfbe6fcc3a0b8a41c21ee3d44186a0a..9546de2b4442faca18463c4fb498be5585323e7d 100644
(file)
--- a/
testing/home/desktop/.nonpath_bins/plomlib.sh.desktop
+++ b/
testing/home/desktop/.nonpath_bins/plomlib.sh.desktop
@@
-1,9
+1,11
@@
+set -e
+
get_passphrase() {
stty -echo
printf "\nPassphrase: "
read PASSPHRASE
stty echo
get_passphrase() {
stty -echo
printf "\nPassphrase: "
read PASSPHRASE
stty echo
- echo "" # newline so user knows their input return was accepted
+ printf "${PASSPHRASE}"
}
audio_dev_is_mute() {
}
audio_dev_is_mute() {
diff --git
a/testing/home/t490s/.nonpath_bins/status.sh
b/testing/home/t490s/.nonpath_bins/status.sh
index 4aee19e8c281a14fddc5120bffdb9658ed2196ca..b9975590ccfa23ebc07dd4b4cadd84e223282421 100755
(executable)
--- a/
testing/home/t490s/.nonpath_bins/status.sh
+++ b/
testing/home/t490s/.nonpath_bins/status.sh
@@
-1,8
+1,9
@@
#!/bin/sh
# see sway-bar(5) and swaybar-protocol(7)
#!/bin/sh
# see sway-bar(5) and swaybar-protocol(7)
+set -e
-# for: audio_dev_is_mute
. "${HOME}/.nonpath_bins/plomlib.sh"
. "${HOME}/.nonpath_bins/plomlib.sh"
+# for: audio_dev_is_mute
SYSCLASS_DIR=/sys/class
SYSCLASS_DIR=/sys/class
diff --git
a/testing/scripts/_config_scripts_lib.sh
b/testing/scripts/_config_scripts_lib.sh
index c41cf4a6b0664b7281ee118811ed4ab7f1edff73..2594682a1097d8eda65e9194db29451ce8de719e 100644
(file)
--- a/
testing/scripts/_config_scripts_lib.sh
+++ b/
testing/scripts/_config_scripts_lib.sh
@@
-1,15
+1,13
@@
-export DEBIAN_FRONTEND=noninteractive
+# NB: this all assumes we're run from script's parent directory
+PARENT_DIR=$(dirname $(pwd))
+DEBIAN_RELEASE=$(basename ${PARENT_DIR})
+PATH_REPO=$(dirname ${PARENT_DIR})
+PATH_CONF="${PATH_REPO}/${DEBIAN_RELEASE}"
+PATH_CONF_HOME="${PATH_CONF}/home"
USERNAME=plom
PATH_USER_HOME="/home/${USERNAME}"
USERNAME=plom
PATH_USER_HOME="/home/${USERNAME}"
-# NB: this assume we're run from script's parent directory
-cd ../..
-PATH_REPO=$(pwd)
-cd -
-PATH_CONF="${PATH_REPO}/testing"
-PATH_CONF_HOME="${PATH_CONF}/home"
-
expect_min_n_args() {
MIN_ARGS="$1"
EXPLAINER="$2"
expect_min_n_args() {
MIN_ARGS="$1"
EXPLAINER="$2"
diff --git
a/testing/scripts/_setup_secrets_user.sh
b/testing/scripts/_setup_secrets_user.sh
index 44de80948c81d4b17702282babe3261a368d8fdd..5b2b5121a85775a9ae05dbfbcf192ccc7ae5990b 100644
(file)
--- a/
testing/scripts/_setup_secrets_user.sh
+++ b/
testing/scripts/_setup_secrets_user.sh
@@
-1,7
+1,14
@@
set -e
set -e
+cd $(dirname "$0")
-# NB: this assume we're run from script's parent directory
. ./_config_scripts_lib.sh
. ./_config_scripts_lib.sh
+# for:
+# abort_if_exists
+# abort_if_not_user
+# abort_if_offline
+# - PATH_REPO
+# - PATH_USER_HOME
+# - USERNAME
PATH_REPOS="${HOME}/repos"
PATH_BORGKEYS="${HOME}/.config/borg/keys"
PATH_REPOS="${HOME}/repos"
PATH_BORGKEYS="${HOME}/.config/borg/keys"
@@
-40,9
+47,10
@@
REPOS_SITE_LOGIN="${USERNAME}@${REPOS_SITE_DOMAIN}"
ssh-keyscan "${REPOS_SITE_DOMAIN}" >> "${PATH_KNOWN_HOSTS}"
mkdir "${PATH_REPOS}"
cd "${PATH_REPOS}"
ssh-keyscan "${REPOS_SITE_DOMAIN}" >> "${PATH_KNOWN_HOSTS}"
mkdir "${PATH_REPOS}"
cd "${PATH_REPOS}"
-ssh ${REPOS_SITE_LOGIN} "cd $
REMOTE_PATH_REPOS
&& ls -1" | while read REPO_NAME; do
+ssh ${REPOS_SITE_LOGIN} "cd $
{REMOTE_PATH_REPOS}
&& ls -1" | while read REPO_NAME; do
git clone --recurse "${REPOS_SITE_LOGIN}:${REMOTE_PATH_REPOS}/${REPO_NAME}"
done
git clone --recurse "${REPOS_SITE_LOGIN}:${REMOTE_PATH_REPOS}/${REPO_NAME}"
done
+cd -
echo "\nSetting up borg and pull in ~/org"
PATH_TARED_KEYS=borg_keyfiles
echo "\nSetting up borg and pull in ~/org"
PATH_TARED_KEYS=borg_keyfiles
diff --git
a/testing/scripts/setup_desktop.sh
b/testing/scripts/setup_desktop.sh
index 725ce6a3c4c98ae76d4218a4bf339d48a1f8ccee..5405ecd22aacf215b5bb0af0adf23a59840a53b2 100755
(executable)
--- a/
testing/scripts/setup_desktop.sh
+++ b/
testing/scripts/setup_desktop.sh
@@
-1,8
+1,16
@@
#!/bin/sh
set -e
#!/bin/sh
set -e
+cd $(dirname "$0")
-# NB: this assume we're run from script's parent directory
. ./_config_scripts_lib.sh
. ./_config_scripts_lib.sh
+# for:
+# - abort_if_offline
+# - expect_min_n_args
+# - PATH_CONF
+# - PATH_CONF_HOME
+# - PATH_REPO
+# - PATH_USER_HOME
+# - USERNAME
PATH_REL_ETC=etc
PATH_CONF_ETC="${PATH_CONF}/${PATH_REL_ETC}"
PATH_REL_ETC=etc
PATH_CONF_ETC="${PATH_CONF}/${PATH_REL_ETC}"
@@
-13,13
+21,14
@@
PATH_REL_APT_CONF=${PATH_REL_APT}/apt.conf.d
TAG_ALL=all
TAGS_USER='user desktop'
TAG_ALL=all
TAGS_USER='user desktop'
+export DEBIAN_FRONTEND=noninteractive
+
copy_dirtree() {
expect_min_n_args 3 "(source root, target root, tags)" "$@"
SOURCE_ROOT="$1"
TARGET_ROOT="$2"
shift 2
copy_dirtree() {
expect_min_n_args 3 "(source root, target root, tags)" "$@"
SOURCE_ROOT="$1"
TARGET_ROOT="$2"
shift 2
- modules="$@"
- INITIAL_DIRECTORY="$(pwd)"
+ TAGS="$@"
for TAG in ${TAGS}; do
TAG_PATH="${SOURCE_ROOT}/${TAG}"
if [ ! -d "${TAG_PATH}" ]; then
for TAG in ${TAGS}; do
TAG_PATH="${SOURCE_ROOT}/${TAG}"
if [ ! -d "${TAG_PATH}" ]; then
@@
-33,7
+42,7
@@
copy_dirtree() {
mkdir -p "${DIRECTORY}"
cp "${SOURCE_PATH}" "${TARGET_PATH}"
done
mkdir -p "${DIRECTORY}"
cp "${SOURCE_PATH}" "${TARGET_PATH}"
done
- cd
"${INITIAL_DIRECTORY}"
+ cd
-
done
}
done
}
@@
-117,7
+126,7
@@
mark_nonrequireds_auto() {
install_aptmarkeds() {
# Walk through the package names in ../aptmark/ files to ensure the respective
# packages are installed.
install_aptmarkeds() {
# Walk through the package names in ../aptmark/ files to ensure the respective
# packages are installed.
- for TAG in $
{MIN_TAGS} user desktop
; do
+ for TAG in $
1
; do
PATH="${PATH_CONF}/aptmark/${TAG}"
if [ ! -f "${PATH}" ]; then
continue
PATH="${PATH_CONF}/aptmark/${TAG}"
if [ ! -f "${PATH}" ]; then
continue
@@
-155,7
+164,7
@@
abort_if_illegal_system_name "${SYSTEM_NAME}"
SYSTEM_CLASS_NAME="$(get_system_class_for ${SYSTEM_NAME})"
MIN_TAGS="${TAG_ALL} ${SYSTEM_CLASS_NAME} ${SYSTEM_NAME}"
SYSTEM_CLASS_NAME="$(get_system_class_for ${SYSTEM_NAME})"
MIN_TAGS="${TAG_ALL} ${SYSTEM_CLASS_NAME} ${SYSTEM_NAME}"
-echo "\nUpgrading to
testing
."
+echo "\nUpgrading to
${DEBIAN_RELEASE}
."
# For this step only very selectively prepare /etc/ files.
cp "${PATH_CONF_ETC}/${TAG_ALL}/${PATH_REL_APT_CONF}/99_minimize_dependencies" "${PATH_ETC}/${PATH_REL_APT_CONF}/"
upgrade_from_older_release
# For this step only very selectively prepare /etc/ files.
cp "${PATH_CONF_ETC}/${TAG_ALL}/${PATH_REL_APT_CONF}/99_minimize_dependencies" "${PATH_ETC}/${PATH_REL_APT_CONF}/"
upgrade_from_older_release
@@
-168,7
+177,7
@@
if [ "${SYSTEM_NAME}" = "h610m" ]; then
# Hold kernel known to work with nvidia-drivers.
apt-mark hold linux-image-amd64 linux-headers-amd64
fi
# Hold kernel known to work with nvidia-drivers.
apt-mark hold linux-image-amd64 linux-headers-amd64
fi
-install_aptmarkeds
+install_aptmarkeds
${MIN_TAGS} ${TAGS_USER}
apt -y --purge autoremove
# NB: This needs to come before steps potentially overwriting /etc/network/interfaces.
apt -y --purge autoremove
# NB: This needs to come before steps potentially overwriting /etc/network/interfaces.
diff --git
a/testing/scripts/setup_secrets.sh
b/testing/scripts/setup_secrets.sh
index a72f4c50e69f0c85fcc4d8d7c15fea61b6a9d6ad..55cb64af4de2867447127872bf7d577b7327e395 100755
(executable)
--- a/
testing/scripts/setup_secrets.sh
+++ b/
testing/scripts/setup_secrets.sh
@@
-1,9
+1,21
@@
#!/bin/sh
set -e
#!/bin/sh
set -e
+cd $(dirname "$0")
-# NB: this assume we're run from script's parent directory
. ./_config_scripts_lib.sh
. ./_config_scripts_lib.sh
-. "${PATH_CONF_HOME}"/desktop/.nonpath_bins/plomlib.sh
+# for:
+# - abort_if_exists
+# - abort_if_not_user
+# - abort_if_offline
+# - expect_min_n_args
+# - DEBIAN_RELEASE
+# - PATH_CONF_HOME
+# - PATH_REPO
+# - PATH_USER_HOME
+# - USERNAME
+
+. "${PATH_USER_HOME}/.nonpath_bins/plomlib.sh"
+# for: get_passphrase
export PATH_SECRETS=${PATH_USER_HOME}/to_usb
export PATH_SECRETS=${PATH_USER_HOME}/to_usb
@@
-21,7
+33,7
@@
while [ ! -e "${PATH_DEV}" ]; do
sleep 0.1
done
while true; do
sleep 0.1
done
while true; do
- get_passphrase
+ PASSPHRASE=$(get_passphrase)
set +e
echo "${PASSPHRASE}" | pmount "${PATH_DEV}"
RESULT=$?
set +e
echo "${PASSPHRASE}" | pmount "${PATH_DEV}"
RESULT=$?
@@
-43,4
+55,4
@@
if [ "${CONTAINS_TICK}" = "1" ]; then
echo "Cannot pass to user script passphrase with illegal character, aborting."
exit 1
fi
echo "Cannot pass to user script passphrase with illegal character, aborting."
exit 1
fi
-su -l "${USERNAME}" -c "
cd ${PATH_REPO}/testing/scripts && /bin/sh .
/_setup_secrets_user.sh '${PASSPHRASE}'"
+su -l "${USERNAME}" -c "
/bin/sh ./$(basename ${PATH_REPO})/${DEBIAN_RELEASE}/scripts
/_setup_secrets_user.sh '${PASSPHRASE}'"