game-and-watch-backup/scripts/rdp1.sh

29 lines
651 B
Bash
Raw Normal View History

2020-11-29 11:45:43 +00:00
#!/bin/bash
2021-11-14 14:06:48 +00:00
source config.sh $@
2020-11-29 11:45:43 +00:00
echo "This will lock your device! Are you sure? (y/N)"
2020-11-29 11:45:43 +00:00
read -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Aborted."
exit 1
fi
echo "Validating internal flash backup before proceeding..."
2021-11-14 14:06:48 +00:00
if ! shasum --check shasums/internal_flash_backup_$TARGET.bin.sha1 >/dev/null 2>&1; then
2020-11-29 11:45:43 +00:00
echo "Backup is not valid. Aborting."
exit 1
fi
2021-11-14 14:06:48 +00:00
echo "Locking device... (Takes up to 30 seconds.)"
if ! ${OPENOCD} -f "openocd/interface_${ADAPTER}.cfg" \
2020-11-29 11:45:43 +00:00
-c "init;" \
-c "halt;" \
-f openocd/rdp1.cfg >>logs/rdp1_openocd.log 2>&1; then
echo "Locking device failed."
exit 1
fi
echo "Device is locked."