"Fossies" - the Fresh Open Source Software Archive 
Member "afio-2.5.2/script3/afio_pack_gpg_zip" (30 Nov 2018, 1733 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). In this example
18 # we compress the files in the archive anyway by first passing them
19 # through gzip, then through gpg, using the auxillary script
20 # gpg_zip_encrypt.
21
22 find $dir_to_backup | afio -ovz -Z -U -P ./gpg_zip_encrypt -3 3 my_archive_file 3<$passphrasefile
23
24 # The reason why gpg built-in compression cannot be used is as
25 # follows. When compression is used, and gpg is run twice on the same
26 # input file, it can generate differing outputs with different
27 # lengths. This is a problem for afio if the output length is larger
28 # than the afio -M option value. If the length is larger than the -M
29 # value, then afio will call the 'compression' program twice, once to
30 # get the 'compressed' file length and once to get the actual file
31 # contents and write them to the archive, and if the lenght is bigger
32 # in the second run then the data in the archive will be truncated
33 # (and therefore corrupted). Afio does emit an error message when
34 # this happens, but it might be overlooked.
35
36 # the archive written with this script can be unpacked with
37 # afio_unpack_gpg_zip