#!/bin/sh
### BEGIN INIT INFO
# Provides:          inactive-root-remount
# Required-Start:    mountall
# Required-Stop:
# Default-Start:     S
# Default-Stop:
# Short-Description: Remount inactive root filesystem read-write.
### END INIT INFO

#shellcheck disable=SC1091
. /etc/default/rcS

if inactive="$(hos-up --machine-parsable get-inactive --mountpoint)"; then
	if ! mount -n -o "remount,rw" "$inactive"; then
		echo
		echo "*** ERROR! Can't remount inactive root filesystem read-write."
		echo
	fi
else
	echo
	echo "*** WARNING! Can't detect inactive root filesystem so it might be mounted read-only."
	echo
fi

: exit 0
