commit c303c5fe5a646baad899dd9ab8eb8ee67aa02545
Author: mrfox <jens.se@icloud.com>
AuthorDate: Sun Sep 20 17:22:00 2026 +0200
Commit: mrfox <jens.se@icloud.com>
CommitDate: Sun Sep 20 17:22:00 2026 +0200
install: check iwd/dhcpcd before installing, gate on connectivity
wifi_setup now checks for the actual iwctl binary and a dhcpcd@.service
unit (not just dpkg -s dhcpcd, which dhcpcd-base satisfies without
providing the units this script needs) before attempting to apt-get
install anything, and skips WiFi setup with a clear message if neither
is present and there's no network yet to install them with.
After the WiFi step (skipped or not), add a have_network check before
the unattended install run starts, since apt and the sxwm/sxbar/st
clones all need one; with no connection it asks whether to continue
anyway (default no) instead of failing minutes into the run.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---
README.md | 26 ++++++++++++++++++++++----
install.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 75 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 446313a..9f97ff2 100644
--- a/README.md
+++ b/README.md
@@ -97,10 +97,21 @@ done *before* the install so `apt` has network: it installs the two packages if
missing, starts `iwd`, lets you pick the adapter (only asked when there's more
than one), scans and lets you pick a network (or enter a hidden one), connects
with `iwctl`, and enables `dhcpcd@<adapter>.service` so DHCP only runs on the
-adapter you chose. If `dhcpcd` had to be installed, the generic
-`dhcpcd.service` (all interfaces) that Debian enables is turned off again so it
-doesn't grab the wired interface. 802.1x (enterprise) networks aren't handled —
-configure those manually with `iwctl`.
+adapter you chose. Both are skipped if already usable — it checks for the
+actual `iwctl` binary and a `dhcpcd@.service` unit, not just the package name,
+since Debian's `dhcpcd-base` installs the `dhcpcd` binary without the systemd
+units the script needs. If either is missing and there's no network yet to
+install them with, it says so and skips WiFi setup instead of trying and
+failing. If `dhcpcd` had to be installed, the generic `dhcpcd.service` (all
+interfaces) that Debian enables is turned off again so it doesn't grab the
+wired interface. 802.1x (enterprise) networks aren't handled — configure those
+manually with `iwctl`.
+
+Right after that (WiFi configured or not — e.g. you're on Ethernet), the
+installer checks it actually has a working connection before starting the
+unattended run, since apt and the `sxwm`/`sxbar`/`st` clones need one. With no
+connection it asks whether to continue anyway (default no); declining exits
+with a hint to plug in a cable or rerun and answer yes to the WiFi question.
The installer has an Omarchy-style UI: a centered logo, all the yes/no questions
asked up front (one keypress each), then an unattended run with a progress bar,
@@ -124,6 +135,7 @@ dotfiles/
├── BG/
│ └── j9huwdxo1zzg1.jpeg # Desktop wallpaper
├── bin/ # Utility scripts, installed to ~/.local/bin
+│ ├── crypt # Mounts the gocryptfs vault on a USB stick to ~/crypt
│ ├── gcfs # Minimal gocryptfs vault manager (config-driven)
│ ├── geany # Wrapper: launches Geany with GTK_THEME=Gruvbox-Dark
│ ├── internal-display # on/off/toggle/status for the internal (eDP) screen
@@ -359,6 +371,12 @@ Installed to `~/.local/bin` by `install.sh` and wired into `sxwmrc`/`~/.xinitrc`
for an interactive menu). Lets `gocryptfs` do its own password prompt, so no
secret passes through the script. Needs `gocryptfs` and `fusermount` (`fuse3`),
both pulled in by `install.sh`.
+- **`crypt [mount|umount|status|toggle]`** — the no-config version of `gcfs` for
+ one USB stick: finds the gocryptfs cipherdir (the directory holding
+ `gocryptfs.conf`) under `/media/$USER` or `/run/media/$USER`, mounts it on
+ `~/crypt` and lets `gocryptfs` ask for the password. If the stick isn't mounted
+ yet it tries `udisksctl`; with several vaults it shows a menu. `CRYPT_MOUNT` /
+ `CRYPT_CIPHERDIR` override the mountpoint / cipherdir.
## Screensaver
diff --git a/install.sh b/install.sh
index 96e1b88..0557e40 100755
--- a/install.sh
+++ b/install.sh
@@ -144,6 +144,14 @@ ask() {
strip_ansi() { sed -e 's/\x1b\[[0-9;?]*[A-Za-z]//g'; }
+# have_network -- kan vi nå omvärlden? Används dels för att avgöra om det är
+# lönt att apt-installera iwd/dhcpcd, dels som en sista spärr innan den
+# obevakade installationen (som behöver apt) sätter igång.
+have_network() {
+ [ -n "$DEMO" ] && return 0
+ timeout 5 getent hosts deb.debian.org >/dev/null 2>&1
+}
+
# wifi_do "beskrivning" kommando... -- kör kommandot (utdata till loggen) och
# ersätter ".. beskrivning" med bock/kryss på samma rad. Returnerar dess status.
wifi_do() {
@@ -246,12 +254,25 @@ wifi_setup() {
printf '\n%s%sWiFi%s %s(iwd + dhcpcd)%s\n\n' "$MARGIN_PAD" "$BOLD$ORANGE" "$RESET" "$GRAY" "$RESET"
if [ -z "$DEMO" ]; then
- dpkg -s dhcpcd >/dev/null 2>&1 && had_dhcpcd=1
- if ! dpkg -s iwd dhcpcd >/dev/null 2>&1; then
- if ! wifi_do "Installerar iwd och dhcpcd" sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y iwd dhcpcd; then
- wifi_say "Kunde inte installera paketen (ingen nätverksanslutning än?). Hoppar över WiFi."
- sleep 3; return 1
- fi
+ # dhcpcd-base (bara binären) kan vara installerat utan paketet dhcpcd,
+ # som är det som ger de systemd-units (dhcpcd@.service) scriptet
+ # använder -- kolla båda delarna, inte bara "är dhcpcd installerat",
+ # innan vi bestämmer att något behöver installeras alls.
+ local dhcpcd_ready=0 iwd_ready=0
+ command -v dhcpcd >/dev/null 2>&1 \
+ && systemctl list-unit-files 'dhcpcd@.service' --no-legend 2>/dev/null | grep -q . \
+ && dhcpcd_ready=1
+ command -v iwctl >/dev/null 2>&1 && iwd_ready=1
+ [ "$dhcpcd_ready" = 1 ] && had_dhcpcd=1
+
+ if [ "$iwd_ready" = 1 ] && [ "$dhcpcd_ready" = 1 ]; then
+ wifi_say "iwd och dhcpcd finns redan installerade."
+ elif ! have_network; then
+ wifi_say "iwd och/eller dhcpcd (med systemd-tjänster) saknas, och det finns ännu ingen nätverksanslutning att installera dem via. Anslut en nätverkskabel och kör installationen igen, eller installera dem manuellt."
+ sleep 3; return 1
+ elif ! wifi_do "Installerar iwd och dhcpcd" sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y iwd dhcpcd; then
+ wifi_say "Installationen av paketen misslyckades. Hoppar över WiFi."
+ sleep 3; return 1
fi
if systemctl is-active --quiet NetworkManager; then
wifi_say "Obs: NetworkManager körs och kan krocka med iwd/dhcpcd."
@@ -569,7 +590,7 @@ EOF
step_scripts() {
mkdir -p "$HOME/.local/bin"
local s
- for s in lidsuspend mouse-settings status gcfs; do
+ for s in lidsuspend mouse-settings status gcfs crypt; do
cp "$SCRIPT_DIR/bin/$s" "$HOME/.local/bin/$s"
chmod +x "$HOME/.local/bin/$s"
echo "$s -> ~/.local/bin/$s"
@@ -882,6 +903,31 @@ if [ "$A_WIFI" = 1 ] && [ "$PLAIN" = 0 ]; then
wifi_setup || true
fi
+# Allt som följer (apt, git clone av sxwm/sxbar/st, Rust, fonten, ...) behöver
+# nät -- kolla det nu, medan vi ändå är kvar i den interaktiva delen, istället
+# för att upptäcka det efter minuter i den obevakade körningen.
+if [ -n "$DEMO" ]; then
+ printf '\n'
+ wifi_do "Kontrollerar nätverksanslutning" true
+elif [ "$PLAIN" = 1 ]; then
+ have_network || echo "VARNING: ingen nätverksanslutning hittades -- apt kommer sannolikt misslyckas."
+else
+ printf '\n'
+ if wifi_do "Kontrollerar nätverksanslutning" have_network; then
+ sleep 1
+ else
+ wifi_say "apt behöver nät för att installera paket och hämta sxwm/sxbar/st källkod."
+ ask A_NO_NET_CONTINUE "Fortsätta ändå?" \
+ "Utan nätverk stannar installationen sannolikt vid första steget (apt-get)."
+ if [ "$A_NO_NET_CONTINUE" != 1 ]; then
+ printf '\n'
+ wifi_say "Avbryter. Anslut nätverk (kabel, eller kör om och"
+ wifi_say "svara ja på WiFi-frågan) och försök igen."
+ exit 1
+ fi
+ fi
+fi
+
add_step 10 "Installerar beroenden" step_deps
add_step 3 "Bygger sxwm" step_sxwm
add_step 2 "Bygger sxbar" step_sxbar