home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 09:34:20 +0000 (11:34 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 09:34:20 +0000 (11:34 +0200)
testing/copy/desktop/home/plom/.local/bin/make_secrets
testing/copy/desktop/home/plom/.plomlib/copy_and_unmount_secrets [new symlink]
testing/copy/desktop/home/plom/.profile.desktop
testing/scripts/_setup_secrets_user.sh
testing/scripts/init_server_access.sh
testing/scripts/lib/copy_and_unmount_secrets [new file with mode: 0644]
testing/scripts/lib/mount_secrets
testing/scripts/setup_desktop.sh

index 344214e90d37af0c2ce1fb93d8a9a051113069a6..c03c315703da6229523cf4a431f180e5321caab1 100755 (executable)
@@ -7,22 +7,28 @@ cd $(dirname "$0")
 . lib/constants_secrets  # PATH_REL_SECRETS, PATH_SECRETS, PATH_SECRETS_BORGKEYS
 . lib/constants_ssh  # PATH_USER_SSH 
 . lib/constants_user  # USERNAME
-. lib/mount_secrets  # mount_secrets, copy_and_unmount_secrets
+. lib/copy_and_unmount_secrets
+. lib/mount_secrets
+. lib/prefixed_msg
+
+prefixed_msg_init
 
 abort_if_exists "${PATH_SECRETS}"
-echo "Collecting new ${PATH_REL_SECRETS}."
+prefixed_msg "Collecting new ${PATH_REL_SECRETS}."
 mkdir "${PATH_SECRETS}"
 "${NAME_BORGAPP}" backup_keys "${PATH_SECRETS_BORGKEYS}"
 cp -a "${PATH_USER_SSH}" "${PATH_SECRETS_SSH}"
-echo "secrets file, last update: $(whoami)/$(hostname) at $(date)" > "${PATH_SECRETS}/info"
+prefixed_msg "secrets file, last update: $(whoami)/$(hostname) at $(date)" > "${PATH_SECRETS}/info"
 
 mount_secrets "$1" # sets PATH_MOUNTED_SECRETS
 SUFFIX_OLD=.old
 PATH_REL_SECRETS_OLD="${PATH_REL_SECRETS}${SUFFIX_OLD}"
 PATH_MOUNTED_SECRETS_OLD="${PATH_MOUNTED_SECRETS}${SUFFIX_OLD}"
 if [ -d "${PATH_MOUNTED_SECRETS}" ]; then
-    echo "Drive already has ${PATH_REL_SECRETS}, moving to ${PATH_REL_SECRETS_OLD}."
+    prefixed_msg "Drive already has ${PATH_REL_SECRETS}, moving to ${PATH_REL_SECRETS_OLD}."
     rm -rf "${PATH_MOUNTED_SECRETS_OLD}"
     mv "${PATH_MOUNTED_SECRETS}" "${PATH_MOUNTED_SECRETS_OLD}"
 fi
 copy_and_unmount_secrets 'out'
+
+prefixed_msg_exit
diff --git a/testing/copy/desktop/home/plom/.plomlib/copy_and_unmount_secrets b/testing/copy/desktop/home/plom/.plomlib/copy_and_unmount_secrets
new file mode 120000 (symlink)
index 0000000..c215403
--- /dev/null
@@ -0,0 +1 @@
+../../../../../scripts/lib/copy_and_unmount_secrets
\ No newline at end of file
index 57a42bde7c66b75c32b801c6a80400244f111e37..47a2d909bb4564cb8d72f411e7cab97a1342daee 100644 (file)
@@ -1,5 +1,5 @@
 # so we don't have to enter our SSH key password all the time
-eval $(ssh-agent) && ssh-add
+eval $(ssh-agent) && ssh-add -q
 
 # zero audio volume (rather than "just" mute)
 vol 0
index a2556b962886e6bfae2c74d918a6dcc2c853786d..3302968f10b94201a61269aca665953188a4406b 100644 (file)
@@ -9,7 +9,8 @@ cd $(dirname "$0")
 . lib/constants_ssh  # PATH_USER_SSH
 . lib/constants_user  # USERNAME
 . lib/constants_borg  # NAME_BORGAPP
-. lib/mount_secrets  # mount_secrets, copy_and_unmount_secrets
+. lib/copy_and_unmount_secrets
+. lib/mount_secrets
 . lib/prefixed_msg
 . lib/retry_until
 . lib/trapp
@@ -43,11 +44,11 @@ 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
-    git clone --recurse "${REPOS_SITE_LOGIN}:${REMOTE_PATH_REPOS}/${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 …'
+prefixed_msg 'Setting up borg and pull in ~/org …'
 cd "${PATH_SECRETS_BORGKEYS}"
 ls -1 | while read _FILENAME; do
     "${NAME_BORGAPP}" claim "${_FILENAME}"
index 94219cedb8c19d99c942dd66400112be9eeb90fe..d20ccabe32e090549c811c3ca568d62b1e3c5d9e 100755 (executable)
@@ -24,7 +24,7 @@ if [ ! -z "${OLD_ROOT_PW}" ]; then
 fi
 
 prefixed_msg "In ${PATH_KNOWN_HOSTS}, removing previous entry for ${SERVER} if found …"
-ssh-keygen -f "${PATH_KNOWN_HOSTS}" -R "${SERVER}" > /dev/null
+ssh-keygen -q -f "${PATH_KNOWN_HOSTS}" -R "${SERVER}"
 
 prefixed_msg 'Scanning server for new key to add to file …'
 PATH_LOG_KEYSCAN_STDERR=$(path_tmp_timestamped)
diff --git a/testing/scripts/lib/copy_and_unmount_secrets b/testing/scripts/lib/copy_and_unmount_secrets
new file mode 100644 (file)
index 0000000..8d203c9
--- /dev/null
@@ -0,0 +1,18 @@
+. lib/constants_secrets # 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
+}
index 8e44c4a69bf6930ac7654883f8baec9360310fde..934b0a698076ff447fe91ebbfb1dd45422a05c2e 100644 (file)
@@ -6,38 +6,25 @@
 . lib/retry_until
 
 mount_secrets() {
-    prefixed_msg_init mount_secrets
-    expect_n_args 1 1 "(device name, e.g. 'sda')" $@
-    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
-}
+prefixed_msg_init mount_secrets
+
+expect_n_args 1 1 "(device name, e.g. 'sda')" $@
+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}"
 
-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
+prefixed_msg_exit
 }
index 8b88503610c373177dc9af0f3449f97cea9a4a2e..7820dff61dab6fe21d73a3aa7fa854da5a129767 100755 (executable)
@@ -13,6 +13,7 @@ cd $(dirname "$0")
 . lib/put_finished_marker
 
 prefixed_msg_init
+prefixed_msg 'starting …'
 
 PATH_NETWORK_INTERFACES="${PATH_ETC}/network/interfaces"
 THINKPAD_NAMES="x220 w530 t490s"
@@ -52,7 +53,7 @@ adopt_wifi_connection() {
     WLAN_SSID=$(get_network_interfaces_last_wpa_value 'ssid')
     WLAN_PSK=$(get_network_interfaces_last_wpa_value 'psk')
     if [ ! -z "${WLAN_SSID}" ]; then
-        prefixed_msg "Found, adding to NetworkManager."
+        prefixed_msg_no_nl "Found, adding to NetworkManager: "
         if [ -z "${WLAN_PSK}" ]; then
             nmcli connection add type wifi wifi.ssid "${WLAN_SSID}"
         else  # NB: assumes last (collected with tail -1) wpa-psk that of last wlan-ssid