From: Frank Brehm Date: Wed, 20 Mar 2024 13:25:55 +0000 (+0100) Subject: Fixing usage of mktemp in shell scripts X-Git-Tag: 1.0.2~1^2 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=9d38015453caa696fdcdcc2ef93b42a3e83b9966;p=pixelpark%2Fpp-admin-tools.git Fixing usage of mktemp in shell scripts --- diff --git a/scripts/disabling-ldap-user b/scripts/disabling-ldap-user index 18254ef..26e6262 100755 --- a/scripts/disabling-ldap-user +++ b/scripts/disabling-ldap-user @@ -9,7 +9,7 @@ QUIET='n' SIMULATE='n' YES="n" -VERSION="1.4" +VERSION="1.5" # console colors: RED="" @@ -914,7 +914,7 @@ main() { get_options "$@" debug "Creating temporary LDIF file ..." - LDIF_FILE=$( mktemp disable-user.XXXXXXXX.ldif ) + LDIF_FILE=$( mktemp -t disable-user.XXXXXXXX.ldif ) debug "Temporary file is '${CYAN}${LDIF_FILE}${NORMAL}'." trap cleanup_tmp_file INT TERM EXIT ABRT diff --git a/scripts/get-dns-zonefiles b/scripts/get-dns-zonefiles index 1ed06a4..eb46b28 100755 --- a/scripts/get-dns-zonefiles +++ b/scripts/get-dns-zonefiles @@ -115,7 +115,7 @@ get_zone() { echo >&2 info "Get zone '${GREEN}${zone}${NORMAL}' ..." - local tmpfile=$( mktemp "${zone}.XXXXXXXXXX.zone" ) + local tmpfile=$( mktemp -t "${zone}.XXXXXXXXXX.zone" ) local i=0 local zone_file="${zone}.$( cur_ts ).${i}.zone" while [[ -e "${zone_file}" ]] ; do diff --git a/scripts/get-k8s-master-configs b/scripts/get-k8s-master-configs index 9a915ed..c396aa5 100755 --- a/scripts/get-k8s-master-configs +++ b/scripts/get-k8s-master-configs @@ -7,7 +7,7 @@ VERBOSE="n" DEBUG="n" QUIET='n' -VERSION="1.0" +VERSION="1.1" # console colors: RED="" @@ -413,7 +413,7 @@ get_config() { return 0 fi - TEMPFILE=$( mktemp ) + TEMPFILE=$( mktemp -t kube.XXXXXXXXXX.config ) debug "Temporary file is '${TEMPFILE}'." trap cleanup_tmp_file INT TERM EXIT ABRT diff --git a/scripts/set-ldap-inetuserstatus b/scripts/set-ldap-inetuserstatus index 6881a6a..d40621b 100755 --- a/scripts/set-ldap-inetuserstatus +++ b/scripts/set-ldap-inetuserstatus @@ -8,7 +8,7 @@ MY_REAL_NAME=$( readlink -f $0 ) BIN_DIR=$( dirname "${MY_REAL_NAME}" ) BASE_DIR=$( dirname "${BIN_DIR}" ) -VERSION="0.1" +VERSION="0.2" if [[ -f "${BIN_DIR}/functions.rc" ]] ; then . "${BIN_DIR}/functions.rc" @@ -462,7 +462,7 @@ main() { get_options "$@" debug "Creating temporary LDIF file ..." - LDIF_FILE=$( mktemp disable-user.XXXXXXXX.ldif ) + LDIF_FILE=$( mktemp -t disable-user.XXXXXXXX.ldif ) debug "Temporary file is '${CYAN}${LDIF_FILE}${NORMAL}'." trap cleanup_tmp_file INT TERM EXIT ABRT