Only sudo rm if necessary
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 30 Dec 2016 16:52:28 +0000 (17:52 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 30 Dec 2016 16:52:28 +0000 (17:52 +0100)
id-deb-build/docker-build.sh

index e608f79..ce331a6 100755 (executable)
@@ -141,7 +141,7 @@ fi
 
 if $centos; then
     for dist in ${CENTOS_DIST}; do
-       sudo rm -fr build/centos/$dist
+       test -d build/centos/$dist && sudo rm -fr build/centos/$dist
        mkdir -p build/centos/$dist/rpmbuild
        mkdir -p build/centos/$dist/rpmbuild/BUILD
        mkdir -p build/centos/$dist/rpmbuild/BUILDROOT
@@ -186,7 +186,7 @@ if $debian; then
 
     if test "${DEBIAN_DIST}"; then
        for dist in ${DEBIAN_DIST}; do
-           sudo rm -fr build/debian/$dist
+           test -f build/debian/$dist && sudo rm -fr build/debian/$dist
            mkdir -p build/debian
            cp -a deb-src build/debian/$dist
            cp ${ID_DEB_BUILD}/in-docker.sh build/debian/$dist