Skip to content

Instantly share code, notes, and snippets.

@hamishcoleman
Created January 8, 2018 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamishcoleman/75de3d6c5040efccf392f984306ea2c2 to your computer and use it in GitHub Desktop.
Save hamishcoleman/75de3d6c5040efccf392f984306ea2c2 to your computer and use it in GitHub Desktop.
# See if there is any config to restore
try_dev() {
echo mknod /dev/$1 b $2 $3
# mount /dev/$1 /mnt -o ro
# next if error
# for j in $mnt/conf.d/*.tar.gz
# tar xf $j etc
# for j in $mnt/conf.d/*.sh
# source $j
# umount /mnt
}
mount -t proc proc /proc
cat /proc/partitions | while read major minor size name x; do
case $name in
sd*[0-9]|mmcblk*p*)
echo Checking for config files on $name
try_dev $name $major $minor
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment