1 level=$1 2 # 3 # Construct basename for dump records 4 FS=`echo $2 | sed -e '1,$s?/?:?g'` 5 echo Dump root = $2 Level = $level 6 echo -n Finding files to dump... 7 8 DUMPFILES=/tmp/backup$$ 9 #Remove any existing DUMPFILES to avoid possible security exploits 10 if [ -e ${DUMPFILES} ]; then /bin/rm -f ${DUMPFILES}; fi 11 #for cleanup 12 trap "rm -f ${DUMPFILES}; exit 1" 1 2 3 4 5 7 9 10 12 15 13 14 date +"%b %d %H:%M" > /usr/adm/dump/newdump$$ 15 # 16 # If it is a level 0 dump simply dump everything... 17 if [ $level = 0 ] 18 then 19 find $2 | grep -v -f /usr/adm/dump/DONTDUMP > ${DUMPFILES} 20 echo done 21 cat ${DUMPFILES} | afio -o -v -f -b 1024 -s 1440x -F -Z /dev/fd0H1440 22 else 23 # 24 # Otherwise dump only stuff newer... 25 # 26 # Get the date of the most recent dump with the highest level <= $level] 27 prevdump=`ls --reverse /usr/adm/dump/${FS}.[0-${level}] | head --lines=1` 28 if [ "x${prevdump}" = x ] 29 then 30 echo failed 31 echo backup: No lower level dump - cannot do level $level dump 32 exit 1 33 fi 34 find $2 -cnewer ${prevdump} | grep -v -f /usr/adm/dump/DONTDUMP > ${DUMPFILES} 35 echo done 36 fi 37 cat ${DUMPFILES} | afio -o -v -f -b 1024 -s 1440x -F -Z /dev/fd0H1440 38 /bin/rm -f ${DUMPFILES} 39 # 40 # All higher level dumps are now invalidated 41 /bin/rm -f /usr/adm/dump/${FS}.[${level}-9] 42 # 43 # Record date of dump future reference 44 mv /usr/adm/dump/newdump$$ /usr/adm/dump/${FS}.${level}