aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2018-02-02 01:57:46 +0100
committerJohn Crispin <john@phrozen.org>2018-02-11 16:42:01 +0100
commitda52dd0c833d2ccf0be06838fc94d6f0865692c1 (patch)
treeb4494a54e4dc560462bd1f90362c6dc34aa92bb7 /package
parent25a72f5a01f80116d4cd0aafd99c0fd091be3fbd (diff)
downloadupstream-da52dd0c833d2ccf0be06838fc94d6f0865692c1.tar.gz
upstream-da52dd0c833d2ccf0be06838fc94d6f0865692c1.tar.bz2
upstream-da52dd0c833d2ccf0be06838fc94d6f0865692c1.zip
base-files: quote values when evaluating uevent
When sourcing /sys/class/block/*/uevent values have to be quoted as they may contain spaces (e.g. in PARTNAME). Fix this by pre-processing with sed before sourcing. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package')
-rw-r--r--package/base-files/files/lib/upgrade/common.sh5
1 files changed, 2 insertions, 3 deletions
diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index 71cffc8587..616131c89c 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -134,8 +134,7 @@ export_bootdevice() {
esac
if [ -e "$uevent" ]; then
- . "$uevent"
-
+ eval "$(sed "s/=\(.*\)/=\'\1\'/" < "$uevent")"
export BOOTDEV_MAJOR=$MAJOR
export BOOTDEV_MINOR=$MINOR
return 0
@@ -150,7 +149,7 @@ export_partdevice() {
local uevent MAJOR MINOR DEVNAME DEVTYPE
for uevent in /sys/class/block/*/uevent; do
- . "$uevent"
+ eval "$(sed "s/=\(.*\)/=\'\1\'/" < "$uevent")"
if [ $BOOTDEV_MAJOR = $MAJOR -a $(($BOOTDEV_MINOR + $offset)) = $MINOR -a -b "/dev/$DEVNAME" ]; then
export "$var=$DEVNAME"
return 0