diff options
author | Peter Palfrader <peter@palfrader.org> | 2016-02-09 18:58:09 +0100 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2016-02-09 18:58:26 +0100 |
commit | 5ff178b8a0c88ec142c8b44038992949ccf36f93 (patch) | |
tree | 23ea13d14ba356c46a2a7a99ae3d39eef2b32537 /recvconf | |
parent | d3e326113f332fa4da2248d49fb3e6843de9ce5d (diff) |
Support reading file from elsewhere
Diffstat (limited to 'recvconf')
-rwxr-xr-x | recvconf | 46 |
1 files changed, 39 insertions, 7 deletions
@@ -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 |