From f8d7547f67a6f96105c3d3d730eaca046ad264da Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 11 Aug 2019 23:28:03 +0200
Subject: [PATCH] WIP.

---
 .../{user => eeepc}/etc/systemd/logind.conf   |  0
 .../usr/share/applications/firefox.desktop    |  3 +++
 .../etc_files/x200s/etc/systemd/logind.conf   |  6 ++++++
 buster/setup_scripts/setup_desktop.sh         |  2 +-
 buster/setup_scripts/setup_home.sh            | 20 ++++++++++++-------
 5 files changed, 23 insertions(+), 8 deletions(-)
 rename buster/etc_files/{user => eeepc}/etc/systemd/logind.conf (100%)
 create mode 100644 buster/etc_files/user/usr/share/applications/firefox.desktop
 create mode 100644 buster/etc_files/x200s/etc/systemd/logind.conf

diff --git a/buster/etc_files/user/etc/systemd/logind.conf b/buster/etc_files/eeepc/etc/systemd/logind.conf
similarity index 100%
rename from buster/etc_files/user/etc/systemd/logind.conf
rename to buster/etc_files/eeepc/etc/systemd/logind.conf
diff --git a/buster/etc_files/user/usr/share/applications/firefox.desktop b/buster/etc_files/user/usr/share/applications/firefox.desktop
new file mode 100644
index 0000000..cb8d354
--- /dev/null
+++ b/buster/etc_files/user/usr/share/applications/firefox.desktop
@@ -0,0 +1,3 @@
+[Desktop Entry]
+Name=Firefox
+Exec=/usr/local/bin/firefox %u
diff --git a/buster/etc_files/x200s/etc/systemd/logind.conf b/buster/etc_files/x200s/etc/systemd/logind.conf
new file mode 100644
index 0000000..1098229
--- /dev/null
+++ b/buster/etc_files/x200s/etc/systemd/logind.conf
@@ -0,0 +1,6 @@
+#  This file is part of systemd.
+#
+# See logind.conf(5) for details.
+
+[Login]
+HandleLidSwitch=hibernate
diff --git a/buster/setup_scripts/setup_desktop.sh b/buster/setup_scripts/setup_desktop.sh
index b76fa56..3c66cea 100755
--- a/buster/setup_scripts/setup_desktop.sh
+++ b/buster/setup_scripts/setup_desktop.sh
@@ -79,6 +79,6 @@ if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
     pumount "${secrets_dev}"
     echo "You can remove /dev/${secrets_dev} now."
     cp setup_home.sh /home/plom
-    chown plom:plom /home/plom/setup_home_eeepc.sh
+    chown plom:plom /home/plom/setup_home.sh
     SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom
 fi
diff --git a/buster/setup_scripts/setup_home.sh b/buster/setup_scripts/setup_home.sh
index b02ef6d..e6abd78 100755
--- a/buster/setup_scripts/setup_home.sh
+++ b/buster/setup_scripts/setup_home.sh
@@ -32,6 +32,18 @@ ensure_repo() {
     fi
 }
 
+# Set up iniitial non-public parts of infrastructure: SSH authentication.
+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
+eval $(ssh-agent)
+ssh-add
+ssh-keyscan -H "plomlompom.com" >> ~/.ssh/known_hosts
+
 # Clone config to copy dotfiles etc. from it.
 cd
 mkdir -p "${public_repos_dir}"
@@ -42,14 +54,8 @@ cd "${setup_scripts_dir}"
 # Set up native messenger for tridactyl.
 curl -fsSl https://raw.githubusercontent.com/tridactyl/tridactyl/78e662efefd1f4af2bdb2a53edecf03b535b997b/native/install.sh | bash
 
-# Set up non-public parts of infrastructure.
+# Set up further non-public parts of infrastructure.
 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
 script -c 'gpg --import secret_keys.asc' /dev/null
 tar xf borg_keyfiles.tar
 mkdir -p "${borgkeys_dir}"
-- 
2.30.2