summaryrefslogtreecommitdiffstats
path: root/tools/daisy-img-modify.sh
diff options
context:
space:
mode:
authorzhongjun <zhong.jun@zte.com.cn>2017-04-13 15:14:45 +0800
committerzhongjun <zhong.jun@zte.com.cn>2017-04-14 15:42:02 +0800
commit3f09e7e05515811537376ccad532ac52d4bd3305 (patch)
tree422c1e2a299d91130372fbb5fc3079cc61411f10 /tools/daisy-img-modify.sh
parent2cf7f098048ef0c11eb1321747b600230a495c88 (diff)
add the argument WORKDIR in daisy-img-modify.sh
the daisy install tmp workdir can be configurated as an input argument in deploy.sh,and it also should be used in subshell daisy-img-modify.sh,so add the input argument -w workdir in daisy-img-modify.sh. 1.add an input argument -w workdir in daisy-img-modify.sh. 2.modify the WORKDIR default value to /tmp/workdir/daisy. 3.code refactor to put the centos7.qcow2 file clean statement from the deploy.sh to daisy-img-modify.sh. Change-Id: Id375a15ad2839c209329e644c5e032d044604e7d Signed-off-by: zhongjun <zhong.jun@zte.com.cn>
Diffstat (limited to 'tools/daisy-img-modify.sh')
-rwxr-xr-xtools/daisy-img-modify.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/daisy-img-modify.sh b/tools/daisy-img-modify.sh
index 8e025168..f172ceec 100755
--- a/tools/daisy-img-modify.sh
+++ b/tools/daisy-img-modify.sh
@@ -15,19 +15,21 @@ usage()
{
cat << EOF
USAGE: `basename $0` [-c sub-Command] [-a IP Address] [-g Gateway IP address] [-s image Size in GB]
-
+ [-w workdir]
OPTIONS:
-c sub-command to modify the content
-a IP address for the sub-command to set in the image
-g gateway IP address for the sub-command to set in the image
-s image size of gigabytes. If it is absent, the image size will not be changed.
+ -w workdir for temporary usage, optional
+ -h print this message and exit
EXAMPLE:
sudo `basename $0` -c centos-img-modify.sh -a 10.20.11.2 -g 10.20.11.1 -s 100
EOF
}
-while getopts "c:a:g:s:h" OPTION
+while getopts "c:a:g:s:w:h" OPTION
do
case $OPTION in
c)
@@ -47,6 +49,9 @@ do
s)
img_size=${OPTARG}
;;
+ w)
+ WORKDIR=${OPTARG}
+ ;;
h)
usage
exit 0
@@ -206,6 +211,9 @@ cleanup() {
kpartx -dv $raw_imgfile || eliminate
fi
rm -f $raw_imgfile
+ if [ -f $imgfile ]; then
+ rm -rf $imgfile
+ fi
rm -rf $mountdir
}