#!/bin/bash
## kola:
##   exclusive: false
##   description: Verify /sysroot and /boot are read-only partitions.

set -xeuo pipefail

# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

for part in /sysroot /boot; do
    if ! findmnt -n -o options ${part} | grep -q "ro,"; then
        fatal "${part} is missing ro option"
    fi
    if test -w "${part}" || touch "${part}/somefile" 2>/dev/null; then
        fatal "${part} is writable"
    fi
done
ok read-only partitions
