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