From 72d0c7ff45225d7e122f752a95b24a126d5545ff Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 11 Aug 2019 20:25:00 +0200
Subject: [PATCH] Restructure source file tree.

---
 buster/apt-mark/eeepc                         | 62 ---------------
 buster/apt-mark/user                          | 65 ++++++++++++++++
 buster/apt-mark/x200s                         |  3 +
 .../{eeepc => user}/etc/default/console-setup |  0
 .../{eeepc => user}/etc/systemd/logind.conf   |  0
 .../{eeepc => user}/opt/firefox/blank.html    |  0
 .../opt/firefox/defaults/pref/autoconfig.js   |  0
 .../{eeepc => user}/opt/firefox/firefox.cfg   |  0
 .../.config/i3status/config                   |  0
 .../{user_eeepc => user}/.Xresources          |  0
 .../{user_eeepc => user}/.borgrepos           |  0
 .../{user_eeepc => user}/.config/i3/config    |  0
 .../{user_eeepc => user}/.emacs.d/init.el     |  0
 .../home_files/{user_eeepc => user}/.mbsyncrc |  0
 .../{user_eeepc => user}/.notmuch-config      |  0
 .../{user_eeepc => user}/.shell_prompt_color  |  0
 .../{user_eeepc => user}/.tridactylrc         |  1 +
 .../home_files/{user_eeepc => user}/.xinitrc  |  0
 .../{user_eeepc => user}/mail_sync.sh         |  0
 .../{user_eeepc => user}/public_repos/repos   |  0
 .../home_files/x200s/.config/i3status/config  | 75 +++++++++++++++++++
 .../{setup_eeepc.sh => setup_desktop.sh}      | 18 +++--
 .../{setup_home_eeepc.sh => setup_home.sh}    | 12 ++-
 23 files changed, 166 insertions(+), 70 deletions(-)
 create mode 100644 buster/apt-mark/user
 create mode 100644 buster/apt-mark/x200s
 rename buster/etc_files/{eeepc => user}/etc/default/console-setup (100%)
 rename buster/etc_files/{eeepc => user}/etc/systemd/logind.conf (100%)
 rename buster/etc_files/{eeepc => user}/opt/firefox/blank.html (100%)
 rename buster/etc_files/{eeepc => user}/opt/firefox/defaults/pref/autoconfig.js (100%)
 rename buster/etc_files/{eeepc => user}/opt/firefox/firefox.cfg (100%)
 rename buster/home_files/{user_eeepc => eeepc}/.config/i3status/config (100%)
 rename buster/home_files/{user_eeepc => user}/.Xresources (100%)
 rename buster/home_files/{user_eeepc => user}/.borgrepos (100%)
 rename buster/home_files/{user_eeepc => user}/.config/i3/config (100%)
 rename buster/home_files/{user_eeepc => user}/.emacs.d/init.el (100%)
 rename buster/home_files/{user_eeepc => user}/.mbsyncrc (100%)
 rename buster/home_files/{user_eeepc => user}/.notmuch-config (100%)
 rename buster/home_files/{user_eeepc => user}/.shell_prompt_color (100%)
 rename buster/home_files/{user_eeepc => user}/.tridactylrc (60%)
 rename buster/home_files/{user_eeepc => user}/.xinitrc (100%)
 rename buster/home_files/{user_eeepc => user}/mail_sync.sh (100%)
 rename buster/home_files/{user_eeepc => user}/public_repos/repos (100%)
 create mode 100644 buster/home_files/x200s/.config/i3status/config
 rename buster/setup_scripts/{setup_eeepc.sh => setup_desktop.sh} (86%)
 rename buster/setup_scripts/{setup_home_eeepc.sh => setup_home.sh} (91%)

diff --git a/buster/apt-mark/eeepc b/buster/apt-mark/eeepc
index a8cd150..73a755f 100644
--- a/buster/apt-mark/eeepc
+++ b/buster/apt-mark/eeepc
@@ -1,65 +1,3 @@
-# to avoid booting problems with encrypted LVM, see <https://askubuntu.com/a/1105848>
-cryptsetup-initramfs
-lvm2
-# this provides setupcon which reads /etc/default/console-setup
-console-setup
-# without this, systemd-logind won't run, and so not detect lid close for hibernation
-dbus
 # for wifi
 firmware-ralink
-wicd-curses
-# for X to start at all
-xserver-xorg-video-intel
-# X input: keyboard and touchpad
-xserver-xorg-input-evdev
-xserver-xorg-input-synaptics
-# for startx
-xinit
-# for xrdb
-x11-xserver-utils
-# for startx to run for non-root user
-libpam-systemd
-# window environment
-i3
-i3status
-suckless-tools
-xterm
-# to get sleepy at night
-redshift
-# for alsamixer
-alsa-utils
-# for xterm and browser unicode display
-ttf-unifont
-# also useful
-vim
-sudo
-less
-man-db
-manpages
-procps
-# firefox dependencies
-libdbus-glib-1-2
-libgtk-3-0
-# firefox installation dependencies (remove later?)
-curl
-python3
-bzip2
-wget
-jq
-unzip
-# to mount encrypted USB stick and use its contents
-pmount
-cryptsetup
-openssh-client
-# for syncing
-borgbackup
-# emacs
-emacs25
-elpa-ledger
-elpa-elfeed
-# mail setup
-isync
-notmuch
-elpa-notmuch
-pinentry-gtk2
 #
diff --git a/buster/apt-mark/user b/buster/apt-mark/user
new file mode 100644
index 0000000..3d5ee05
--- /dev/null
+++ b/buster/apt-mark/user
@@ -0,0 +1,65 @@
+# to avoid booting problems with encrypted LVM, see <https://askubuntu.com/a/1105848>
+cryptsetup-initramfs
+lvm2
+# this provides setupcon which reads /etc/default/console-setup
+console-setup
+# without this, systemd-logind won't run, and so not detect lid close for hibernation
+dbus
+# for wifi
+wicd-curses
+wicd-gtk
+# for X to start at all
+xserver-xorg-video-intel
+# X input: keyboard and touchpad
+xserver-xorg-input-evdev
+xserver-xorg-input-synaptics
+# for startx
+xinit
+# for xrdb
+x11-xserver-utils
+# for startx to run for non-root user
+libpam-systemd
+# window environment
+i3
+i3status
+suckless-tools
+xterm
+# to get sleepy at night
+redshift
+# for alsamixer
+alsa-utils
+# for xterm and browser unicode display
+ttf-unifont
+# also useful
+vim
+sudo
+less
+man-db
+manpages
+procps
+# firefox dependencies
+libdbus-glib-1-2
+libgtk-3-0
+# firefox installation dependencies (remove later?)
+curl
+python3
+bzip2
+wget
+jq
+unzip
+# to mount encrypted USB stick and use its contents
+pmount
+cryptsetup
+openssh-client
+# for syncing
+borgbackup
+# emacs
+emacs25
+elpa-ledger
+elpa-elfeed
+# mail setup
+isync
+notmuch
+elpa-notmuch
+pinentry-gtk2
+#
diff --git a/buster/apt-mark/x200s b/buster/apt-mark/x200s
new file mode 100644
index 0000000..d06ad3f
--- /dev/null
+++ b/buster/apt-mark/x200s
@@ -0,0 +1,3 @@
+# for wifi
+firmware-iwlwifi
+#
diff --git a/buster/etc_files/eeepc/etc/default/console-setup b/buster/etc_files/user/etc/default/console-setup
similarity index 100%
rename from buster/etc_files/eeepc/etc/default/console-setup
rename to buster/etc_files/user/etc/default/console-setup
diff --git a/buster/etc_files/eeepc/etc/systemd/logind.conf b/buster/etc_files/user/etc/systemd/logind.conf
similarity index 100%
rename from buster/etc_files/eeepc/etc/systemd/logind.conf
rename to buster/etc_files/user/etc/systemd/logind.conf
diff --git a/buster/etc_files/eeepc/opt/firefox/blank.html b/buster/etc_files/user/opt/firefox/blank.html
similarity index 100%
rename from buster/etc_files/eeepc/opt/firefox/blank.html
rename to buster/etc_files/user/opt/firefox/blank.html
diff --git a/buster/etc_files/eeepc/opt/firefox/defaults/pref/autoconfig.js b/buster/etc_files/user/opt/firefox/defaults/pref/autoconfig.js
similarity index 100%
rename from buster/etc_files/eeepc/opt/firefox/defaults/pref/autoconfig.js
rename to buster/etc_files/user/opt/firefox/defaults/pref/autoconfig.js
diff --git a/buster/etc_files/eeepc/opt/firefox/firefox.cfg b/buster/etc_files/user/opt/firefox/firefox.cfg
similarity index 100%
rename from buster/etc_files/eeepc/opt/firefox/firefox.cfg
rename to buster/etc_files/user/opt/firefox/firefox.cfg
diff --git a/buster/home_files/user_eeepc/.config/i3status/config b/buster/home_files/eeepc/.config/i3status/config
similarity index 100%
rename from buster/home_files/user_eeepc/.config/i3status/config
rename to buster/home_files/eeepc/.config/i3status/config
diff --git a/buster/home_files/user_eeepc/.Xresources b/buster/home_files/user/.Xresources
similarity index 100%
rename from buster/home_files/user_eeepc/.Xresources
rename to buster/home_files/user/.Xresources
diff --git a/buster/home_files/user_eeepc/.borgrepos b/buster/home_files/user/.borgrepos
similarity index 100%
rename from buster/home_files/user_eeepc/.borgrepos
rename to buster/home_files/user/.borgrepos
diff --git a/buster/home_files/user_eeepc/.config/i3/config b/buster/home_files/user/.config/i3/config
similarity index 100%
rename from buster/home_files/user_eeepc/.config/i3/config
rename to buster/home_files/user/.config/i3/config
diff --git a/buster/home_files/user_eeepc/.emacs.d/init.el b/buster/home_files/user/.emacs.d/init.el
similarity index 100%
rename from buster/home_files/user_eeepc/.emacs.d/init.el
rename to buster/home_files/user/.emacs.d/init.el
diff --git a/buster/home_files/user_eeepc/.mbsyncrc b/buster/home_files/user/.mbsyncrc
similarity index 100%
rename from buster/home_files/user_eeepc/.mbsyncrc
rename to buster/home_files/user/.mbsyncrc
diff --git a/buster/home_files/user_eeepc/.notmuch-config b/buster/home_files/user/.notmuch-config
similarity index 100%
rename from buster/home_files/user_eeepc/.notmuch-config
rename to buster/home_files/user/.notmuch-config
diff --git a/buster/home_files/user_eeepc/.shell_prompt_color b/buster/home_files/user/.shell_prompt_color
similarity index 100%
rename from buster/home_files/user_eeepc/.shell_prompt_color
rename to buster/home_files/user/.shell_prompt_color
diff --git a/buster/home_files/user_eeepc/.tridactylrc b/buster/home_files/user/.tridactylrc
similarity index 60%
rename from buster/home_files/user_eeepc/.tridactylrc
rename to buster/home_files/user/.tridactylrc
index 7c9e184..c46948a 100644
--- a/buster/home_files/user_eeepc/.tridactylrc
+++ b/buster/home_files/user/.tridactylrc
@@ -1 +1,2 @@
+guiset statuspanel top-left
 set newtab file:///opt/firefox/blank.html
diff --git a/buster/home_files/user_eeepc/.xinitrc b/buster/home_files/user/.xinitrc
similarity index 100%
rename from buster/home_files/user_eeepc/.xinitrc
rename to buster/home_files/user/.xinitrc
diff --git a/buster/home_files/user_eeepc/mail_sync.sh b/buster/home_files/user/mail_sync.sh
similarity index 100%
rename from buster/home_files/user_eeepc/mail_sync.sh
rename to buster/home_files/user/mail_sync.sh
diff --git a/buster/home_files/user_eeepc/public_repos/repos b/buster/home_files/user/public_repos/repos
similarity index 100%
rename from buster/home_files/user_eeepc/public_repos/repos
rename to buster/home_files/user/public_repos/repos
diff --git a/buster/home_files/x200s/.config/i3status/config b/buster/home_files/x200s/.config/i3status/config
new file mode 100644
index 0000000..0acc8c9
--- /dev/null
+++ b/buster/home_files/x200s/.config/i3status/config
@@ -0,0 +1,75 @@
+# plomlompom's i3 status bar configuration
+
+# Activate colors; set update interval of one second.
+general {
+  colors = true
+  interval = 1
+}
+
+# Selection / order of status elements.
+order += "disk /"
+order += "wireless wlp2s0"
+order += "ethernet enp1s0"
+order += "battery 0"
+order += "cpu_usage"
+order += "load"
+order += "cpu_temperature 0"
+order += "time"
+order += "volume master"
+
+# How much space is left in / ?
+disk "/" {
+  format = "/: %avail available of %total"
+  separator_block_width = 25
+}
+
+# WLAN status: show IP and connection quality or "down".
+wireless wlp2s0 {
+  format_up = "w: (%quality at %essid) %ip"
+  format_down = "w: down"
+  separator_block_width = 10
+}
+
+# Ethernet status: show IP or "down".
+ethernet enp1s0 {
+  format_up = "e: %ip"
+  format_down = "e: down"
+  separator_block_width = 25
+}
+
+# Battery status: show FULL/CHARGING/BATTERY, storage, time left.
+battery 0 {
+  format = "b: %status %percentage %remaining"
+  separator_block_width = 25
+}
+
+# Show CPU usage.
+cpu_usage {
+  format = "cpu: %usage"
+  separator_block_width = 10
+}
+
+# Show system load during last 1/5/15 minutes.
+load {
+  format = "%1min %5min %15min"
+  separator_block_width = 25
+}
+
+# Show CPU temperature in degrees of celsius.
+cpu_temperature 0 {
+  format = "%degrees °C"
+  separator_block_width = 25
+}
+
+# Show date/time/timezone as "year-month-day hour:minute:second
+# timezone_numeric/timezone_alphabetic".
+time {
+  format = "%Y-%m-%d %H:%M:%S %z/%Z"
+  separator_block_width = 25
+}
+
+volume master {
+  format = "♪: %volume"
+  format_muted = "♪: muted (%volume)"
+  separator_block_width = 25
+}
diff --git a/buster/setup_scripts/setup_eeepc.sh b/buster/setup_scripts/setup_desktop.sh
similarity index 86%
rename from buster/setup_scripts/setup_eeepc.sh
rename to buster/setup_scripts/setup_desktop.sh
index 997650a..b76fa56 100755
--- a/buster/setup_scripts/setup_eeepc.sh
+++ b/buster/setup_scripts/setup_desktop.sh
@@ -2,18 +2,22 @@
 set -e
 
 if [ "$#" -ne 1 ]; then
-    echo 'Need exactly one argument (hostname).'
+    echo 'Need exactly one argument (system name).'
     false
 fi
-hostname="$1"
+if [ ! "$1" = "eeepc" ] && [ ! "$1" = "x200s" ]; then
+    echo "Need legal system name."
+    false
+fi
+system_name="$1"
 
 # Set up system without user environment.
 config_tree_prefix="${HOME}/config/buster"
 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
 cd "${setup_scripts_dir}"
-./setup.sh "${hostname}" ""
-./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" eeepc
-./install_for_target.sh eeepc
+./setup.sh "${system_name}" ""
+./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" user "${system_name}"
+./install_for_target.sh user "${system_name}"
 
 # Install Firefox directly from Mozilla.
 firefox_release="68.0esr"
@@ -74,7 +78,7 @@ if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
     chown -R plom:plom "${target_dir_secrets}"
     pumount "${secrets_dev}"
     echo "You can remove /dev/${secrets_dev} now."
-    cp setup_home_eeepc.sh /home/plom
+    cp setup_home.sh /home/plom
     chown plom:plom /home/plom/setup_home_eeepc.sh
-    SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home_eeepc.sh" plom
+    SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom
 fi
diff --git a/buster/setup_scripts/setup_home_eeepc.sh b/buster/setup_scripts/setup_home.sh
similarity index 91%
rename from buster/setup_scripts/setup_home_eeepc.sh
rename to buster/setup_scripts/setup_home.sh
index 6e58ef4..4a9303d 100755
--- a/buster/setup_scripts/setup_home_eeepc.sh
+++ b/buster/setup_scripts/setup_home.sh
@@ -1,6 +1,16 @@
 #!/bin/sh
 set -e
 
+if [ "$#" -ne 1 ]; then
+    echo 'Need exactly one argument (system name).'
+    false
+fi
+if [ ! "$1" = "eeepc" ] && [ ! "$1" = "x200s" ]; then
+    echo "Need legal system name."
+    false
+fi
+system_name="$1"
+
 public_repos_dir="${HOME}/public_repos"
 config_tree_prefix="${public_repos_dir}/config"
 path_borgscript="${config_tree_prefix}/all_new_2018/borg.sh"
@@ -27,7 +37,7 @@ cd
 mkdir -p "${public_repos_dir}"
 ensure_repo config
 cd "${setup_scripts_dir}"
-./copy_dirtree.sh "${config_tree_buster}/home_files" "${HOME}" minimal user_eeepc
+./copy_dirtree.sh "${config_tree_buster}/home_files" "${HOME}" minimal user "${system_name}"
 
 # Set up native messenger for tridactyl.
 curl -fsSl https://raw.githubusercontent.com/tridactyl/tridactyl/78e662efefd1f4af2bdb2a53edecf03b535b997b/native/install.sh | bash
-- 
2.30.2