m() { printf "%s\n" "$*"; "$@"; }
+# update file. note: duplicated in mail-setup
+u() {
+ local tmp tmpdir dest="$1"
+ local base="${dest##*/}"
+ local dir="${dest%/*}"
+ if [[ $dir != "$base" ]]; then
+ # dest has a directory component
+ mkdir -p "$dir"
+ fi
+ ur=false # u result
+ tmpdir=$(mktemp -d)
+ cat >$tmpdir/"$base"
+ tmp=$(rsync -ic $tmpdir/"$base" "$dest")
+ if [[ $tmp ]]; then
+ printf "%s\n" "$tmp"
+ ur=true
+ if [[ $dest == /etc/systemd/system/* ]]; then
+ reload=true
+ fi
+ fi
+ rm -rf $tmpdir
+}
+
+
uptime() {
if type -p uprecords &>/dev/null; then
uprecords -B