redpill-tool-chain/synoboot.sh

25 lines
541 B
Bash
Raw Normal View History

2021-10-11 19:02:10 +00:00
#!/usr/bin/env bash
2021-10-11 19:23:29 +00:00
T='/dev/synoboot'
S='images/redpill-DS[39]*.img'
2021-10-11 19:02:10 +00:00
cd $(dirname $(readlink -f "$0"))
IMG_FILE=`ls -lt ${S} 2>/dev/null | awk 'NR==1{print $9}'`
if [ ! -b "${T}" ];then
2021-10-11 19:08:51 +00:00
echo -e "The target block device address does not exist:\t${T}"
2021-10-11 19:02:10 +00:00
exit 1
fi
2021-10-11 19:23:29 +00:00
if [ ! -f "${IMG_FILE}" ];then
2021-10-11 19:08:51 +00:00
echo -e "Is not a valid file:\t${IMG_FILE}"
2021-10-11 19:02:10 +00:00
ls -lt ${S}
2021-10-11 19:23:29 +00:00
exit 1
2021-10-11 19:02:10 +00:00
fi
2021-10-11 19:23:29 +00:00
echo -e "Boot image:\t\t${PWD}/${IMG_FILE}"
echo -e "Target block device:\t${T}"
dd if="${IMG_FILE}" of="${T}" bs=4M conv=nocreat oflag=sync status=progress
2021-11-27 12:50:03 +00:00