From 722d0def8e15b2f96ef5190e09135f6cb2c1b09d Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 6 May 2019 23:32:43 +0200
Subject: [PATCH] Remove secrets script, enhance secrets setup scripting
 elsewhere.

---
 buster/setup_scripts/setup_eeepc.sh      |  2 +-
 buster/setup_scripts/setup_home_eeepc.sh |  8 +++++---
 buster/setup_scripts/setup_secrets.sh    | 26 ------------------------
 3 files changed, 6 insertions(+), 30 deletions(-)
 delete mode 100755 buster/setup_scripts/setup_secrets.sh

diff --git a/buster/setup_scripts/setup_eeepc.sh b/buster/setup_scripts/setup_eeepc.sh
index 552febc..9e394eb 100755
--- a/buster/setup_scripts/setup_eeepc.sh
+++ b/buster/setup_scripts/setup_eeepc.sh
@@ -51,6 +51,7 @@ cd "${setup_scripts_dir}"
 HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
 adduser --disabled-password --gecos "" plom
 usermod -a -G sudo plom
+passwd plom
 if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
     while [ ! -e /dev/"${secrets_dev}" ]; do
         echo "Put secrets drive into slot for /dev/${secrets_dev}, then hit Return."
@@ -65,4 +66,3 @@ if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
     chown plom:plom /home/plom/setup_home_eeepc.sh
     su -c "cd && ./setup_home_eeepc.sh" plom
 fi
-passwd plom
diff --git a/buster/setup_scripts/setup_home_eeepc.sh b/buster/setup_scripts/setup_home_eeepc.sh
index 27b5f4d..7dd2f8f 100755
--- a/buster/setup_scripts/setup_home_eeepc.sh
+++ b/buster/setup_scripts/setup_home_eeepc.sh
@@ -22,18 +22,20 @@ mkdir -p "${public_repos_dir}"
 ensure_repo config
 cd "${setup_scripts_dir}"
 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "${HOME}" minimal user_eeepc
-cat "${repos_list_file}" | while read line; do
-    ensure_repo "${line}"
-done
 curl -fsSl https://raw.githubusercontent.com/tridactyl/tridactyl/78e662efefd1f4af2bdb2a53edecf03b535b997b/native/install.sh | bash
 cd "${dir_secrets}"
 mkdir -p "${ssh_dir}"
 echo "Setting up .ssh"
 cp id_rsa ~/.ssh
+stty -echo
 ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
+stty echo
 tar xf borg_keyfiles.tar
 mkdir -p "${borgkeys_dir}"
 mv borg_keyfiles/* "${borgkeys_dir}"
 cd
 rm -rf "${dir_secrets}"
+cat "${repos_list_file}" | while read line; do
+    ensure_repo "${line}"
+done
 echo "TODO: As tridactyl user, don't forget to do :source on the first Firefox run and then re-start."
diff --git a/buster/setup_scripts/setup_secrets.sh b/buster/setup_scripts/setup_secrets.sh
deleted file mode 100755
index 3308232..0000000
--- a/buster/setup_scripts/setup_secrets.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-set -e
-
-secrets_dev="sdb"
-source_dir="/media/${secrets_dev}/to_usb"
-target_dir="${HOME}/tmp_to_usb"
-borgkeys_dir=~/.config/borg/keys
-ssh_dir=~/.ssh
-while [ ! -e /dev/"${secrets_dev}" ]; do
-    echo "Put secrets drive into slot for /dev/${secrets_dev}, then hit Return."
-    read ignore
-done
-sudo pmount /dev/"${secrets_dev}"
-cp -a "${source_dir}" "${target_dir}"
-sudo pumount "${secrets_dev}"
-echo "You can remove /dev/${secrets_dev} now."
-cd "${target_dir}"
-mkdir -p "${ssh_dir}"
-echo "Setting up .ssh"
-cp id_rsa ~/.ssh
-ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
-tar xf borg_keyfiles.tar
-mkdir -p "${borgkeys_dir}"
-mv borg_keyfiles/* "${borgkeys_dir}"
-cd
-rm -rf "${target_dir}"
-- 
2.30.2