From 532fa439a92bac271690e1cc90314c8c53a07bb5 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 29 Aug 2023 23:26:38 +0200
Subject: [PATCH] Improve server setup.

---
 bookworm/setup_scripts/{setup.sh => _setup.sh} | 0
 bookworm/setup_scripts/setup_desktop.sh        | 2 +-
 bookworm/setup_scripts/setup_server.sh         | 6 ++++++
 bookworm/setup_scripts/setup_web.sh            | 5 +++++
 4 files changed, 12 insertions(+), 1 deletion(-)
 rename bookworm/setup_scripts/{setup.sh => _setup.sh} (100%)

diff --git a/bookworm/setup_scripts/setup.sh b/bookworm/setup_scripts/_setup.sh
similarity index 100%
rename from bookworm/setup_scripts/setup.sh
rename to bookworm/setup_scripts/_setup.sh
diff --git a/bookworm/setup_scripts/setup_desktop.sh b/bookworm/setup_scripts/setup_desktop.sh
index 9df5512..637dfc2 100755
--- a/bookworm/setup_scripts/setup_desktop.sh
+++ b/bookworm/setup_scripts/setup_desktop.sh
@@ -7,7 +7,7 @@ get_system_name_arg "$1"
 
 # Set up system without user environment.
 cd "${setup_scripts_dir}"
-./setup.sh "${system_name}" "" user desktop thinkpad "${system_name}"
+./_setup.sh "${system_name}" "" user desktop thinkpad "${system_name}"
 
 # Set up printer.
 ppd_deb="hll2350dwpdrv-4.0.0-1.i386.deb"
diff --git a/bookworm/setup_scripts/setup_server.sh b/bookworm/setup_scripts/setup_server.sh
index 3324962..e77d17f 100755
--- a/bookworm/setup_scripts/setup_server.sh
+++ b/bookworm/setup_scripts/setup_server.sh
@@ -9,9 +9,15 @@ hostname="$1"
 fqdn="$2"
 additional_arg="$3"
 
+# Set up basic server system.
+cd "${setup_scripts_dir}"
+./_setup.sh "${hostname}" "${fqdn}" server "$@"
+
 # If we have not yet set the shell for user plom, ensure it here. This
 # is mostly for convenience.
 usermod -s /bin/bash plom
 
 # Enable firewall.
 systemctl enable nftables.service
+
+touch "$HOME/setup_server_has_been_run"
diff --git a/bookworm/setup_scripts/setup_web.sh b/bookworm/setup_scripts/setup_web.sh
index d4d3a61..4b1e93f 100755
--- a/bookworm/setup_scripts/setup_web.sh
+++ b/bookworm/setup_scripts/setup_web.sh
@@ -5,6 +5,11 @@ set -e
 expect_n_args 1 "(domain name)" "$@"
 domain="$1"
 
+if [ ! -f "$HOME/setup_server_has_been_run" ]; then
+    echo "First need to run setup_server.sh."
+    false
+fi
+
 # Install configs, set up firewall.
 ./install_for_target.sh web static_websites
 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web static_websites
-- 
2.30.2