File: backup

package info (click to toggle)
openswan 1%3A2.4.6%2Bdfsg.2-1.1%2Betch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 25,000 kB
  • ctags: 16,877
  • sloc: ansic: 121,112; sh: 19,782; xml: 9,699; asm: 4,422; perl: 4,087; makefile: 3,367; tcl: 713; exp: 657; yacc: 396; pascal: 328; lex: 289; sed: 265; awk: 124; lisp: 3
file content (80 lines) | stat: -rwxr-xr-x 1,218 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#! /bin/sh
# make backup of FreeSwan repository
# -l	local build only, do not transmit

#scphost=freeswan@xs1.xs4all.nl
scphost=henry@adams.freeswan.org
scpdir=backup
pfile=~freeswan/etc/relpass
ppfile=~freeswan/etc/bpp

PATH=/bin:/usr/bin
export PATH
umask 077

tmpdir=~freeswan/tmp
tarname=freeswan.tar

. ~freeswan/setup

cd $tmpdir
rm -f $tarname $tarname.gz
touch $tarname

cd ~freeswan
tar -cf $tmpdir/$tarname `ls -a |
	egrep -v '^(\.|\.\.|archive|\.nobak|\.ssh|\.ssh2|tmp)$'`

cd $tmpdir
gzip -9 $tarname
ls -l $tarname.gz

if test " $1" = " -l"
then
	exit 0
fi

echo updating >notice

date
expect -nN -c "
	set scphost $scphost
	set scpdir $scpdir
	set pfile $pfile
	set ppfile $ppfile
	set tarname $tarname
	"'
	# canned procedure for scp copying
	proc scp {from to} {
		global p scphost scpdir
		spawn scp2 -p -q $from $scphost:$scpdir/$to
		set timeout -1
		expect {
		"word:" {
			set fname $pfile
			# fall out
		}
		{":} {
			set fname $ppfile
			# fall out
		}
		eof {
			puts "eofed!"
			return
		}}
		sleep 3
		set f [open $fname r]
		set p [read $f]
		close $f
		send "$p\r"
		expect "\n"
		expect eof
		wait
	}

	scp notice $tarname.gz
	scp $tarname.gz $tarname.gz
	# done'
date

rm -f $tarname.gz