summaryrefslogtreecommitdiffstats
path: root/snapcraft/scripts/set-options
blob: 0637d2ce5dd6f1b80a2e3c960c62fa8715078e29 (plain)
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
#!/bin/sh

set -e

case $1 in
    fpm) 
        case $2 in
            disable)
                rm -f $SNAP_DATA/fpm.conf
                echo "FPM module disabled. Please restart FRR"
                ;;
            protobuf)
                echo "-M fpm:protobuf" > $SNAP_DATA/fpm.conf
                echo "FPM enabled and set to protobuf mode. Please restart FRR"
                ;;
            netlink)
                echo "-M fpm:netlink" > $SNAP_DATA/fpm.conf
                echo "FPM enabled and set to netlink mode. Please restart FRR"
                ;;
            *)
                echo "Usage:"
                echo "    ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
                echo ""
                echo "    Disables FPM module or enables it with specified mode"
                echo "    Mode will be saved for next restart of zebra, but zebra"
                echo "    is not automatically restarted"               
                exit 1
                ;;
        esac
        ;;
    rpki)
        case $2 in
            disable)
                echo "" > $SNAP_DATA/rpki.conf
                echo "RPKI module disabled. Please restart FRR"
                ;;
            enable)
                echo "-M rpki" > $SNAP_DATA/rpki.conf
                echo "RPKI module enabled. Please restart FRR"
                ;;
            *)
                echo "Usage:"
                echo "    ${SNAP_NAME}.set rpki {disable|enable}"
                echo ""
                echo "    Disables BGP RPKI module or enables it (default: enabled)"
                echo "    Mode will be saved for next restart of bgpd, but bgpd"
                echo "    is not automatically restarted"
                exit 1
                ;;
        esac
        ;;
    *)
        echo "Usage:"
        echo "    ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
        echo "    ${SNAP_NAME}.set rpki {disable|enable}"
        echo ""
        echo "    fpm: Disables FPM or enables FPM with selected mode"
        echo "    rpki: Disables BGP RPKI or enables it (default: enabled)"
        exit 1
        ;;
esac

exit 0