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
|
#!/bin/sh
set -eu
config_file="${SNAP_DATA}/configuration"
cat <<-EOF
To start a new configuration file and test it,
$ sudo install -b -m 644 '${SNAP}/torrc-template' '$config_file'
$ sudo -e '$config_file'
$ $SNAP_NAME.configure
EOF
if test -f "$config_file"; then
echo "Found config file. Testing its validity."
if tor --verify-config -f "$config_file" --defaults-torrc "$SNAP/torrc-defaults" --hush; then
echo "Config file is valid. To activate changes, run"
echo "sudo systemctl restart snap.${SNAP_NAME}.daemon.service"
echo
else
echo "There was some trouble in parsing."
exit 1
fi
fi
cat <<EOF
This command makes no changes. Run it again to test the validity of a
configuration file you copy or edit.
EOF
|