+# Non-privileged backups currently have a few limitations compared to regular ones:
+#
+# - No .idx files.
+# - No .snar-style incremental backups, only date-based.
+# - No touching of .lastbackup for Nagios.
+# - Failed tar operations may go undetected, since we only see the error code
+# the last process in the pipe chain, which is gpg.
+# - No storageprogram support (see above), because the file is typically already
+# encrypted.
+nonprivbackup()
+{
+ infomsg "$computer:$filesystem $backuplevel non-privileged backup"
+
+ if [ "$backuplevel" = "daily" ]; then
+ lastd=`cat ../.date`
+ lastcmd="'$lastd'"
+ else
+ lastcmd=""
+ fi
+
+ TARFILE=$DATE.tmp
+ TARCMD="ssh -n $username@$computer \"sudo /usr/local/sbin/output-encrypted-backup $filesystem $lastcmd\""
+ infomsg "Running $TARCMD"
+ eval $TARCMD > $TARFILE
+
+ if [ $? -eq 0 ] && [ -s $TARFILE ]; then
+ # File is >0 in size and the remote side did not report any fatal errors; we assume it worked.
+
+ # Move tar file in place
+ mv $TARFILE $DATE.tgz.gpg
+
+ # Update timestamp
+ echo $DATEs > ../.date && touch -t $DATE ../.date
+
+ # Fix permissions
+ chmod 600 *tgz.gpg #only for us
+ else
+ # Something wrong happened.
+ rm $TARFILE
+ diemsg "tar failed or $TARFILE empty. $backuplevel backup of $computer:$filesystem failed and deleted"
+ fi
+}
+
+# Get basic configuration.
+storagedir=$( findconf storagedir $computer )
+username=$( findconf username $computer )
+exclude=$( findconf excludefile $computer )
+