summaryrefslogtreecommitdiff
path: root/recvconf
diff options
context:
space:
mode:
Diffstat (limited to 'recvconf')
-rwxr-xr-xrecvconf46
1 files changed, 39 insertions, 7 deletions
diff --git a/recvconf b/recvconf
index dcfd3a8..b415779 100755
--- a/recvconf
+++ b/recvconf
@@ -1,13 +1,51 @@
#!/bin/bash -e
## Copyright (c) 2005 David B. Harris <dbharris@eelf.ddts.net>
-## Copyright (c) 2005 Peter Palfrader <peter@palfrader.org>
+## Copyright (c) 2005,2016 Peter Palfrader <peter@palfrader.org>
## This text is released under the "three-clause BSD license".
## The full text of the license is available at the end of this file.
+set -e
+set -u
+
printf "\nrecvconf on %s processing:\n" "$(hostname -s)"
+
FILELIST=/etc/NOREPLY/recvconf.files
+while [ "$#" -gt 0 ]; do
+ case "$1" in
+ -f)
+ shift;
+ FILELIST="$1"; shift
+ ;;
+ *)
+ echo >&2 "Usage: $0 [-f <recvconf.files>"
+ exit 1
+ ;;
+ esac
+done
+
+temptar=""
+tempscript=""
+tempoutput=""
+tempdir=""
+
+cleanup() {
+ cd /
+ if [ -n "$temptar" ]; then
+ rm -f "$temptar"
+ fi
+ if [ -n "$tempscript" ]; then
+ rm -f "$tempscript"
+ fi
+ if [ -n "$tempoutput" ]; then
+ rm -f "$tempoutput"
+ fi
+ if [ -n "$tempdir" ]; then
+ rm -rf "$tempdir"
+ fi
+}
+trap 'cleanup' EXIT
temptar="$(mktemp)"
chmod 0600 "$temptar"
@@ -157,12 +195,6 @@ if [ ! -z "$(find . -type f)" ]; then
exit 1
fi
-rm -f -- "$temptar"
-rm -f -- "$tempoutput"
-rm -f -- "$tempscript"
-cd
-rm -rf -- "$tempdir"
-
printf "recvconf on %s finished.\n" "$(hostname -s)"
## Redistribution and use in source and binary forms, with or without