Guest User

Untitled

a guest
Aug 19th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.64 KB | None | 0 0
  1. #we are going to check to make sure that the efs was restored
  2.     if [ -d /efs ] ; then
  3.         #seems fine so far
  4.         if [ $($BUSYBOX ls -al /efs | $BUSYBOX wc -l) -eq 2 ] ; then
  5.             if ! [ $($BUSYBOX ls /sdcard/backup/ | $BUSYBOX awk '{if (NR == "1") print $1}') = "efs" ] ; then
  6.                 directory=$($BUSYBOX ls /sdcard/backup/ | $BUSYBOX awk '{if (NR == "1") print $1}')
  7.                 $BUSYBOX cp -a /sdcard/backup/$directory /sdcard/backup/efs
  8.                 restore_efs
  9.             else
  10.                 if [ $($BUSYBOX ls /sdcard/backup/efs | $BUSYBOX wc -l) -gt 0 ] ; then
  11.                     directory=$($BUSYBOX ls /sdcard/backup/ | $BUSYBOX awk '{if (NR == "2") print $1}')
  12.                     $BUSYBOX cp -a /sdcard/backup/$directory /sdcard/backup/efs
  13.                     restore_efs
  14.                 else
  15.                     #well, we are just kinda screwed at this point
  16.                     $BUSYBOX echo "Could not find a backup of the efs directory"
  17.                 fi
  18.         fi
  19.         else
  20.             #everything should be fine
  21.             $BUSYBOX echo "EFS restore seems to have been completed successfully."
  22.         fi
  23.     else
  24.         #something obviously didn't go right
  25.         if ! [ $($BUSYBOX ls /sdcard/backup/ | $BUSYBOX awk '{if (NR == "1") print $1}') = "efs" ] ; then
  26.             directory=$($BUSYBOX ls /sdcard/backup/ | $BUSYBOX awk '{if (NR == "1") print $1}')
  27.             $BUSYBOX cp -a /sdcard/backup/$directory /sdcard/backup/efs
  28.             restore_efs
  29.         else
  30.             if [ $($BUSYBOX ls /sdcard/backup/efs | $BUSYBOX wc -l) -gt 0 ] ; then
  31.                 directory=$($BUSYBOX ls /sdcard/backup/ | $BUSYBOX awk '{if (NR == "2") print $1}')
  32.                 $BUSYBOX cp -a /sdcard/backup/$directory /sdcard/backup/efs
  33.                 restore_efs
  34.             else
  35.                 #well, we are just kinda screwed at this point
  36.                 $BUSYBOX echo "Could not find a backup of the efs directory"
  37.             fi
  38.         fi
  39.     fi
Add Comment
Please, Sign In to add comment