"Fossies" - the Fresh Open Source Software Archive 
Member "afio-2.5.2/script2/backup" (30 Nov 2018, 1510 Bytes) of package /linux/misc/afio-2.5.2.tgz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!/bin/bash
2 # DON'T use the Zsh to run this, IT WON'T WORK RIGHT.
3
4 # Required:
5 # bash, afio (2.3.6-dpg-1 or higher), gzip, find, sort
6 # Optional:
7 # cat (if non-filtered backups required)
8 # egrep, perl (if filtered backups required)
9
10 # Some defaults
11 # Gzip compression factor
12 opt_G=6
13 # Gzip threshold
14 opt_T=1k
15
16 # Function to ask user if a backup is to be performed, and to do it if they say okay.
17 AFIO ()
18 {
19 local excludecmd
20 local foo
21
22 echo -n "$1 backup on $3:$2, \"go\" to continue, other to skip: "
23 read foo
24 if test "$foo" = "go"; then
25 if test $# = 3; then
26 excludecmd=cat
27 else
28 excludecmd="egrep -v `perl -p -e 'if ($eols) {print "|";} else {$eols=1} s/\n$//;' < $4`"
29 fi
30 # You might want to lose the `sort' if you have a very big filesystem.
31 # Note that though 512 is the floppy sector size, we do a -b 1024 because
32 # the Linux floppy driver handles floppies in 1024 byte blocks internally.
33 find $1 | $excludecmd | sort | afio -ovzFKZx -G $opt_G -T $opt_T -s $2 -b 1024 $3
34 fi
35 }
36
37 cd /
38 opt_G=5 AFIO "home" 720k /dev/fd0 /etc/backup/x.home
39 AFIO "*" 1440k /dev/fd0 /etc/backup/x.dot
40 opt_G=9 AFIO "home/ftp/pub" 1440k /dev/fd0
41 opt_G=9 AFIO "/usr/X386 /usr/local/X386 /usr/TeX" 720k /dev/fd0
42 opt_G=9 AFIO "/usr/man /usr/local/man /usr/info" 720k /dev/fd0
43 opt_G=9 AFIO "/usr/lib/emacs" 720k /dev/fd0
44
45 # This is where I mount my backup fs from the normal root fs.
46 cd /mnt/backup
47 echo -n "./mnt2.1/"; AFIO . 360k /dev/fd1
48 echo -n "./mnt2.2/"; AFIO . 720k /dev/fd0
49
50