File afio-script1.dif of Package afio
--- script1/DONTDUMP
+++ script1/DONTDUMP 2004/01/30 13:02:34
@@ -1 +1 @@
-^/usr/local/lib/tex/fonts/pk\|^/tmp\|^/usr/local/src
++^/dev\|^/proc\|^/tmp\|^/var/tmp
--- script1/backup
+++ script1/backup 2004/01/30 13:01:13
@@ -1,22 +1,34 @@
-level=$1
+#! /bin/bash
+
+DUMP_DIR="/var/adm/dump"
+AFIO_ARGS="-o -v -f -b 1024 -s 1440x -F -Z /dev/fd0u1440"
+
+# numeric level
+level=$(($1))
+
#
# Construct basename for dump records
FS=`echo $2 | sed -e '1,$s?/?:?g'`
echo Dump root = $2 Level = $level
echo -n Finding files to dump...
-DUMPFILES=/tmp/backup$$
-#Remove any existing DUMPFILES to avoid possible security exploits
-if [ -e ${DUMPFILES} ]; then /bin/rm -f ${DUMPFILES}; fi
+# create uniq tmp directory
+TMPDIR=$(/bin/mktemp -d /tmp/XXXXXXXXXX) || {
+ echo 'unable to create temp directory!'
+ exit 1
+}
#for cleanup
-trap "rm -f ${DUMPFILES}; exit 1" 1 2 3 4 5 7 9 10 12 15
+trap "rm -rf ${TMPDIR}; exit 1" 1 2 3 4 5 7 9 10 12 15
-date +"%b %d %H:%M" > /usr/adm/dump/newdump$$
+DUMPFILES=${TMPDIR}/backup$$
+NEWDUMP=${TMPDIR}/newdump$$
+
+date +"%b %d %H:%M" > ${NEWDUMP}
#
# If it is a level 0 dump simply dump everything...
if [ $level = 0 ]
then
-find $2 | grep -v -f /usr/adm/dump/DONTDUMP > ${DUMPFILES}
+find $2 | grep -v -f ${DUMP_DIR}/DONTDUMP > ${DUMPFILES}
echo done
cat ${DUMPFILES} | afio -o -v -f -b 1024 -s 1440x -F -Z /dev/fd0H1440
else
@@ -24,21 +36,22 @@
# Otherwise dump only stuff newer...
#
# Get the date of the most recent dump with the highest level <= $level]
-prevdump=`ls --reverse /usr/adm/dump/${FS}.[0-${level}] | head --lines=1`
+prevdump=`ls --reverse ${DUMP_DIR}/${FS}.[0-${level}] | head --lines=1`
if [ "x${prevdump}" = x ]
then
echo failed
echo backup: No lower level dump - cannot do level $level dump
exit 1
fi
-find $2 -cnewer ${prevdump} | grep -v -f /usr/adm/dump/DONTDUMP > ${DUMPFILES}
+find $2 -cnewer ${prevdump} | grep -v -f ${DUMP_DIR}/DONTDUMP > ${DUMPFILES}
echo done
fi
-cat ${DUMPFILES} | afio -o -v -f -b 1024 -s 1440x -F -Z /dev/fd0H1440
+cat ${DUMPFILES} | afio ${AFIO_ARGS}
/bin/rm -f ${DUMPFILES}
#
# All higher level dumps are now invalidated
-/bin/rm -f /usr/adm/dump/${FS}.[${level}-9]
+/bin/rm -f ${DUMP_DIR}/${FS}.[${level}-9]
#
# Record date of dump future reference
-mv /usr/adm/dump/newdump$$ /usr/adm/dump/${FS}.${level}
+/bin/mv -f ${NEWDUMP} ${DUMP_DIR}/${FS}.${level}
+