nmhw-auto-part: identify mmc dev automatically
BugzID: 57868 Signed-off-by: Ramon Moesching <ramon.moesching@netmodule.com>
This commit is contained in:
parent
6184e87018
commit
aeb0cbfeda
|
|
@ -5,6 +5,42 @@ green="\e[32m"
|
||||||
normal="\e[0m"
|
normal="\e[0m"
|
||||||
bold="\e[1m"
|
bold="\e[1m"
|
||||||
|
|
||||||
|
detect_mmc(){
|
||||||
|
|
||||||
|
local rootcmd
|
||||||
|
local bootpart
|
||||||
|
|
||||||
|
if [ -f /proc/cmdline ] ; then
|
||||||
|
|
||||||
|
rootcmd=$(cat /proc/cmdline | sed "s/ /\n/g" | grep "root=/dev/m")
|
||||||
|
if [[ $rootcmd == *"mmc"* ]]; then
|
||||||
|
|
||||||
|
if [[ $rootcmd == *"ostree_root"* ]]; then
|
||||||
|
bootpart=${rootcmd//ostree_root=/}
|
||||||
|
|
||||||
|
elif [[ $rootcmd == *"root"* ]]; then
|
||||||
|
bootpart=${rootcmd//root=/}
|
||||||
|
fi
|
||||||
|
|
||||||
|
#echo Device: ${bootpart:11:1}
|
||||||
|
#echo Partnbr: ${bootpart:13:1}
|
||||||
|
mmc_detect_part="/dev/mmcblk${bootpart:11:1}p${bootpart:13:1}"
|
||||||
|
|
||||||
|
if [[ $mmc_detect_part != $bootpart ]]; then
|
||||||
|
echo Wrong mmc detected
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
mmc_detect_dev="/dev/mmcblk${bootpart:11:1}"
|
||||||
|
#echo MMC $mmc_detect_dev found
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo No mmc boot
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
device_available(){
|
device_available(){
|
||||||
local device=$1
|
local device=$1
|
||||||
if [ -e $device ] ; then
|
if [ -e $device ] ; then
|
||||||
|
|
@ -177,10 +213,11 @@ interactive_mode(){
|
||||||
|
|
||||||
d=0
|
d=0
|
||||||
while [ $d -eq 0 ]; do
|
while [ $d -eq 0 ]; do
|
||||||
printf "Enter device to expand $bold$green[/dev/mmcblk1]$normal:\n"
|
detect_mmc
|
||||||
|
printf "Enter device to expand $bold$green[$mmc_detect_dev]$normal:\n"
|
||||||
read device
|
read device
|
||||||
if [ -z ${device} ] ; then
|
if [ -z ${device} ] ; then
|
||||||
device="/dev/mmcblk1"
|
device=$mmc_detect_dev
|
||||||
printf "Using $device\n\n"
|
printf "Using $device\n\n"
|
||||||
fi
|
fi
|
||||||
device_available $device && d=1
|
device_available $device && d=1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue