From aefc1d35df17e586ed35626ab11ffbd7ccc24840 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 20 Mar 2020 00:15:38 +0100
Subject: [PATCH] Add basic w530-specific setup scripting.

---
 buster/apt-mark/thinkpad                      |  7 ++
 buster/apt-mark/w530                          |  0
 buster/apt-mark/x200s                         |  7 --
 .../{x200s => thinkpad}/etc/default/tlp       |  0
 .../etc/systemd/logind.conf                   |  0
 .../home_files/w530/.config/i3status/config   | 82 +++++++++++++++++++
 buster/setup_scripts/install_for_target.sh    |  1 +
 buster/setup_scripts/setup_desktop.sh         | 10 ++-
 8 files changed, 97 insertions(+), 10 deletions(-)
 create mode 100644 buster/apt-mark/thinkpad
 create mode 100644 buster/apt-mark/w530
 rename buster/etc_files/{x200s => thinkpad}/etc/default/tlp (100%)
 rename buster/etc_files/{x200s => thinkpad}/etc/systemd/logind.conf (100%)
 create mode 100644 buster/home_files/w530/.config/i3status/config

diff --git a/buster/apt-mark/thinkpad b/buster/apt-mark/thinkpad
new file mode 100644
index 0000000..6a780f2
--- /dev/null
+++ b/buster/apt-mark/thinkpad
@@ -0,0 +1,7 @@
+# for wifi
+firmware-iwlwifi
+# for tlp
+tlp
+tp-smapi-dkms
+linux-headers-amd64
+#
diff --git a/buster/apt-mark/w530 b/buster/apt-mark/w530
new file mode 100644
index 0000000..e69de29
diff --git a/buster/apt-mark/x200s b/buster/apt-mark/x200s
index 6a780f2..e69de29 100644
--- a/buster/apt-mark/x200s
+++ b/buster/apt-mark/x200s
@@ -1,7 +0,0 @@
-# for wifi
-firmware-iwlwifi
-# for tlp
-tlp
-tp-smapi-dkms
-linux-headers-amd64
-#
diff --git a/buster/etc_files/x200s/etc/default/tlp b/buster/etc_files/thinkpad/etc/default/tlp
similarity index 100%
rename from buster/etc_files/x200s/etc/default/tlp
rename to buster/etc_files/thinkpad/etc/default/tlp
diff --git a/buster/etc_files/x200s/etc/systemd/logind.conf b/buster/etc_files/thinkpad/etc/systemd/logind.conf
similarity index 100%
rename from buster/etc_files/x200s/etc/systemd/logind.conf
rename to buster/etc_files/thinkpad/etc/systemd/logind.conf
diff --git a/buster/home_files/w530/.config/i3status/config b/buster/home_files/w530/.config/i3status/config
new file mode 100644
index 0000000..b9fb15f
--- /dev/null
+++ b/buster/home_files/w530/.config/i3status/config
@@ -0,0 +1,82 @@
+# 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 += "disk /home/"
+order += "wireless wlp3s0"
+order += "ethernet enp0s25"
+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
+}
+
+# How much space is left in /home ?
+disk "/home/" {
+  format = "/home: %avail available of %total"
+  separator_block_width = 25
+}
+
+# WLAN status: show IP and connection quality or "down".
+wireless wlp3s0 {
+  format_up = "w: (%quality at %essid) %ip"
+  format_down = "w: down"
+  separator_block_width = 10
+}
+
+# Ethernet status: show IP or "down".
+ethernet enp0s25 {
+  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/install_for_target.sh b/buster/setup_scripts/install_for_target.sh
index 176f3ea..853a672 100755
--- a/buster/setup_scripts/install_for_target.sh
+++ b/buster/setup_scripts/install_for_target.sh
@@ -10,6 +10,7 @@ aptmark_dir="${config_tree_prefix}/apt-mark"
 
 for target in "$@"; do
     path="${aptmark_dir}/${target}"
+    # TODO: continue if file at $path not found, to get rid of dummy files
     cat "${path}" | while read line; do
         echo "$line"
         if [ ! $(echo "${line}" | cut -c1) = "#" ]; then
diff --git a/buster/setup_scripts/setup_desktop.sh b/buster/setup_scripts/setup_desktop.sh
index 3626d73..16074f5 100755
--- a/buster/setup_scripts/setup_desktop.sh
+++ b/buster/setup_scripts/setup_desktop.sh
@@ -5,7 +5,7 @@ if [ "$#" -ne 1 ]; then
     echo 'Need exactly one argument (system name).'
     false
 fi
-if [ ! "$1" = "eeepc" ] && [ ! "$1" = "x200s" ]; then
+if [ ! "$1" = "eeepc" ] && [ ! "$1" = "x200s" ] && [ ! "$1" = "w530" ]; then
     echo "Need legal system name."
     false
 fi
@@ -16,8 +16,12 @@ config_tree_prefix="${HOME}/config/buster"
 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
 cd "${setup_scripts_dir}"
 ./setup.sh "${system_name}" "" user desktop "${system_name}"
-./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" user desktop "${system_name}"
-./install_for_target.sh user desktop "${system_name}"
+if [ "$1" = "x200s" ] || [ "$1" = "w530" ]; then
+  ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" thinkpad
+fi
+# TODO: these /should/ redundant, try out without them:
+#./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" user desktop "${system_name}"
+#./install_for_target.sh user desktop "${system_name}"
 
 # For hibernation on lid switch to work, we need a newer kernel on the EeePC,
 # see <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=919227>.
-- 
2.30.2