| Lei YU | 531fbc2 | 2021-12-10 20:03:18 +0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -eo pipefail | ||||
| 3 | |||||
| 4 | # Check the /sys/class/watchdog/watchdog1/access_cs0 and tell if it's running on the primary or the secondary flash. | ||||
| 5 | |||||
| 6 | ACCESS_CS0="/sys/class/watchdog/watchdog1/access_cs0" | ||||
| 7 | SLOT_FILE="/run/media/slot" | ||||
| 8 | |||||
| 9 | # Create directory if not exist | ||||
| 10 | mkdir -p "$(dirname "${SLOT_FILE}")" | ||||
| 11 | |||||
| 12 | # Write slot info | ||||
| 13 | if [ -f ${ACCESS_CS0} ]; then | ||||
| 14 | echo "1" > ${SLOT_FILE} | ||||
| 15 | else | ||||
| 16 | echo "0" > ${SLOT_FILE} | ||||
| 17 | fi | ||||