Advertisement
Guest User

Untitled

a guest
May 29th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1.  
  2. # h3droid_installer (c) 2017 KotCzarny (meet me on #linux-sunxi @ irc.freenode.com)
  3.  
  4. # note: OUTDEV can't contain spaces!
  5. if [ "x$OUTDEV" = "x" ]; then
  6. # check for required tools
  7. ERR=""; for TMP in bash truncate sfdisk mkdosfs mke2fs mkfs.ext4 losetup blockdev xz;
  8. do if [ -z `which $TMP` ]; then ERR+=" $TMP"; fi; done
  9. if [ ! -z "$ERR" ]; then echo "please install missing tools:$ERR"; exit 1; fi
  10.  
  11. # either define OUTDEV in your script or add it here:
  12. OUTDEV=/dev/sdb1
  13. #OUTDEV_SIZE=1000M; OUTDEV=/home/somefile.img
  14.  
  15. #OUTDEV=/media/root/0000-006F
  16.  
  17. # file.img example: make sure target path has ~500MB of free space and supports sparse files
  18. # otherwise make sure it has OUTDEV_SIZE of free space
  19. # OUTDEV_SIZE=xxxM; OUTDEV=/some/path/to/output/file.img
  20. # ---- start of file.img example block ----
  21. if [ "0" = "1" ]; then
  22. OUTDEV_SIZE=3700M; OUTDEV=./h3droid.img
  23. modprobe loop; TMP=`losetup -j "$OUTDEV"|tail -1|cut -d " " -f 1|tr -d ':'`
  24. if [ ! -z "$TMP" ]; then losetup -d "$TMP"; rm "$OUTDEV"; fi
  25. echo "creating $OUTDEV_SIZE big file. if your filesystem doesnt support sparse files it might take long time.."
  26. truncate -s "$OUTDEV_SIZE" "$OUTDEV"; TMP=`losetup -fP --show "$OUTDEV"`;
  27. if [ "x$TMP" != "x" ]; then echo "loop mounted: $OUTDEV => $TMP"; OUTDEV0=$OUTDEV; OUTDEV="$TMP";
  28. else echo "initializing loop device failed"; exit 1; fi
  29. fi
  30. # ---- end of file.img example block ----
  31.  
  32. if [ "x$OUTDEV" = "x" ]; then echo "please configure OUTDEV in 00_conf"; exit 1; fi
  33. echo "target device: $OUTDEV"
  34. mkdir 2>/dev/null fs_tmp
  35. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement