Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/bash | |
2 | ||
3 | IFS=',' read -r -a OPTIONS < <(findmnt --json / | jq -r '.[][0]["options"]') | |
4 | RO= | |
5 | for OPTION in "${OPTIONS[@]}" ; do | |
6 | if [[ "${OPTION}" == "ro" ]] ; then | |
7 | RO=0 | |
8 | break | |
9 | fi | |
10 | done | |
11 | ||
12 | if [[ "${RO}" == "0" ]] ; then | |
13 | echo "'/' is mounted read-only, rebooting" | |
14 | shutdown -r "+1" | |
15 | fi |