From f3237ecc9fe9ec955628fa831ea77c3530266e86 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Fri, 16 Feb 2018 00:20:58 +0000 Subject: [PATCH] quote every test(1)ed variable --- imagesync.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/imagesync.sh b/imagesync.sh index 8a91d60..52ae851 100755 --- a/imagesync.sh +++ b/imagesync.sh @@ -81,16 +81,16 @@ done # Check if mandatory parameters are missing -if [ -z $disk ];then +if [ -z "$disk" ];then error_fatal "The disk parameter is missing" fi -if [ -z $root ];then +if [ -z "$root" ];then error_fatal "The root parameter is missing" fi -if [ -z $partsize ];then +if [ -z "$partsize" ];then error_fatal "The partsize parameter is missing" fi -if [ -z $torrent ];then +if [ -z "$torrent" ];then error_fatal "The torrent parameter is missing" fi print_done @@ -126,7 +126,7 @@ fi print_waiting "Checking root filesystem" e2fsck -y $root fsck=$? -if [ $fsck != 0 ] && [ $fsck != 1 ] || [ "$rewrite_rootfs" == "true" ];then +if [ "$fsck" != 0 ] && [ "$fsck" != 1 ] || [ "$rewrite_rootfs" == "true" ];then print_done print_waiting "Creating root filesystem" mke2fs -q -F -t ext4 $root @@ -139,7 +139,7 @@ fi # TEMPORARY NETWORK CONFIG (only for qemu) ## -if ! [ -z $qemu ];then +if ! [ -z "$qemu" ];then print_waiting "Setting up temporary network config" ip addr add 10.2.2.2/24 dev ens3 ip link set ens3 up @@ -180,7 +180,7 @@ echo ' # --console-log-level=error: Only show errors # --dht-file-path=dht.dat: use generated dht data file and do not complain download=true -while [ $download == true ];do +while [ "$download" == true ];do aria2c --allow-overwrite --check-integrity --seed-time=0 --summary-interval=0 --console-log-level=error --dht-file-path=dht.dat $torrent if [ $? == 0 ];then download=false @@ -195,7 +195,7 @@ print_waiting "Comparing installed and remote image" if [ -f /tmp_root/.build_uuid ];then cd /tmp tar xzf /tmp_root/rootfs.tar.gz .build_uuid - if [ $(cat .build_uuid) == $(cat /tmp_root/.build_uuid) ];then + if [ "$(cat .build_uuid)" == "$(cat /tmp_root/.build_uuid)" ];then sync=false print_done else @@ -214,7 +214,7 @@ else print_done fi -if [ $sync == "true" ];then +if [ "$sync" == "true" ];then print_waiting "Extracting root filesystem image" tar xzf rootfs.tar.gz print_done