restore files from system directory to android
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 13 Oct 2010 15:42:46 +0000 (17:42 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 13 Oct 2010 15:42:46 +0000 (17:42 +0200)
This also remounts /system partition rw

restore-system.sh [new file with mode: 0755]

diff --git a/restore-system.sh b/restore-system.sh
new file mode 100755 (executable)
index 0000000..301ec3d
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh -x
+
+remount_path() {
+       adb shell df $1 | grep /dev/ | tr -d '\r' | \
+       awk '{ print "mount -o remount,'$2' "$1" "$6 }' | xargs -i adb shell {}
+}
+
+find system -type f -print | while read FILE ; do
+       dir=`dirname $FILE`
+       name=`basename $FILE`
+       echo "# $FILE -> $dir $name"
+       remount_path $dir rw
+       dev=`adb shell df system/etc/init.d/ | grep /dev/`
+       adb push $FILE $dir
+       remount_path $dir ro
+done