card-helpers.inc: rework common script parameter handling

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2018-10-03 12:48:51 +02:00
parent 7ee6d9c3c4
commit b6556eac05

View File

@@ -279,15 +279,22 @@ StartCardKernelWrite() {
CheckPrerequisite "dialog"
CheckPrerequisite "lsblk"
# For user call the first two params can be set optionally - the first
# target/source dialogs won't be displayed then
# reintoduce spaces
DevicePath="`echo $1 | sed 's:%20: :g'`"
DeployedFile="`echo $2 | sed 's:%20: :g'`"
# For root call all params are mandatory
# Common script parameter handling for all scripts
if [ $( id -u ) -eq 0 ]; then
# For root call all params are mandatory. It is important to
# * have the same signature as set in RunUserStartRoot
# * reintroduce spaces
DevicePath="`echo $1 | sed 's:%20: :g'`"
DeployedFile="`echo $2 | sed 's:%20: :g'`"
DeployFileDir="`echo $3 | sed 's:%20: :g'`"
Machine="`echo $4 | sed 's:%20: :g'`"
FindString="`echo $5 | sed 's:%20: :g'`"
KernelImageType="`echo $6 | sed 's:%20: :g'`"
else
# User call params: By setiing them dialogs are not displayed. If
# one really wants, custom parameters can be appended after those
# set here
DevicePath=$1
DeployedFile=$2
SuSudoSelection=$3
fi