From ecc75a7273fc999e5d75a4c21b57db01877b5487 Mon Sep 17 00:00:00 2001 From: larche Date: Thu, 6 Jul 2017 11:29:46 +0900 Subject: [PATCH] =?UTF-8?q?=3D=20Fusing=20SD=20Script=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20=20(SD=20to=20USB=20=EC=97=90=EB=8F=84=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84=EB=A1=9D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- release/mk-fusingsd.sh | 56 +++++++++++++++++++++++++++++++++++++++++++------- scripts/mk-fusingsd.sh | 56 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 98 insertions(+), 14 deletions(-) diff --git a/release/mk-fusingsd.sh b/release/mk-fusingsd.sh index ff44bfa..df5df9a 100755 --- a/release/mk-fusingsd.sh +++ b/release/mk-fusingsd.sh @@ -3,6 +3,10 @@ C_NC='\033[0m' C_LRED='\033[1;31m' +#### Partition Number #### +P1_NUM="1" +P2_NUM="2" + DEVNAME="mmcblk0" DEV_PATH="/dev/mmcblk0" DEV_PATH_P1="/dev/mmcblk0p1" @@ -45,8 +49,8 @@ function run_format() echo "" echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}" echo "" - mkfs.ext4 ${DEV_PATH}p1 -L BOOT0 - mkfs.ext4 ${DEV_PATH}p2 -L DATA + echo "y" | mkfs.ext4 ${DEV_PATH}${P1_NUM} -L BOOT0 + echo "y" | mkfs.ext4 ${DEV_PATH}${P2_NUM} -L DATA } function run_mount() @@ -58,7 +62,7 @@ function run_mount() mkdir ${MOUNT_PATH_P1} fi - mount ${DEV_PATH}p1 ${MOUNT_PATH_P1} + mount ${DEV_PATH}${P1_NUM} ${MOUNT_PATH_P1} } function run_umount() @@ -107,7 +111,8 @@ function Init_Unmount() echo "" echo -e "${C_LRED}### Unmount SD - Init_Unmount() ###${C_NC}" echo "" - umount $DEV_PATH_P1 +# umount $DEV_PATH_P1 + umount $DEV_PATH* } function main() @@ -126,13 +131,36 @@ function main() sync } +if [[ "$1" == "sd"* ]]; then + if [ "$1" != "sd" ]; then + P1_NUM="1" + P2_NUM="2" + else + echo "Missing Partition Number" + exit + fi + +elif [[ "$1" == "mmcblk"* ]]; then + if [ "$1" != "mmcblk" ]; then + P1_NUM="p1" + P2_NUM="p2" + else + echo "Missing Partition Number" + exit + fi +else + echo "Wrong Device Name" + exit +fi + + if [ "$1" != "" ]; then DEVNAME=$1 fi DEV_PATH="/dev/${DEVNAME}" -DEV_PATH_P1="${DEV_PATH}p1" -MOUNT_PATH_P1="/tmp/${DEVNAME}p1" +DEV_PATH_P1="${DEV_PATH}${P1_NUM}" +MOUNT_PATH_P1="/tmp/${DEVNAME}${P1_NUM}" echo "" echo "================================" @@ -142,4 +170,18 @@ echo "P1 MountPath: $MOUNT_PATH_P1" echo "================================" echo "" -main +read -p "IS Right? (y/n): " -n 2 -e IS_RIGHT + +if [ "$IS_RIGHT" == "y" ]; then + main +elif [ "$IS_RIGHT" == "Y" ]; then + main +else + echo -e "Exit This Script" + exit +fi + + + + + diff --git a/scripts/mk-fusingsd.sh b/scripts/mk-fusingsd.sh index ff3c57e..df5df9a 100755 --- a/scripts/mk-fusingsd.sh +++ b/scripts/mk-fusingsd.sh @@ -3,6 +3,10 @@ C_NC='\033[0m' C_LRED='\033[1;31m' +#### Partition Number #### +P1_NUM="1" +P2_NUM="2" + DEVNAME="mmcblk0" DEV_PATH="/dev/mmcblk0" DEV_PATH_P1="/dev/mmcblk0p1" @@ -45,8 +49,8 @@ function run_format() echo "" echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}" echo "" - echo "y" | mkfs.ext4 ${DEV_PATH}p1 -L BOOT0 - echo "y" | mkfs.ext4 ${DEV_PATH}p2 -L DATA + echo "y" | mkfs.ext4 ${DEV_PATH}${P1_NUM} -L BOOT0 + echo "y" | mkfs.ext4 ${DEV_PATH}${P2_NUM} -L DATA } function run_mount() @@ -58,7 +62,7 @@ function run_mount() mkdir ${MOUNT_PATH_P1} fi - mount ${DEV_PATH}p1 ${MOUNT_PATH_P1} + mount ${DEV_PATH}${P1_NUM} ${MOUNT_PATH_P1} } function run_umount() @@ -107,7 +111,8 @@ function Init_Unmount() echo "" echo -e "${C_LRED}### Unmount SD - Init_Unmount() ###${C_NC}" echo "" - umount $DEV_PATH_P1 +# umount $DEV_PATH_P1 + umount $DEV_PATH* } function main() @@ -126,13 +131,36 @@ function main() sync } +if [[ "$1" == "sd"* ]]; then + if [ "$1" != "sd" ]; then + P1_NUM="1" + P2_NUM="2" + else + echo "Missing Partition Number" + exit + fi + +elif [[ "$1" == "mmcblk"* ]]; then + if [ "$1" != "mmcblk" ]; then + P1_NUM="p1" + P2_NUM="p2" + else + echo "Missing Partition Number" + exit + fi +else + echo "Wrong Device Name" + exit +fi + + if [ "$1" != "" ]; then DEVNAME=$1 fi DEV_PATH="/dev/${DEVNAME}" -DEV_PATH_P1="${DEV_PATH}p1" -MOUNT_PATH_P1="/tmp/${DEVNAME}p1" +DEV_PATH_P1="${DEV_PATH}${P1_NUM}" +MOUNT_PATH_P1="/tmp/${DEVNAME}${P1_NUM}" echo "" echo "================================" @@ -142,4 +170,18 @@ echo "P1 MountPath: $MOUNT_PATH_P1" echo "================================" echo "" -main +read -p "IS Right? (y/n): " -n 2 -e IS_RIGHT + +if [ "$IS_RIGHT" == "y" ]; then + main +elif [ "$IS_RIGHT" == "Y" ]; then + main +else + echo -e "Exit This Script" + exit +fi + + + + + -- 2.1.4