Last active
January 8, 2022 06:13
-
-
Save JayGoldberg/fb2f29c7b5489f4634f87ede20549aef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# v1.0 | |
wd="/tmp/IPCAM" | |
mkdir -p $wd | |
rm -f $wd/* | |
tar -cf $wd/config.tar -C ./ mnt/mtd | |
echo "Calc checksum" | |
cp $wd/config.tar $wd/config.tmp | |
echo -n "IPCAM" >> $wd/config.tmp | |
md5sum $wd/config.tmp > $wd/config.md5 | |
echo "Copy header from original config_backup.bin" | |
dd bs=1 count=512 if=./config_backup.bin of=./new_config.bin | |
echo "Insert data" | |
dd bs=1 seek=512 if=$wd/config.tar of=./new_config.bin | |
echo "Insert checksum" | |
dd bs=1 seek=228 count=32 if=$wd/config.md5 of=./new_config.bin conv=notrunc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# takes a camera config backup, and unpacks it into current directory | |
# v1.0 | |
# makes a temp dir for the stripped tar file | |
wd="/tmp/IPCAM" | |
mkdir -p $wd | |
# make sure previous files are removed | |
rm -f $wd/* | |
echo "skipping the 512b header and writing out config.tar" | |
dd bs=1 skip=512 if=./config_backup.bin of=$wd/config.tar | |
tar -xvf $wd/config.tar -C ./ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment