GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — BPI-Router-Images/image.sh at main · amardd/BPI-Router-Images Expand file tree/ Copy pathimage.shMore file actions executable file ·69 lines (62 loc) · 1.71 KB / Copy pathimage.shFile metadata and controlsexecutable file ·69 lines (62 loc) · 1.71 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 #!/bin/bash imgfile=$1 action=$2 if [[ ! -e "$imgfile" ]];then echo "no filename given";exit;fi board=$(echo $imgfile | sed -e 's/_.*$//') source config.sh function wait_for_partition() { partdev=$1 retries=50 while [[ $retries -gt 0 ]];do if [[ -b "$partdev" ]];then return 0 fi sleep 0.2 retries=$((retries - 1)) done return 1 } function mount_image() { newimgfile=$1 LDEV=$(sudo losetup -f) echo "unpack imgfile ($newimgfile)..." gunzip $newimgfile echo "setting up imgfile to loopdev..." sudo losetup -P ${LDEV} ${newimgfile%.*} 1> /dev/null if [[ $? -ne 0 ]];then echo "losetup ${LDEV} failed (${newimgfile%.*})"; exit 1; fi echo "mounting loopdev..." sudo partprobe ${LDEV} if [[ $? -ne 0 ]];then echo "partprobe failed"; exit 1; fi if ! wait_for_partition "${LDEV}p${mmcbootpart}";then echo "boot partition node missing (${LDEV}p${mmcbootpart})"; exit 1; fi if ! wait_for_partition "${LDEV}p${mmcrootpart}";then echo "root partition node missing (${LDEV}p${mmcrootpart})"; exit 1; fi mkdir -p mnt/BPI-{B,R}OOT echo "mount ${LDEV}p${mmcbootpart} => mnt/BPI-BOOT" sudo mount ${LDEV}p${mmcbootpart} mnt/BPI-BOOT if [[ $? -ne 0 ]];then echo "mounting BPI-BOOT failed"; exit 1; fi echo "mount ${LDEV}p${mmcrootpart} => mnt/BPI-ROOT" sudo mount ${LDEV}p${mmcrootpart} mnt/BPI-ROOT if [[ $? -ne 0 ]];then echo "mounting BPI-ROOT failed"; exit 1; fi } function umount_image() { imgfile=$1 LDEV=$(sudo losetup -l | grep $imgfile | awk '{print $1}') sudo umount ${LDEV}p* sudo losetup -d $LDEV } case $action in "mount") echo "mounting image $imgfile ..." mount_image $imgfile ;; "umount") echo "umounting image $imgfile ..." umount_image $imgfile ;; *) echo "invalid action" exit 1 ;; esac |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |