File: sks_build.sh

package info (click to toggle)
sks 1.1.6-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,228 kB
  • ctags: 3,554
  • sloc: ml: 15,224; ansic: 1,069; makefile: 345; sh: 303
file content (54 lines) | stat: -rw-r--r-- 1,486 bytes parent folder | download | duplicates (7)
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
#!/bin/bash

# SKS build script.
# cd to directory with "dump" subdirectory, and run
# You might want to edit this file to reduce or increase memory usage
# depending on your system

trap ignore_signal USR1 USR2

ignore_signal() {
    echo "Caught user signal 1 or 2, ignoring"
}

ask_mode() {
    echo "Please select the mode in which you want to import the keydump:"
    echo ""
    echo "1 - fastbuild"
    echo "    only an index of the keydump is created and the keydump cannot be"
    echo "    removed."
    echo ""
    echo "2 - normalbuild"
    echo ""
    echo "    all the keydump will be imported in a new database. It takes longer"
    echo "    time and more disk space, but the server will run faster (depending"
    echo "    from the source/age of the keydump)."
    echo "    The keydump can be removed after the import."
    echo ""
    echo -n "Enter enter the mode (1/2): "
    read
    case "$REPLY" in
     1)
        mode="fastbuild"
     ;;
     2)
        mode="build /var/lib/sks/dump/*.pgp"
     ;;
     *)
        echo "Option unknown. bye!"
        exit 1
     ;;
    esac
}

fail() { echo Command failed unexpectedly.  Bailing out; exit -1; }

ask_mode

echo "=== Running (fast)build... ==="
if ! /usr/sbin/sks $mode -n 10 -cache 100; then fail; fi
echo === Cleaning key database... ===
if ! /usr/sbin/sks cleandb; then fail; fi
echo === Building ptree database... ===
if ! /usr/sbin/sks pbuild -cache 20 -ptree_cache 70; then fail; fi
echo === Done! ===