Commit ecc75a7273fc999e5d75a4c21b57db01877b5487
1 parent
282792e8d3
Exists in
master
and in
2 other branches
= Fusing SD Script 수정 (SD to USB 에도 적용가능하도록)
Showing
2 changed files
with
98 additions
and
14 deletions
Show diff stats
release/mk-fusingsd.sh
@@ -3,6 +3,10 @@ | @@ -3,6 +3,10 @@ | ||
3 | C_NC='\033[0m' | 3 | C_NC='\033[0m' |
4 | C_LRED='\033[1;31m' | 4 | C_LRED='\033[1;31m' |
5 | 5 | ||
6 | +#### Partition Number #### | ||
7 | +P1_NUM="1" | ||
8 | +P2_NUM="2" | ||
9 | + | ||
6 | DEVNAME="mmcblk0" | 10 | DEVNAME="mmcblk0" |
7 | DEV_PATH="/dev/mmcblk0" | 11 | DEV_PATH="/dev/mmcblk0" |
8 | DEV_PATH_P1="/dev/mmcblk0p1" | 12 | DEV_PATH_P1="/dev/mmcblk0p1" |
@@ -45,8 +49,8 @@ function run_format() | @@ -45,8 +49,8 @@ function run_format() | ||
45 | echo "" | 49 | echo "" |
46 | echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}" | 50 | echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}" |
47 | echo "" | 51 | echo "" |
48 | - mkfs.ext4 ${DEV_PATH}p1 -L BOOT0 | ||
49 | - mkfs.ext4 ${DEV_PATH}p2 -L DATA | 52 | + echo "y" | mkfs.ext4 ${DEV_PATH}${P1_NUM} -L BOOT0 |
53 | + echo "y" | mkfs.ext4 ${DEV_PATH}${P2_NUM} -L DATA | ||
50 | } | 54 | } |
51 | 55 | ||
52 | function run_mount() | 56 | function run_mount() |
@@ -58,7 +62,7 @@ function run_mount() | @@ -58,7 +62,7 @@ function run_mount() | ||
58 | mkdir ${MOUNT_PATH_P1} | 62 | mkdir ${MOUNT_PATH_P1} |
59 | fi | 63 | fi |
60 | 64 | ||
61 | - mount ${DEV_PATH}p1 ${MOUNT_PATH_P1} | 65 | + mount ${DEV_PATH}${P1_NUM} ${MOUNT_PATH_P1} |
62 | } | 66 | } |
63 | 67 | ||
64 | function run_umount() | 68 | function run_umount() |
@@ -107,7 +111,8 @@ function Init_Unmount() | @@ -107,7 +111,8 @@ function Init_Unmount() | ||
107 | echo "" | 111 | echo "" |
108 | echo -e "${C_LRED}### Unmount SD - Init_Unmount() ###${C_NC}" | 112 | echo -e "${C_LRED}### Unmount SD - Init_Unmount() ###${C_NC}" |
109 | echo "" | 113 | echo "" |
110 | - umount $DEV_PATH_P1 | 114 | +# umount $DEV_PATH_P1 |
115 | + umount $DEV_PATH* | ||
111 | } | 116 | } |
112 | 117 | ||
113 | function main() | 118 | function main() |
@@ -126,13 +131,36 @@ function main() | @@ -126,13 +131,36 @@ function main() | ||
126 | sync | 131 | sync |
127 | } | 132 | } |
128 | 133 | ||
134 | +if [[ "$1" == "sd"* ]]; then | ||
135 | + if [ "$1" != "sd" ]; then | ||
136 | + P1_NUM="1" | ||
137 | + P2_NUM="2" | ||
138 | + else | ||
139 | + echo "Missing Partition Number" | ||
140 | + exit | ||
141 | + fi | ||
142 | + | ||
143 | +elif [[ "$1" == "mmcblk"* ]]; then | ||
144 | + if [ "$1" != "mmcblk" ]; then | ||
145 | + P1_NUM="p1" | ||
146 | + P2_NUM="p2" | ||
147 | + else | ||
148 | + echo "Missing Partition Number" | ||
149 | + exit | ||
150 | + fi | ||
151 | +else | ||
152 | + echo "Wrong Device Name" | ||
153 | + exit | ||
154 | +fi | ||
155 | + | ||
156 | + | ||
129 | if [ "$1" != "" ]; then | 157 | if [ "$1" != "" ]; then |
130 | DEVNAME=$1 | 158 | DEVNAME=$1 |
131 | fi | 159 | fi |
132 | 160 | ||
133 | DEV_PATH="/dev/${DEVNAME}" | 161 | DEV_PATH="/dev/${DEVNAME}" |
134 | -DEV_PATH_P1="${DEV_PATH}p1" | ||
135 | -MOUNT_PATH_P1="/tmp/${DEVNAME}p1" | 162 | +DEV_PATH_P1="${DEV_PATH}${P1_NUM}" |
163 | +MOUNT_PATH_P1="/tmp/${DEVNAME}${P1_NUM}" | ||
136 | 164 | ||
137 | echo "" | 165 | echo "" |
138 | echo "================================" | 166 | echo "================================" |
@@ -142,4 +170,18 @@ echo "P1 MountPath: $MOUNT_PATH_P1" | @@ -142,4 +170,18 @@ echo "P1 MountPath: $MOUNT_PATH_P1" | ||
142 | echo "================================" | 170 | echo "================================" |
143 | echo "" | 171 | echo "" |
144 | 172 | ||
145 | -main | 173 | +read -p "IS Right? (y/n): " -n 2 -e IS_RIGHT |
174 | + | ||
175 | +if [ "$IS_RIGHT" == "y" ]; then | ||
176 | + main | ||
177 | +elif [ "$IS_RIGHT" == "Y" ]; then | ||
178 | + main | ||
179 | +else | ||
180 | + echo -e "Exit This Script" | ||
181 | + exit | ||
182 | +fi | ||
183 | + | ||
184 | + | ||
185 | + | ||
186 | + | ||
187 | + |
scripts/mk-fusingsd.sh
@@ -3,6 +3,10 @@ | @@ -3,6 +3,10 @@ | ||
3 | C_NC='\033[0m' | 3 | C_NC='\033[0m' |
4 | C_LRED='\033[1;31m' | 4 | C_LRED='\033[1;31m' |
5 | 5 | ||
6 | +#### Partition Number #### | ||
7 | +P1_NUM="1" | ||
8 | +P2_NUM="2" | ||
9 | + | ||
6 | DEVNAME="mmcblk0" | 10 | DEVNAME="mmcblk0" |
7 | DEV_PATH="/dev/mmcblk0" | 11 | DEV_PATH="/dev/mmcblk0" |
8 | DEV_PATH_P1="/dev/mmcblk0p1" | 12 | DEV_PATH_P1="/dev/mmcblk0p1" |
@@ -45,8 +49,8 @@ function run_format() | @@ -45,8 +49,8 @@ function run_format() | ||
45 | echo "" | 49 | echo "" |
46 | echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}" | 50 | echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}" |
47 | echo "" | 51 | echo "" |
48 | - echo "y" | mkfs.ext4 ${DEV_PATH}p1 -L BOOT0 | ||
49 | - echo "y" | mkfs.ext4 ${DEV_PATH}p2 -L DATA | 52 | + echo "y" | mkfs.ext4 ${DEV_PATH}${P1_NUM} -L BOOT0 |
53 | + echo "y" | mkfs.ext4 ${DEV_PATH}${P2_NUM} -L DATA | ||
50 | } | 54 | } |
51 | 55 | ||
52 | function run_mount() | 56 | function run_mount() |
@@ -58,7 +62,7 @@ function run_mount() | @@ -58,7 +62,7 @@ function run_mount() | ||
58 | mkdir ${MOUNT_PATH_P1} | 62 | mkdir ${MOUNT_PATH_P1} |
59 | fi | 63 | fi |
60 | 64 | ||
61 | - mount ${DEV_PATH}p1 ${MOUNT_PATH_P1} | 65 | + mount ${DEV_PATH}${P1_NUM} ${MOUNT_PATH_P1} |
62 | } | 66 | } |
63 | 67 | ||
64 | function run_umount() | 68 | function run_umount() |
@@ -107,7 +111,8 @@ function Init_Unmount() | @@ -107,7 +111,8 @@ function Init_Unmount() | ||
107 | echo "" | 111 | echo "" |
108 | echo -e "${C_LRED}### Unmount SD - Init_Unmount() ###${C_NC}" | 112 | echo -e "${C_LRED}### Unmount SD - Init_Unmount() ###${C_NC}" |
109 | echo "" | 113 | echo "" |
110 | - umount $DEV_PATH_P1 | 114 | +# umount $DEV_PATH_P1 |
115 | + umount $DEV_PATH* | ||
111 | } | 116 | } |
112 | 117 | ||
113 | function main() | 118 | function main() |
@@ -126,13 +131,36 @@ function main() | @@ -126,13 +131,36 @@ function main() | ||
126 | sync | 131 | sync |
127 | } | 132 | } |
128 | 133 | ||
134 | +if [[ "$1" == "sd"* ]]; then | ||
135 | + if [ "$1" != "sd" ]; then | ||
136 | + P1_NUM="1" | ||
137 | + P2_NUM="2" | ||
138 | + else | ||
139 | + echo "Missing Partition Number" | ||
140 | + exit | ||
141 | + fi | ||
142 | + | ||
143 | +elif [[ "$1" == "mmcblk"* ]]; then | ||
144 | + if [ "$1" != "mmcblk" ]; then | ||
145 | + P1_NUM="p1" | ||
146 | + P2_NUM="p2" | ||
147 | + else | ||
148 | + echo "Missing Partition Number" | ||
149 | + exit | ||
150 | + fi | ||
151 | +else | ||
152 | + echo "Wrong Device Name" | ||
153 | + exit | ||
154 | +fi | ||
155 | + | ||
156 | + | ||
129 | if [ "$1" != "" ]; then | 157 | if [ "$1" != "" ]; then |
130 | DEVNAME=$1 | 158 | DEVNAME=$1 |
131 | fi | 159 | fi |
132 | 160 | ||
133 | DEV_PATH="/dev/${DEVNAME}" | 161 | DEV_PATH="/dev/${DEVNAME}" |
134 | -DEV_PATH_P1="${DEV_PATH}p1" | ||
135 | -MOUNT_PATH_P1="/tmp/${DEVNAME}p1" | 162 | +DEV_PATH_P1="${DEV_PATH}${P1_NUM}" |
163 | +MOUNT_PATH_P1="/tmp/${DEVNAME}${P1_NUM}" | ||
136 | 164 | ||
137 | echo "" | 165 | echo "" |
138 | echo "================================" | 166 | echo "================================" |
@@ -142,4 +170,18 @@ echo "P1 MountPath: $MOUNT_PATH_P1" | @@ -142,4 +170,18 @@ echo "P1 MountPath: $MOUNT_PATH_P1" | ||
142 | echo "================================" | 170 | echo "================================" |
143 | echo "" | 171 | echo "" |
144 | 172 | ||
145 | -main | 173 | +read -p "IS Right? (y/n): " -n 2 -e IS_RIGHT |
174 | + | ||
175 | +if [ "$IS_RIGHT" == "y" ]; then | ||
176 | + main | ||
177 | +elif [ "$IS_RIGHT" == "Y" ]; then | ||
178 | + main | ||
179 | +else | ||
180 | + echo -e "Exit This Script" | ||
181 | + exit | ||
182 | +fi | ||
183 | + | ||
184 | + | ||
185 | + | ||
186 | + | ||
187 | + |