#!/bin/sh
#Copyright: 2026 Aitor <aitor@genuen.org>
#License: CC0-1.0
#Comment: oneshot; invoke with: sv once rmnologin-stop
#Comment: restore DELAYLOGIN flag for next boot (stage-3 companion)

exec 2>&1

ebegin() { [ "${VERBOSE:-}" = no ] || echo "$@"; }
eend() { r=${1:-0}; shift || true; [ "$r" -eq 0 ] || [ "${VERBOSE:-}" = no ] || echo "$*" >&2; return "$r"; }

[ "$DELAYLOGIN" ] || DELAYLOGIN=yes
# shellcheck disable=SC1091
[ -r /lib/init/vars.sh ] && . /lib/init/vars.sh
case "$DELAYLOGIN" in
  Y*|y*)
	ebegin "Restoring login delay flag"
	echo "System bootup in progress - please wait" > /run/nologin
	eend $?
	;;
esac
exit 0
