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 + + + + +