Changes in scripts/klonkt-migrate-data.sh [12bed59:f434294] in Klonkt
- File:
-
- 1 edited
-
scripts/klonkt-migrate-data.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
scripts/klonkt-migrate-data.sh
r12bed59 rf434294 128 128 run "systemctl daemon-reload" 129 129 130 step "Retiring $OLD_UNIT" 131 # Stopping and disabling is NOT enough: `systemctl restart klonkt` starts a 132 # disabled unit anyway, and that is exactly what an updater generated before 133 # the split does. A resurrected klonkt.service no longer finds its .env (that 134 # moved with the data), falls back to the built-in defaults, and writes a 135 # FRESH EMPTY database into the checkout. 136 # 137 # Masking does not help either: the unit file lives in /etc/systemd/system, 138 # the highest-priority directory, and `systemctl mask` refuses when a real 139 # file is already there ("File ... already exists"). Verified, not assumed. 140 # 141 # So the file is moved aside. systemd then no longer knows the unit at all and 142 # any restart fails loudly with "Unit klonkt.service not found". The file is 143 # kept next to its old place, timestamped, so a rollback is a move back. 144 if [ -f "/etc/systemd/system/$OLD_UNIT" ]; then 145 run "systemctl stop $OLD_UNIT 2>/dev/null || true" 146 run "systemctl disable $OLD_UNIT 2>/dev/null || true" 147 RETIRED="/etc/systemd/system/${OLD_UNIT}.retired-$(date +%Y%m%d%H%M%S)" 148 run "mv '/etc/systemd/system/$OLD_UNIT' '$RETIRED'" 149 run "systemctl daemon-reload" 150 say "stopped, disabled and moved aside → $RETIRED" 151 say "roll back by moving that file back and running: systemctl daemon-reload" 152 else 153 say "no $OLD_UNIT unit file to retire" 130 step "Switching to klonkt@$SLUG" 131 if systemctl list-unit-files "$OLD_UNIT" >/dev/null 2>&1; then 132 run "systemctl disable --now $OLD_UNIT" 133 # Disable only removes the autostart link: `systemctl restart klonkt` would 134 # still START it. That is not theoretical — an updater generated before the 135 # split does exactly that, and the resurrected unit finds no .env (it moved 136 # with the data), falls back to the built-in defaults and creates a FRESH 137 # EMPTY database in the checkout. Masking makes any such call fail loudly. 138 # Reversible: systemctl unmask klonkt. 139 run "systemctl mask $OLD_UNIT" 140 say "disabled and masked $OLD_UNIT (unmask to roll back)" 154 141 fi 155 156 step "Switching to klonkt@$SLUG"157 142 run "systemctl enable --now 'klonkt@$SLUG'" 158 143
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)