Skip to content

Commit 9cebfd1

Browse files
author
Paul C
committed
wolfdisk/setup.sh: always (re)write wolfdisk.service so updates repair it
Service install was gated on `[ ! -f /etc/systemd/system/wolfdisk.service ]`, so a node without the unit (interrupted install, binary build failing before the service block, or a stale unit) was never repaired by re-running setup.sh — leaving "Unit wolfdisk.service not found" on the next enable/start. Now the unit is rewritten on every run from the live config, so re-running setup.sh reliably fixes it.
1 parent 1f8c9bf commit 9cebfd1

1 file changed

Lines changed: 24 additions & 26 deletions

File tree

wolfdisk/setup.sh

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -412,28 +412,31 @@ else
412412
echo " (Upgrade mode - skipping configuration prompts)"
413413
fi
414414

415-
# Service setup
416-
if [ ! -f "/etc/systemd/system/wolfdisk.service" ]; then
417-
echo ""
418-
echo " ─────────────────────────────────────"
419-
echo " Creating systemd service..."
420-
echo " ─────────────────────────────────────"
415+
# Service setup — ALWAYS (re)write the unit, every run. Previously this was
416+
# gated on the file not existing, so an update could leave a node with a
417+
# missing or stale wolfdisk.service (and "systemctl enable/start wolfdisk" then
418+
# fails with "Unit wolfdisk.service not found"). Re-running setup.sh now always
419+
# repairs it.
420+
echo ""
421+
echo " ─────────────────────────────────────"
422+
echo " Installing systemd service..."
423+
echo " ─────────────────────────────────────"
421424

422-
# Get mount point from config or use default
423-
SVC_MOUNT="/mnt/wolfdisk"
424-
SVC_CONFIG="/etc/wolfdisk/config.toml"
425-
if [ -f "$SVC_CONFIG" ]; then
426-
SVC_MOUNT_CFG=$(grep -E "^path\s*=" "$SVC_CONFIG" | cut -d'"' -f2 | head -1)
427-
[ -n "$SVC_MOUNT_CFG" ] && SVC_MOUNT="$SVC_MOUNT_CFG"
428-
fi
425+
# Get mount point from config or use default
426+
SVC_MOUNT="/mnt/wolfdisk"
427+
SVC_CONFIG="/etc/wolfdisk/config.toml"
428+
if [ -f "$SVC_CONFIG" ]; then
429+
SVC_MOUNT_CFG=$(grep -E "^path\s*=" "$SVC_CONFIG" | cut -d'"' -f2 | head -1)
430+
[ -n "$SVC_MOUNT_CFG" ] && SVC_MOUNT="$SVC_MOUNT_CFG"
431+
fi
429432

430-
# Enable user_allow_other in /etc/fuse.conf
431-
if ! grep -q "^user_allow_other" /etc/fuse.conf 2>/dev/null; then
432-
echo "user_allow_other" >> /etc/fuse.conf
433-
echo " ✓ Enabled user_allow_other in /etc/fuse.conf"
434-
fi
433+
# Enable user_allow_other in /etc/fuse.conf
434+
if ! grep -q "^user_allow_other" /etc/fuse.conf 2>/dev/null; then
435+
echo "user_allow_other" >> /etc/fuse.conf
436+
echo " ✓ Enabled user_allow_other in /etc/fuse.conf"
437+
fi
435438

436-
cat << SVCEOF > /etc/systemd/system/wolfdisk.service
439+
cat << SVCEOF > /etc/systemd/system/wolfdisk.service
437440
[Unit]
438441
Description=WolfDisk Distributed File System
439442
After=network.target
@@ -455,13 +458,8 @@ PrivateTmp=false
455458
WantedBy=multi-user.target
456459
SVCEOF
457460

458-
systemctl daemon-reload
459-
echo " ✓ Created wolfdisk.service"
460-
else
461-
echo ""
462-
echo " ✓ Service already installed - reloading systemd"
463-
systemctl daemon-reload
464-
fi
461+
systemctl daemon-reload
462+
echo " ✓ Installed wolfdisk.service"
465463

466464
# Start/restart service
467465
echo ""

0 commit comments

Comments
 (0)