# Arch supports only whole-system upgrades (-Sy alone leaves a partial upgrade), so the
@@ -1968,7 +2000,17 @@ install_k3s() {
write_k3s_service_dropin
local installer_ran=0
if[-x"$K3S_BIN"];then
if[-x"$K3S_BIN"]&&[!-f"$K3S_UNIT_FILE"];then
# k3s's installer moves the binary into place before it writes k3s.service, so a run
# cut short between the two left a k3s nothing starts, and every rerun stopped at
# `systemctl enable`. Its installer run again around the binary in place finishes the
# job: no download, no version change, the cluster's data untouched.
"$K3S_BIN"--version>/dev/null 2>&1 \
|| die "${K3S_BIN} does not run and k3s.service is missing: an earlier k3s install was cut short. Remove ${K3S_BIN} and rerun to install k3s ${FELIS_K3S_VERSION}"
log "k3s.service is missing beside ${K3S_BIN}: an earlier k3s install was cut short; finishing it around the binary in place"
expect "a host without dpkg's journal carries on""DONE""$out"
case"$out"in*DPKG:*)echo"FAIL a host without dpkg's journal must not run dpkg --configure: $out";fails=$((fails +1));;*)echo"PASS without running dpkg --configure";;esac
mkdir-p"$dpdir/updates"
case"$(run_finish_dpkg "")"in*DPKG:*)echo"FAIL an empty dpkg journal must not run dpkg --configure";fails=$((fails +1));;*)echo"PASS an empty dpkg journal runs nothing";;esac
: >"$dpdir/updates/0007"
out="$(run_finish_dpkg "")"
expect "a dpkg run cut off mid-package is finished first""LOCKS
DPKG: --force-confdef --force-confold --configure -a (frontend=noninteractive)""$out"
expect " and the install carries on""DONE""$out"
out="$(run_finish_dpkg "" 1)"
expect "a dpkg run that cannot be finished stops the install""DIE: dpkg --configure -a failed""$out"
case"$out"in*DONE*)echo"FAIL a dpkg run that cannot be finished must stop the install";fails=$((fails +1));;esac
rm-f"$dpdir/updates/0007"
expect "a package dpkg --audit names as half configured is finished too""DPKG: --force-confdef --force-confold --configure -a"\
"$(run_finish_dpkg "The following packages are only half configured")"
rm-rf"$dpdir"
# A second installer started while one still runs (in tmux after the SSH session dropped)
@@ -3573,6 +3695,18 @@ case "$out" in *"restart k3s"*) echo "FAIL the k3s installer already started k3s
out="$(run_install_k3s v1.35.2+k3s1 1 1)"
expect "an upgrade runs the k3s installer""INSTALLER""$out"
case"$out"in*"restart k3s"*)echo"FAIL the upgrade already restarted k3s on the new settings; no second restart";fails=$((fails +1));;*)echo"PASS an upgraded k3s is not restarted a second time";;esac
# k3s's installer puts the binary in place before it writes k3s.service: a run cut short
# between the two is finished around that binary, at its own version.
out="$(run_install_k3s v1.36.4+k3s1 1 0 0 0)"
expect "a k3s binary without k3s.service has its installer finish around it""INSTALLER --keep-binary
SYSTEMCTL: enable --now k3s""$out"
case"$out"in*"restart k3s"*)echo"FAIL the finishing installer already started k3s; no second restart";fails=$((fails +1));;*)echo"PASS and k3s is not restarted a second time";;esac
expect "an older binary without k3s.service is finished at its own version""INSTALLER --keep-binary"\
"$(run_install_k3s v1.35.2+k3s1 0 1 0 0)"
out="$(run_install_k3s broken 0 0 0 0)"
expect "a k3s binary that does not run, without k3s.service, stops the install"\
"does not run and k3s.service is missing: an earlier k3s install was cut short""$out"
case"$out"in*INSTALLER*)echo"FAIL a k3s binary that does not run must not be installed around";fails=$((fails +1));;*)echo"PASS and the installer is not run around it";;esac