"Fossies" - the Fresh Open Source Software Archive 
Member "afio-2.5.2/script3/afio_pack_gpg" (30 Nov 2018, 1683 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 #
3 # This example shows how to configure afio to write GnuPG encrypted archives.
4
5 # GnuPG is a complete and free replacement for PGP. Because it does not use
6 # IDEA or RSA it can be used without any restrictions. GnuPG is a RFC2440
7 # (OpenPGP) compliant application.
8
9 # This example uses a pass phrase in a file, for increased security.
10 # the file permissions of this file should be set to -rw--------
11 # (group and world unreadable) to keep the pass phrase secure
12
13 dir_to_backup=/usr/include/linux
14 passphrasefile=my_passphrasefile
15
16 # gpg has built-in compression but this feature cannot be used with
17 # afio (it should be disabled using the -z 0 to gpg, which can be set using
18 # -Q -z -Q 0 in afio).
19
20 find $dir_to_backup |afio -ovz -Z -U -P gpg -Q --symmetric -Q --passphrase-fd=3 -Q --no-verbose -Q --batch -Q --no-options -Q -z -Q 0 -3 3 my_archive_file 3<$passphrasefile
21
22 # The reason why gpg built-in compression cannot be used is as
23 # follows. When compression is used, and gpg is run twice on the same
24 # input file, it can generate differing outputs with different
25 # lengths. This is a problem for afio if the output length is larger
26 # than the afio -M option value. If the length is larger than the -M
27 # value, then afio will call the 'compression' program twice, once to
28 # get the 'compressed' file length and once to get the actual file
29 # contents and write them to the archive, and if the lenght is bigger
30 # in the second run then the data in the archive will be truncated
31 # (and therefore corrupted). Afio does emit an error message when
32 # this happens, but it might be overlooked.
33
34 # the archive written with this script can be unpacked with afio_unpack_gpg