From 20756210d4b82024d50a517957ab208dcac63a56 Mon Sep 17 00:00:00 2001 From: Drew Moseley Date: Wed, 19 Aug 2020 14:17:55 -0400 Subject: [PATCH] Fix error when chown a non-existent directory. Changelog: None Signed-off-by: Drew Moseley --- scripts/bootstrap-rootfs-overlay-demo-server.sh | 2 +- scripts/bootstrap-rootfs-overlay-hosted-server.sh | 2 +- scripts/bootstrap-rootfs-overlay-production-server.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap-rootfs-overlay-demo-server.sh b/scripts/bootstrap-rootfs-overlay-demo-server.sh index b608c20..59e1967 100755 --- a/scripts/bootstrap-rootfs-overlay-demo-server.sh +++ b/scripts/bootstrap-rootfs-overlay-demo-server.sh @@ -52,7 +52,7 @@ if [ -z "${server_ip}" ]; then exit 1 fi -sudo chown -R $(id -u).$(id -g) ${output_dir} +[ -e ${output_dir} ] && sudo chown -R $(id -u).$(id -g) ${output_dir} mkdir -p ${output_dir}/etc/mender cat <<- EOF > ${output_dir}/etc/mender/mender.conf { diff --git a/scripts/bootstrap-rootfs-overlay-hosted-server.sh b/scripts/bootstrap-rootfs-overlay-hosted-server.sh index e73c514..e7abd1e 100755 --- a/scripts/bootstrap-rootfs-overlay-hosted-server.sh +++ b/scripts/bootstrap-rootfs-overlay-hosted-server.sh @@ -53,7 +53,7 @@ if [ -z "${tenant_token}" ]; then exit 1 fi -sudo chown -R $(id -u).$(id -g) ${output_dir} +[ -e ${output_dir} ] && sudo chown -R $(id -u).$(id -g) ${output_dir} mkdir -p ${output_dir}/etc/mender cat <<- EOF > ${output_dir}/etc/mender/mender.conf { diff --git a/scripts/bootstrap-rootfs-overlay-production-server.sh b/scripts/bootstrap-rootfs-overlay-production-server.sh index ef70c8d..e0f868f 100755 --- a/scripts/bootstrap-rootfs-overlay-production-server.sh +++ b/scripts/bootstrap-rootfs-overlay-production-server.sh @@ -57,7 +57,7 @@ if [ -z "${server_url}" ]; then exit 1 fi -sudo chown -R $(id -u).$(id -g) ${output_dir} +[ -e ${output_dir} ] && sudo chown -R $(id -u).$(id -g) ${output_dir} mkdir -p ${output_dir}/etc/mender cat <<- EOF > ${output_dir}/etc/mender/mender.conf {