1#!/bin/bash 2set -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 6ACCESS_CS0="/sys/class/watchdog/watchdog1/access_cs0" 7SLOT_FILE="/run/media/slot" 8 9# Create directory if not exist 10mkdir -p "$(dirname "${SLOT_FILE}")" 11 12# Write slot info 13if [ -f ${ACCESS_CS0} ]; then 14 echo "1" > ${SLOT_FILE} 15else 16 echo "0" > ${SLOT_FILE} 17fi 18