restore files from system directory to android
[android-command-line.git] / restore-system.sh
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