diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-09-16 19:26:25 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-09-16 19:26:25 +0200 |
commit | 4dc1eee385f1b5115976db8d6b60ca0a08ed05ce (patch) | |
tree | 8c2562a28e69949dee07563a8bedc6029d7acc9a /package/system/procd/files | |
parent | be049529e6a883601fd47303a05165a6a0b9a4a5 (diff) | |
download | mtk-20170518-4dc1eee385f1b5115976db8d6b60ca0a08ed05ce.zip mtk-20170518-4dc1eee385f1b5115976db8d6b60ca0a08ed05ce.tar.gz mtk-20170518-4dc1eee385f1b5115976db8d6b60ca0a08ed05ce.tar.bz2 |
package/system: probably from OpenWRT
Diffstat (limited to 'package/system/procd/files')
-rw-r--r-- | package/system/procd/files/nand.sh | 16 | ||||
-rw-r--r-- | package/system/procd/files/procd.sh | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/package/system/procd/files/nand.sh b/package/system/procd/files/nand.sh index 4aa56e3..fd2f943 100644 --- a/package/system/procd/files/nand.sh +++ b/package/system/procd/files/nand.sh @@ -10,6 +10,18 @@ CI_KERNPART="kernel" # 'ubi' partition on NAND contains UBI CI_UBIPART="ubi" +ubi_mknod() { + local dir="$1" + local dev="/dev/$(basename $dir)" + + [ -e "$dev" ] && return 0 + + local devid="$(cat $dir/dev)" + local major="${devid%%:*}" + local minor="${devid##*:}" + mknod "$dev" c $major $minor +} + nand_find_volume() { local ubidevdir ubivoldir ubidevdir="/sys/devices/virtual/ubi/$1" @@ -18,6 +30,7 @@ nand_find_volume() { [ ! -d "$ubivoldir" ] && continue if [ "$( cat $ubivoldir/name )" = "$2" ]; then basename $ubivoldir + ubi_mknod "$ubivoldir" return 0 fi done @@ -33,6 +46,7 @@ nand_find_ubi() { [ ! "$mtdnum" ] && continue if [ "$mtdnum" = "$cmtdnum" ]; then ubidev=$( basename $ubidevdir ) + ubi_mknod "$ubidevdir" echo $ubidev return 0 fi @@ -122,7 +136,7 @@ nand_upgrade_prepare_ubi() { ubiattach -m "$mtdnum" sync ubidev="$( nand_find_ubi "$CI_UBIPART" )" - [ -z "$has_env" ] || { + [ "$has_env" -gt 0 ] && { ubimkvol /dev/$ubidev -n 0 -N ubootenv -s 1MiB ubimkvol /dev/$ubidev -n 1 -N ubootenv2 -s 1MiB } diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index 1b19ba9..6d4cd9e 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -75,7 +75,7 @@ _procd_close_service() { } _procd_add_array_data() { - while [ -n "$1" ]; do + while [ "$#" -gt 0 ]; do json_add_string "" "$1" shift done |