mirror of
https://codeberg.org/h3xx/you-dont-need-pihole.git
synced 2024-08-14 20:27:01 +00:00
Use a temporary directory
This commit is contained in:
parent
5cbc6f6158
commit
00b114c85a
1 changed files with 3 additions and 4 deletions
|
@ -8,9 +8,9 @@ CFG=$WORKDIR/update.cfg
|
|||
|
||||
. "$CFG"
|
||||
|
||||
TEMP_FILES=()
|
||||
TEMP_DIR=$(mktemp -d -t "${0##*/}.XXXXXX")
|
||||
cleanup() {
|
||||
rm -f -- "${TEMP_FILES[@]}"
|
||||
rm -fr -- "$TEMP_DIR"
|
||||
}
|
||||
trap 'cleanup' EXIT
|
||||
|
||||
|
@ -28,8 +28,7 @@ for (( I = 0 ; I < ${#OUT[@]} ; ++I )); do
|
|||
exit 2
|
||||
fi
|
||||
|
||||
TEMP_OUT=$(mktemp -t "${0##*/}.XXXXXX")
|
||||
TEMP_FILES+=("$TEMP_OUT")
|
||||
TEMP_OUT=$(mktemp -p "$TEMP_DIR")
|
||||
|
||||
if [[ -f $MY_OUT ]]; then
|
||||
cp -a -- "$MY_OUT" "$TEMP_OUT"
|
||||
|
|
Loading…
Reference in a new issue