diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index e57515d5..75418f1c 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -120,7 +120,6 @@ EOM # Content of Pi-hole's meta package control file on RPM based systems PIHOLE_META_PACKAGE_CONTROL_RPM=$( cat </dev/null || return 1 + # remove leftover package if it exists from previous runs + rm -f /tmp/pihole-meta.deb + # Prepare directory structure and control file - mkdir -p /tmp/pihole-meta/DEBIAN - chmod 0755 /tmp/pihole-meta/DEBIAN - touch /tmp/pihole-meta/DEBIAN/control + mkdir -p "${tempdir}"/DEBIAN + chmod 0755 "${tempdir}"/DEBIAN + touch "${tempdir}"/DEBIAN/control # Write the control file - echo "${PIHOLE_META_PACKAGE_CONTROL_APT}" > /tmp/pihole-meta/DEBIAN/control + echo "${PIHOLE_META_PACKAGE_CONTROL_APT}" > "${tempdir}"/DEBIAN/control # Build the package - dpkg-deb --build --root-owner-group pihole-meta + dpkg-deb --build --root-owner-group "${tempdir}" pihole-meta.deb # Move back into the directory the user started in popd &> /dev/null || return 1 @@ -479,10 +490,13 @@ build_dependency_package(){ # move into the tmp directory pushd /tmp &>/dev/null || return 1 + # remove leftover package if it exists from previous runs + rm -f /tmp/pihole-meta.rpm + # Prepare directory structure and spec file - mkdir -p /tmp/pihole-meta/SPECS - touch /tmp/pihole-meta/SPECS/pihole-meta.spec - echo "${PIHOLE_META_PACKAGE_CONTROL_RPM}" > /tmp/pihole-meta/SPECS/pihole-meta.spec + mkdir -p "${tempdir}"/SPECS + touch "${tempdir}"/SPECS/pihole-meta.spec + echo "${PIHOLE_META_PACKAGE_CONTROL_RPM}" > "${tempdir}"/SPECS/pihole-meta.spec # check if we need to install the build dependencies if ! is_command rpmbuild; then @@ -491,10 +505,10 @@ build_dependency_package(){ fi # Build the package - rpmbuild -bb /tmp/pihole-meta/SPECS/pihole-meta.spec + rpmbuild -bb "${tempdir}"/SPECS/pihole-meta.spec --define "_topdir ${tempdir}" # Move the package to the /tmp directory - mv /tmp/pihole-meta/RPMS/noarch/pihole-meta*.rpm /tmp/pihole-meta.rpm + mv "${tempdir}"/RPMS/noarch/pihole-meta*.rpm /tmp/pihole-meta.rpm # Remove the build dependencies when we've installed them if [ -n "${REMOVE_RPM_BUILD}" ]; then @@ -506,7 +520,7 @@ build_dependency_package(){ fi # Remove the build directory - rm -rf /tmp/pihole-meta + rm -rf "${tempdir}" } # A function for checking if a directory is a git repository