-../../../trixie/scripts/lib/constants_seedbox.sh
\ No newline at end of file
+../../../bookworm/scripts/lib/constants_seedbox.sh
\ No newline at end of file
-../../../trixie/scripts/lib/expected_rtorrent_files.sh
\ No newline at end of file
+../../../bookworm/scripts/lib/expected_rtorrent_files.sh
\ No newline at end of file
-../../../trixie/scripts/lib/for_line_in.sh
\ No newline at end of file
+../../../bookworm/scripts/lib/for_line_in.sh
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env dash
+set -e
+ROOT=$(dirname "$0")
+cd "${ROOT}"
+. lib/abort_if_not_user.sh
+. lib/abort_if_offline.sh
+
+abort_if_offline
+abort_if_not_user root
+
+TEMP_DIR=$(mktemp)
+cd "${TEMP_DIR}"
+
+MM_REPO_URL="https://deb.packages.mattermost.com"
+MM_REPO_KEY_URL="https://deb.packages.mattermost.com/pubkey.gpg"
+MM_REPO_KEY_FILENAME=mattermost.gpg
+MM_REPO_KEY_PATH="/etc/apt/trusted.gpg.d/${MM_REPO_KEY_FILENAME}"
+
+curl -sSL ${MM_REPO_KEY_URL} | gpg --dearmor > "${MM_REPO_KEY_FILENAME}"
+mv "${MM_REPO_KEY_FILENAME}" "${MM_REPO_KEY_PATH}"
+
+DEB_RELEASE=stable
+MM_REPO_LIST_FILENAME="mattermost_${RELEASE}.list"
+MM_REPO_LIST_PATH="/etc/apt/sources.list.d/${MM_REPO_LIST_FILENAME}"
+
+echo "deb ${MM_REPO_URL} ${DEB_RELEASE} main" > "${MM_REPO_LIST_FILENAME}"
+mv "${MM_REPO_LIST_FILENAME}" "${MM_REPO_LIST_PATH}"
+
+apt update
+apt install mattermost-desktop
+
+cd -
+rmdir "${TEMP_DIR}"
+++ /dev/null
-../../../../../scripts/lib/abort_if_exists.sh
\ No newline at end of file
--- /dev/null
+. lib/abort.sh
+
+abort_if_exists() {
+ if [ -e "$1" ]; then
+ abort "Aborting since $1 already exists."
+ fi
+}
--- /dev/null
+../../../../../scripts/lib/abort_if_not_user.sh
\ No newline at end of file
+++ /dev/null
-../../../../../scripts/lib/constants_borg.sh
\ No newline at end of file
--- /dev/null
+NAME_BORGAPP=borgplom
+PATH_BORG_CONF="${HOME}/.config/borg"
+++ /dev/null
-../../../../../scripts/lib/copy_and_unmount_secrets.sh
\ No newline at end of file
--- /dev/null
+. lib/constants_secrets.sh # PATH_REL_SECRETS, PATH_SECRETS
+
+copy_and_unmount_secrets() {
+prefixed_msg_init copy_and_unmount_secrets
+
+prefixed_msg "Copying over ${PATH_REL_SECRETS}."
+if [ "$1" = "out" ]; then
+ cp -a "${PATH_SECRETS}" "${PATH_MOUNTED_SECRETS}"
+elif [ "$1" = "in" ]; then
+ cp -a "${PATH_MOUNTED_SECRETS}" "${PATH_SECRETS}"
+else
+ abort "Illegal argument to unmount_secrets."
+fi
+pumount "${SECRETS_DEV}"
+prefixed_msg "You can remove device ${SECRETS_DEV} now."
+
+prefixed_msg_exit
+}
+++ /dev/null
-../../../../../scripts/lib/mount_secrets.sh
\ No newline at end of file
--- /dev/null
+. lib/constants_secrets.sh # PATH_MEDIA, PATH_REL_SECRETS
+. lib/expect_n_args.sh
+. lib/get_passphrase.sh
+. lib/path_tmp_timestamped.sh
+. lib/prefixed_msg.sh
+. lib/retry_until.sh
+
+mount_secrets() {
+prefixed_msg_init mount_secrets
+
+SECRETS_DEV=$1
+if [ -z "${SECRETS_DEV}" ]; then
+ abort "Aborting due to empty device argument."
+fi
+PATH_MOUNTED_SECRETS="${PATH_MEDIA}/${SECRETS_DEV}/${PATH_REL_SECRETS}"
+PATH_DEV="/dev/${SECRETS_DEV}"
+PATH_PMOUNT_ERR="$(path_tmp_timestamped 'err_mount')"
+prefixed_msg "Put secrets drive into slot for ${PATH_DEV}."
+while [ ! -e "${PATH_DEV}" ]; do
+ sleep 0.1
+done
+_ON_LOOP_START='prefixed_msg_no_nl "Passphrase: "; PASSPHRASE=$(get_passphrase); echo ""'
+_TO_TEST='echo "${PASSPHRASE}" | pmount "${PATH_DEV}" 2>&1'
+_ON_FAIL='prefixed_msg "Aborting due to pmount error:"'
+retry_until 100 "${_ON_LOOP_START}" "${_TO_TEST}" "${_ON_FAIL}"
+prefixed_msg "${_OUTPUT}"
+
+prefixed_msg_exit
+}
+++ /dev/null
-../../../../../scripts/lib/retry_until.sh
\ No newline at end of file
--- /dev/null
+retry_until() {
+ _CODE_FOR_CONTINUE="$1"
+ _ON_LOOP_START="$2"
+ _TO_TEST="$3"
+ _ON_FAIL="$4"
+ _ON_LOOP_END="$5"
+ _OUTPUT_MODE="$6"
+ while true; do
+ eval "${_ON_LOOP_START}"
+ set +e
+ if [ "${_OUTPUT_MODE}" = 'direct' ]; then
+ eval ${_TO_TEST}
+ _RESULT=$?
+ else
+ _OUTPUT="$(eval ${_TO_TEST})"
+ _RESULT=$?
+ fi
+ set -e
+ if [ "${_RESULT}" = '0' ]; then
+ break
+ elif [ "${_RESULT}" != "${_CODE_FOR_CONTINUE}" ]; then
+ eval "${_ON_FAIL}"
+ abort
+ fi
+ eval "${_ON_LOOP_END}"
+ done
+}
# config script
d-i pkgsel/include string git,ca-certificates
-d-i preseed/late_command string apt-install git vim ack && in-target git clone https://plomlompom.com/repos/clone/config /root/config && echo -e '#!/usr/bin/env dash\nset -e\nif [ -z "$1" ]; then\n echo "need user password as argument"\n exit 1\nfi\nconfig/trixie/scripts/setup_desktop.sh t490s "$1"\nconfig/trixie/scripts/setup_secrets.sh sda' > /target/root/run.sh && chmod a+x /target/root/run.sh
+d-i preseed/late_command string apt-install git vim ack && in-target git clone https://plomlompom.com/repos/clone/config /root/config && echo -e '#!/usr/bin/env dash\nset -e\nif [ -z "$1" ]; then\n echo "need user password as argument"\n exit 1\nfi\nconfig/trixie/scripts/setup_desktop.sh t490s "$1"' > /target/root/run.sh && chmod a+x /target/root/run.sh
+++ /dev/null
-#!/bin/sh
-set -e
-cd $(dirname "$0")
-. lib/abort.sh
-# . lib/abort_if_exists
-. lib/abort_if_not_user.sh
-. lib/abort_if_offline.sh
-# . lib/constants_secrets # PATH_SECRETS, PATH_SECRETS_KDBX, PATH_SECRETS_SSH, PATH_SECRETS_BORGKEYS, PATH_USER_KDBX
-. lib/constants_ssh.sh # PATH_USER_SSH
-. lib/constants_user.sh # USERNAME
-# . lib/constants_borg # NAME_BORGAPP
-# . lib/copy_and_unmount_secrets
-. lib/expect_n_args.sh
-# . lib/mount_secrets
-. lib/prefixed_msg.sh
-# . lib/retry_until
-. lib/trapp.sh
-
-prefixed_msg_init
-PATH_REPOS="${HOME}/repos"
-REPOS_SITE_DOMAIN=plomlompom.com
-REMOTE_PATH_REPOS=/var/repos
-
-expect_n_args 1 1 "(device name, e.g. 'sda')" $@
-abort_if_offline
-abort_if_not_user "${USERNAME}"
-abort_if_exists "${PATH_SECRETS}"
-abort_if_exists "${PATH_USER_SSH}"
-abort_if_exists "${PATH_REPOS}"
-
-mount_secrets "$1" # sets PASSPHRASE
-copy_and_unmount_secrets 'in'
-export BORG_PASSPHRASE="${PASSPHRASE}"
-
-prefixed_msg 'Copying passwords DB …'
-cp -a "${PATH_SECRETS_KDBX}" "${PATH_USER_KDBX}"
-
-prefixed_msg 'Setting up ~/.ssh …'
-cp -a "${PATH_SECRETS_SSH}" "${PATH_USER_SSH}"
-stty -echo
-trapp stty echo
-retry_until 1 'echo ""' 'ssh-add -q' 'prefixed_msg "Aborting due to ssh-add error"'
-stty echo
-trapp
-
-printf '\n'
-prefixed_msg 'Setting up ~/repos …'
-REPOS_SITE_LOGIN="${USERNAME}@${REPOS_SITE_DOMAIN}"
-mkdir "${PATH_REPOS}"
-cd "${PATH_REPOS}"
-ssh ${REPOS_SITE_LOGIN} "cd ${REMOTE_PATH_REPOS} && ls -1" | while read REPO_NAME; do
- prefixed_msg "Cloning ${REPO_NAME} …"
- git clone --quiet --recurse "${REPOS_SITE_LOGIN}:${REMOTE_PATH_REPOS}/${REPO_NAME}"
-done
-cd - > /dev/null
-
-prefixed_msg 'Setting up borg and pull in ~/org …'
-cd "${PATH_SECRETS_BORGKEYS}"
-ls -1 | while read _FILENAME; do
- "${NAME_BORGAPP}" claim "${_FILENAME}"
-done
-cd -
-retry_until 2 '' "${NAME_BORGAPP} orgpull" "prefixed_msg 'Aborting due to unexpected ${NAME_BORGAPP} error.'" '' 'direct'
-prefixed_msg "${_OUTPUT}"
-
-prefixed_msg_exit
+++ /dev/null
-. lib/abort.sh
-
-abort_if_exists() {
- if [ -e "$1" ]; then
- abort "Aborting since $1 already exists."
- fi
-}
+++ /dev/null
-../../../bookworm/scripts/lib/check_finished_marker.sh
\ No newline at end of file
+++ /dev/null
-NAME_BORGAPP=borgplom
-PATH_BORG_CONF="${HOME}/.config/borg"
+++ /dev/null
-../../../bookworm/scripts/lib/constants_finished.sh
\ No newline at end of file
+++ /dev/null
-../../../bookworm/scripts/lib/constants_seedbox.sh
\ No newline at end of file
+++ /dev/null
-. lib/constants_secrets.sh # PATH_REL_SECRETS, PATH_SECRETS
-
-copy_and_unmount_secrets() {
-prefixed_msg_init copy_and_unmount_secrets
-
-prefixed_msg "Copying over ${PATH_REL_SECRETS}."
-if [ "$1" = "out" ]; then
- cp -a "${PATH_SECRETS}" "${PATH_MOUNTED_SECRETS}"
-elif [ "$1" = "in" ]; then
- cp -a "${PATH_MOUNTED_SECRETS}" "${PATH_SECRETS}"
-else
- abort "Illegal argument to unmount_secrets."
-fi
-pumount "${SECRETS_DEV}"
-prefixed_msg "You can remove device ${SECRETS_DEV} now."
-
-prefixed_msg_exit
-}
+++ /dev/null
-../../../bookworm/scripts/lib/expected_rtorrent_files.sh
\ No newline at end of file
+++ /dev/null
-../../../bookworm/scripts/lib/for_line_in.sh
\ No newline at end of file
+++ /dev/null
-../../../bookworm/scripts/lib/install_tags.sh
\ No newline at end of file
+++ /dev/null
-. lib/constants_secrets.sh # PATH_MEDIA, PATH_REL_SECRETS
-. lib/expect_n_args.sh
-. lib/get_passphrase.sh
-. lib/path_tmp_timestamped.sh
-. lib/prefixed_msg.sh
-. lib/retry_until.sh
-
-mount_secrets() {
-prefixed_msg_init mount_secrets
-
-SECRETS_DEV=$1
-if [ -z "${SECRETS_DEV}" ]; then
- abort "Aborting due to empty device argument."
-fi
-PATH_MOUNTED_SECRETS="${PATH_MEDIA}/${SECRETS_DEV}/${PATH_REL_SECRETS}"
-PATH_DEV="/dev/${SECRETS_DEV}"
-PATH_PMOUNT_ERR="$(path_tmp_timestamped 'err_mount')"
-prefixed_msg "Put secrets drive into slot for ${PATH_DEV}."
-while [ ! -e "${PATH_DEV}" ]; do
- sleep 0.1
-done
-_ON_LOOP_START='prefixed_msg_no_nl "Passphrase: "; PASSPHRASE=$(get_passphrase); echo ""'
-_TO_TEST='echo "${PASSPHRASE}" | pmount "${PATH_DEV}" 2>&1'
-_ON_FAIL='prefixed_msg "Aborting due to pmount error:"'
-retry_until 100 "${_ON_LOOP_START}" "${_TO_TEST}" "${_ON_FAIL}"
-prefixed_msg "${_OUTPUT}"
-
-prefixed_msg_exit
-}
+++ /dev/null
-../../../bookworm/scripts/lib/put_finished_marker.sh
\ No newline at end of file
+++ /dev/null
-retry_until() {
- _CODE_FOR_CONTINUE="$1"
- _ON_LOOP_START="$2"
- _TO_TEST="$3"
- _ON_FAIL="$4"
- _ON_LOOP_END="$5"
- _OUTPUT_MODE="$6"
- while true; do
- eval "${_ON_LOOP_START}"
- set +e
- if [ "${_OUTPUT_MODE}" = 'direct' ]; then
- eval ${_TO_TEST}
- _RESULT=$?
- else
- _OUTPUT="$(eval ${_TO_TEST})"
- _RESULT=$?
- fi
- set -e
- if [ "${_RESULT}" = '0' ]; then
- break
- elif [ "${_RESULT}" != "${_CODE_FOR_CONTINUE}" ]; then
- eval "${_ON_FAIL}"
- abort
- fi
- eval "${_ON_LOOP_END}"
- done
-}
. lib/abort_if_offline.sh
. lib/apt_digested.sh
. lib/constants_etc.sh # PATH_ETC
-. lib/constants_finished.sh # PATH_ROOT_FINISHEDS for put_finished_marker
. lib/constants_user.sh # USERNAME
. lib/core_setup.sh
. lib/expect_n_args.sh
. lib/prefixed_msg.sh
-. lib/put_finished_marker.sh
prefixed_msg_init
prefixed_msg 'starting …'
adduser --quiet "${USERNAME}" plugdev # so user may use pmount
echo "${USERNAME}:${USER_PW}" | chpasswd
-put_finished_marker 'setup_desktop'
prefixed_msg_exit
+++ /dev/null
-#!/bin/sh
-set -e
-ROOT=$(dirname "$0")
-cd "${ROOT}"
-
-. lib/abort_if_not_user.sh
-. lib/check_finished_marker.sh
-. lib/constants_repopaths.sh # PATH_CONF, PATH_SCRIPTS
-. lib/constants_user.sh # USERNAME
-. lib/path_tmp_timestamped.sh
-. lib/prefixed_msg.sh
-
-prefixed_msg_init
-
-check_finished_marker 'setup_desktop'
-abort_if_not_user root
-PATH_REL_SETUP_SECRETS_USER="$(basename ${PATH_CONF})/$(basename ${PATH_SCRIPTS})/_setup_secrets_user.sh"
-PATH_REPO="$(dirname ${PATH_CONF})"
-PATH_TMP_REPO="$(path_tmp_timestamped configrepo)"
-
-prefixed_msg "Setting up config repo copy for user at ${PATH_TMP_REPO} …"
-cp -a "${PATH_REPO}" "${PATH_TMP_REPO}"
-chown -R "${USERNAME}:${USERNAME}" "${PATH_TMP_REPO}"
-su -l "${USERNAME}" -c "/bin/sh ${PATH_TMP_REPO}/${PATH_REL_SETUP_SECRETS_USER} $1"
-rm -rf "${PATH_TMP_REPO}"
-
-prefixed_msg_exit