aboutsummaryrefslogtreecommitdiff
path: root/contrib/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/scripts')
-rw-r--r--contrib/scripts/Makefile.am14
-rw-r--r--contrib/scripts/changelog_delta.sh3
-rwxr-xr-xcontrib/scripts/doc/warningfilter.py134
-rwxr-xr-xcontrib/scripts/generate-release-triplet.sh21
-rw-r--r--contrib/scripts/gnunet-logread/Makefile.am4
-rw-r--r--contrib/scripts/meson.build4
-rwxr-xr-xcontrib/scripts/netjail/netjail_core.sh217
-rwxr-xr-xcontrib/scripts/netjail/netjail_setup_internet.sh166
-rwxr-xr-xcontrib/scripts/news_delta.sh6
-rwxr-xr-xcontrib/scripts/testbed_cleanup.sh14
-rwxr-xr-xcontrib/scripts/update_news.sh15
11 files changed, 189 insertions, 409 deletions
diff --git a/contrib/scripts/Makefile.am b/contrib/scripts/Makefile.am
index 2d4f5584b..204167e82 100644
--- a/contrib/scripts/Makefile.am
+++ b/contrib/scripts/Makefile.am
@@ -1,5 +1,6 @@
1# This Makefile.am is in the public domain 1# This Makefile.am is in the public domain
2AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_builddir)/src/include 2AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_builddir)/src/include
3libexecdir= $(pkglibdir)/libexec/
3 4
4SUBDIRS = gnunet-logread 5SUBDIRS = gnunet-logread
5 6
@@ -21,7 +22,10 @@ noinst_SCRIPTS = \
21 $(awkSCRIPTS) 22 $(awkSCRIPTS)
22 23
23bin_SCRIPTS = \ 24bin_SCRIPTS = \
24 gnunet-bugreport \ 25 gnunet-bugreport
26
27# This script is not documented and its usage is quite uncommon.
28libexec_SCRIPTS = \
25 gnunet-suidfix 29 gnunet-suidfix
26 30
27EXTRA_DIST = \ 31EXTRA_DIST = \
@@ -39,15 +43,11 @@ EXTRA_DIST = \
39 find_typedefs.py \ 43 find_typedefs.py \
40 pydmesg \ 44 pydmesg \
41 visualize_stats.sh \ 45 visualize_stats.sh \
42 changelog_delta.sh \
43 debug \ 46 debug \
44 build_cscope.sh \ 47 build_cscope.sh \
45 testbed_cleanup.sh \
46 lint/lint-man.sh \ 48 lint/lint-man.sh \
47 lint/lint-python.sh \ 49 lint/lint-python.sh \
48 revisionary.sh \ 50 revisionary.sh \
49 netjail/netjail_core.sh \
50 netjail/netjail_setup_internet.sh \
51 regression.sh \ 51 regression.sh \
52 doc/texinfo-hacks.el \ 52 doc/texinfo-hacks.el \
53 afferify \ 53 afferify \
@@ -72,11 +72,11 @@ CLEANFILES = \
72SUFFIXES = .py.in .py 72SUFFIXES = .py.in .py
73 73
74.py.in.py: 74.py.in.py:
75 $(AWK) -v py="$(PYTHON)" -f $(top_srcdir)/bin/dosubst.awk < $< > $@ 75 $(AWK) -v py="$(PYTHON)" -f $(top_srcdir)/scripts/dosubst.awk < $< > $@
76 chmod +x $@ 76 chmod +x $@
77 77
78if HAVE_AWK 78if HAVE_AWK
79check-texinfo.awk: check-texinfo.awk.in Makefile 79check-texinfo.awk: check-texinfo.awk.in Makefile
80 $(AWK) -v awkay="$(AWK_BINARY)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/check-texinfo.awk.in > check-texinfo.awk 80 $(AWK) -v awkay="$(AWK_BINARY)" -f $(top_srcdir)/scripts/dosubst.awk < $(srcdir)/check-texinfo.awk.in > check-texinfo.awk
81 chmod +x check-texinfo.awk 81 chmod +x check-texinfo.awk
82endif 82endif
diff --git a/contrib/scripts/changelog_delta.sh b/contrib/scripts/changelog_delta.sh
deleted file mode 100644
index f115f1ef1..000000000
--- a/contrib/scripts/changelog_delta.sh
+++ /dev/null
@@ -1,3 +0,0 @@
1#!/bin/bash
2LASTHASH=$(head -n1 ChangeLog | cut -d " " -f 7 | tr -d \( | tr -d \))
3git log --invert-grep --grep="^-" --no-merges --no-color --format="%aD (%h)%n%s - %cN%n" $LASTHASH..HEAD
diff --git a/contrib/scripts/doc/warningfilter.py b/contrib/scripts/doc/warningfilter.py
new file mode 100755
index 000000000..31ac5865c
--- /dev/null
+++ b/contrib/scripts/doc/warningfilter.py
@@ -0,0 +1,134 @@
1#!/usr/bin/env python3
2"""
3Filters and processes warnings generated by Doxygen, which are
4annoyingly inconsistent and verbose, for greater readability.
5
6(Neo)vim commands to go to the file and linenumber listed on a
7line, in the reports this program generates:
8 :exe "let linenumber =" split(getline("."))[1]
9 :exe "edit" fnameescape(split(getline("."))[0]) "|" linenumber
10
11It's easy to put a workflow together to clear up redundant doc
12comments (which generate "multiple @param docs" warnings), using
13simple vim commands to move the cursor and close buffers, Neovim's
14support for the Language Server Protocol or related tooling, and
15the command shown above.
16
17A useful sequence, for rapidly deleting a doc comment from its last
18line, is, in normal mode, `$v%ddd`.
19
20For setting up LSP integration in Neovim, refer to the lsp_config
21plugin.
22
23You may additionally need to generate compile_commands.json in the
24repository root, to allow the language server to find everything.
25This can be done using Bear (found at https://github.com/rizsotto/Bear).
26
27@author: willow <willow@howhill.com>
28"""
29
30import argparse as ap
31import re
32
33# Regular expression construction
34
35def sep_re(field, separator):
36 "Constructs regex for a list"
37 return rf"{field}(?:{separator}{field})*"
38
39# File names and paths
40fileclass = r"[\w-]"
41filename = rf"{fileclass}+"
42# filename = rf"(/{fileclass}+)+\.\w"
43filepath = rf"{sep_re(filename, '/')}\.(?:\w+)"
44main_match = rf"(?P<path>/{filepath}|\[generated\]):(?P<linenumber>\d+): warning:"
45
46# Symbols
47type_name = rf"(?:const )?(?:unsigned (?:long )?|struct |enum )?(?:\w+)(?: \*?const)? \*{{0,3}}"
48var_def = rf"{type_name}\w+(?:\[(?:\(\d+/\d+\))?\])?"
49func_params = rf"\({sep_re(var_def, ', ')}(?:,\.\.\.)?\)"
50simple_name = r"\w+"
51func_name = simple_name
52verbose_name = rf"{sep_re(simple_name, ' ')}"
53command_re = "(?:</[^>]+>|\\\w+)"
54macro_params = rf"\({sep_re(simple_name, ', ')}(?:,\.\.\.)?\)"
55
56
57matches = {
58 "not an input @file": re.compile(rf"{main_match} the name '(?P<name>{filepath}|{simple_name})' supplied as the argument in the \\file statement is not an input file"),
59 "multiple @param docs": re.compile(rf"{main_match} argument '(?P<arg_name>\w+)' from the argument list of ({func_name}) has multiple @param documentation sections"),
60 "undocumented param": re.compile(rf"{main_match} The following parameters? of ({func_name})(?:{func_params}|{macro_params}) (?:is|are) not documented:"),
61 "undocumented param (name)": re.compile(r" parameter '([\w.]+)'"),
62 "explicit link not resolved": re.compile(rf"{main_match} explicit link request to '(\w+(?:\(\))?)' could not be resolved"),
63 "unknown command": re.compile(rf"{main_match} Found unknown command '(\\\w+)'"),
64 "missing argument": re.compile(rf"{main_match} argument '(\w+)' of command @param is not found in the argument list of ({func_name})(?:{func_params}|{macro_params})"),
65 "eof inside group": re.compile(rf"{main_match} end of file while inside a group"),
66 "eof inside comment": re.compile(rf"{main_match} Reached end of file while still inside a \(nested\) comment. Nesting level \d+ \(probable line reference: (\d+)\)"),
67 "eof inside code block": re.compile(rf"{main_match} reached end of file while inside a 'code' block!"),
68 "eof inside code block (line 2)": re.compile(rf"The command that should end the block seems to be missing!"),
69 "title mismatch": re.compile(rf"{main_match} group (?P<group_id>\w+): ignoring title \"(?P<new_title>{verbose_name})\" that does not match old title \"(?P<old_title>{verbose_name})\""),
70 "end of comment expecting command": re.compile(rf"{main_match} end of comment block while expecting command ({command_re})"),
71 "no matching tag": re.compile(rf"{main_match} found </(?P<tag>[^>]+)> tag without matching <(?P=tag)>"),
72 "documented empty return type": re.compile(rf"{main_match} documented empty return type of {func_name}"),
73 "unsupported tag": re.compile(rf"{main_match} Unsupported xml/html tag <(?P<tag>[^>]+)> found"),
74 "expected whitespace after command": re.compile(rf"{main_match} expected whitespace after \\(?P<command>\w+) command"),
75 "illegal command": re.compile(rf"{main_match} Illegal command (?P<illegal_cmd>(?:@|\\)\w+) as part of a \\(?P<command>\w+) command"),
76 "undeclared symbol": re.compile(rf"{main_match} documented symbol '(\w+)' was not declared or defined\."),
77 "nameless member": re.compile(rf"{main_match} member with no name found."),
78 "end of empty list": re.compile(rf"{main_match} End of list marker found without any preceding list items"),
79 "blank": re.compile(rf"^\s*$"),
80# "": re.compile(rf"{main_match} "),
81}
82
83parser_choices = set(matches.keys()) - {"blank",
84 "eof inside code block (line 2)",
85 "undocumented param (name)"}
86
87parser = ap.ArgumentParser()
88parser.add_argument("filename")
89parser.add_argument("--summary", "-s", action="store_true")
90parser.add_argument("--key", "-k", choices=parser_choices, action="append", dest="keys")
91args = parser.parse_args()
92
93sorted_lines = {k:[] for k in matches.keys()}
94unsorted_lines = []
95
96with open(args.filename, "r") as file:
97 for line in file.readlines():
98 for key, value in matches.items():
99 if match := value.match(line):
100 sorted_lines[key].append(match)
101 break
102 else:
103 unsorted_lines.append(line.strip("\n"))
104
105
106processed_lines = {k: [" ".join(g for g in match.groups())
107 for match in matches]
108 for k, matches in sorted_lines.items()}
109
110# Combining multiline warnings
111processed_lines["undocumented param"] = [
112 l1+" "+l2 for l1, l2 in zip(processed_lines["undocumented param"],
113 processed_lines["undocumented param (name)"])
114]
115
116# Removing chaff
117del processed_lines["blank"]
118del processed_lines["eof inside code block (line 2)"]
119del processed_lines["undocumented param (name)"]
120
121# Preparing count dictionary and summarising the results
122counts = {k: len(v) for k, v in processed_lines.items()}
123if args.summary:
124 for k, v in counts.items():
125 print(k+":", v)
126 print("")
127
128if args.keys is not None:
129 for key in args.keys:
130 print(f"{key}: {counts[key]}")
131 for line in processed_lines[key]:
132 print(line)
133 print("")
134
diff --git a/contrib/scripts/generate-release-triplet.sh b/contrib/scripts/generate-release-triplet.sh
new file mode 100755
index 000000000..7dc890dc0
--- /dev/null
+++ b/contrib/scripts/generate-release-triplet.sh
@@ -0,0 +1,21 @@
1#!/bin/bash
2
3PACKAGE=$1
4VERSION=$2
5
6cat << EOF >> $PACKAGE-$VERSION.directive
7version: 1.2
8directory: gnunet
9filename: $PACKAGE-$VERSION.tar.gz
10symlink: $PACKAGE-$VERSION.tar.gz $PACKAGE-latest.tar.gz
11EOF
12
13gpg --clearsign $PACKAGE-$VERSION.directive
14gpg -b $PACKAGE-$VERSION.tar.gz
15exit
16ftp -inv ftp-upload.gnu.org <<EOF
17user anonymous
18cd incoming/ftp
19mput $PACKAGE-$VERSION.tar.gz $PACKAGE-$VERSION.tar.gz.sig $PACKAGE-$VERSION.tar.gz.directive.asc
20bye
21EOF
diff --git a/contrib/scripts/gnunet-logread/Makefile.am b/contrib/scripts/gnunet-logread/Makefile.am
index d0054391c..d53a8b8cf 100644
--- a/contrib/scripts/gnunet-logread/Makefile.am
+++ b/contrib/scripts/gnunet-logread/Makefile.am
@@ -4,11 +4,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_builddir)/src/include
4SUFFIXES = .in 4SUFFIXES = .in
5 5
6gnunet-logread: gnunet-logread.in Makefile 6gnunet-logread: gnunet-logread.in Makefile
7 $(AWK) -v prl="$(PERL)" -v pfx="$(prefix)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/gnunet-logread.in > gnunet-logread 7 $(AWK) -v prl="$(PERL)" -v pfx="$(prefix)" -f $(top_srcdir)/scripts/dosubst.awk < $(srcdir)/gnunet-logread.in > gnunet-logread
8 chmod +x gnunet-logread 8 chmod +x gnunet-logread
9 9
10gnunet-logread-ipc-sdedit: gnunet-logread-ipc-sdedit.in Makefile 10gnunet-logread-ipc-sdedit: gnunet-logread-ipc-sdedit.in Makefile
11 $(AWK) -v prl="$(PERL)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/gnunet-logread-ipc-sdedit.in > gnunet-logread-ipc-sdedit 11 $(AWK) -v prl="$(PERL)" -f $(top_srcdir)/scripts/dosubst.awk < $(srcdir)/gnunet-logread-ipc-sdedit.in > gnunet-logread-ipc-sdedit
12 chmod +x gnunet-logread-ipc-sdedit 12 chmod +x gnunet-logread-ipc-sdedit
13 13
14CLEANFILES= \ 14CLEANFILES= \
diff --git a/contrib/scripts/meson.build b/contrib/scripts/meson.build
new file mode 100644
index 000000000..d56ba2b76
--- /dev/null
+++ b/contrib/scripts/meson.build
@@ -0,0 +1,4 @@
1install_data('gnunet-bugreport',
2 install_dir: get_option('bindir'))
3install_data('gnunet-suidfix',
4 install_dir: get_option('libdir')/'gnunet'/'libexec')
diff --git a/contrib/scripts/netjail/netjail_core.sh b/contrib/scripts/netjail/netjail_core.sh
deleted file mode 100755
index d53315052..000000000
--- a/contrib/scripts/netjail/netjail_core.sh
+++ /dev/null
@@ -1,217 +0,0 @@
1#!/bin/sh
2#
3
4JAILOR=${SUDO_USER:?must run in sudo}
5PREFIX=${PPID:?must run from a parent process}
6
7# running with `sudo` is required to be
8# able running the actual commands as the
9# original user.
10
11export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
12
13export RESULT=
14export NAMESPACE_NUM=0
15export INTERFACE_NUM=0
16
17netjail_next_namespace() {
18 local NUM=$NAMESPACE_NUM
19 NAMESPACE_NUM=$(($NAMESPACE_NUM + 1))
20 RESULT=$NUM
21}
22
23netjail_next_interface() {
24 local NUM=$INTERFACE_NUM
25 INTERFACE_NUM=$(($INTERFACE_NUM + 1))
26 RESULT=$NUM
27}
28
29netjail_opt() {
30 local OPT=$1
31 shift 1
32
33 INDEX=1
34
35 while [ $# -gt 0 ]; do
36 if [ "$1" = "$OPT" ]; then
37 RESULT=$INDEX
38 return
39 fi
40
41 INDEX=$(($INDEX + 1))
42 shift 1
43 done
44
45 RESULT=0
46}
47
48netjail_opts() {
49 local OPT=$1
50 local DEF=$2
51 shift 2
52
53 while [ $# -gt 0 ]; do
54 if [ "$1" = "$OPT" ]; then
55 printf "$2"
56 return
57 fi
58
59 shift 1
60 done
61
62 RESULT="$DEF"
63}
64
65netjail_check() {
66 local NODE_COUNT=$1
67 local FD_COUNT=$(($(ls /proc/self/fd | wc -w) - 4))
68
69 # quit if `$FD_COUNT < ($LOCAL_M * $GLOBAL_N * 2)`:
70 # the script also requires `sudo -C ($FD_COUNT + 4)`
71 # so you need 'Defaults closefrom_override' in the
72 # sudoers file.
73
74 if [ $FD_COUNT -lt $(($NODE_COUNT * 2)) ]; then
75 echo "File descriptors do not match requirements!" >&2
76 exit 1
77 fi
78}
79
80netjail_check_bin() {
81 local PROGRAM=$1
82 local MATCH=$(ls $(echo $PATH | tr ":" "\n") | grep "^$PROGRAM\$" | tr "\n" " " | awk '{ print $1 }')
83
84 # quit if the required binary $PROGRAM can not be
85 # found in the used $PATH.
86
87 if [ "$MATCH" != "$PROGRAM" ]; then
88 echo "Required binary not found: $PROGRAM" >&2
89 exit 1
90 fi
91}
92
93netjail_bridge() {
94 netjail_next_interface
95 local NUM=$RESULT
96 local BRIDGE=$(printf "%06x-%08x" $PREFIX $NUM)
97
98 ip link add $BRIDGE type bridge
99 ip link set dev $BRIDGE up
100
101 RESULT=$BRIDGE
102}
103
104netjail_bridge_clear() {
105 local BRIDGE=$1
106
107 ip link delete $BRIDGE
108}
109
110netjail_node() {
111 netjail_next_namespace
112 local NUM=$RESULT
113 local NODE=$(printf "%06x-%08x" $PREFIX $NUM)
114
115 ip netns add $NODE
116
117 RESULT=$NODE
118}
119
120netjail_node_clear() {
121 local NODE=$1
122
123 ip netns delete $NODE
124}
125
126netjail_node_link_bridge() {
127 local NODE=$1
128 local BRIDGE=$2
129 local ADDRESS=$3
130 local MASK=$4
131
132 netjail_next_interface
133 local NUM_IF=$RESULT
134 netjail_next_interface
135 local NUM_BR=$RESULT
136
137 local LINK_IF=$(printf "%06x-%08x" $PREFIX $NUM_IF)
138 local LINK_BR=$(printf "%06x-%08x" $PREFIX $NUM_BR)
139
140 ip link add $LINK_IF type veth peer name $LINK_BR
141 ip link set $LINK_IF netns $NODE
142 ip link set $LINK_BR master $BRIDGE
143
144 ip -n $NODE addr add "$ADDRESS/$MASK" dev $LINK_IF
145 ip -n $NODE link set $LINK_IF up
146 ip -n $NODE link set up dev lo
147
148 ip link set $LINK_BR up
149
150 RESULT=$LINK_BR
151}
152
153netjail_node_unlink_bridge() {
154 local LINK_BR=$1
155
156 ip link delete $LINK_BR
157}
158
159netjail_node_add_nat() {
160 local NODE=$1
161 local ADDRESS=$2
162 local MASK=$3
163
164 ip netns exec $NODE iptables -t nat -A POSTROUTING -s "$ADDRESS/$MASK" -j MASQUERADE
165}
166
167netjail_node_add_default() {
168 local NODE=$1
169 local ADDRESS=$2
170
171 ip -n $NODE route add default via $ADDRESS
172}
173
174netjail_node_exec() {
175 local NODE=$1
176 local FD_IN=$2
177 local FD_OUT=$3
178 shift 3
179
180 ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN
181}
182
183netjail_kill() {
184 local PID=$1
185 local MATCH=$(ps --pid $PID | awk "{ if ( \$1 == $PID ) { print \$1 } }" | wc -l)
186
187 if [ $MATCH -gt 0 ]; then
188 kill -n 19 $PID
189
190 for CHILD in $(ps -o pid,ppid -ax | awk "{ if ( \$2 == $PID ) { print \$1 } }"); do
191 netjail_kill $CHILD
192 done
193
194 kill $PID
195 fi
196}
197
198netjail_killall() {
199 if [ $# -gt 0 ]; then
200 local PIDS=$1
201
202 for PID in $PIDS; do
203 netjail_kill $PID
204 done
205 fi
206}
207
208netjail_waitall() {
209 if [ $# -gt 0 ]; then
210 local PIDS=$1
211
212 for PID in $PIDS; do
213 wait $PID
214 done
215 fi
216}
217
diff --git a/contrib/scripts/netjail/netjail_setup_internet.sh b/contrib/scripts/netjail/netjail_setup_internet.sh
deleted file mode 100755
index ea820f38c..000000000
--- a/contrib/scripts/netjail/netjail_setup_internet.sh
+++ /dev/null
@@ -1,166 +0,0 @@
1#!/bin/bash
2
3. "./netjail_core.sh"
4
5set -eu
6set -x
7
8export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
9
10PREFIX=$PPID
11LOCAL_M=$1
12GLOBAL_N=$2
13
14shift 2
15
16netjail_check $(($LOCAL_M * $GLOBAL_N))
17
18# Starts optionally an amount of nodes without NAT starting with "92.68.151.1"
19netjail_opt '--known' $@
20KNOWN=$RESULT
21netjail_opts '--known' 0 $@
22KNOWN_NUM=$RESULT
23
24# Starts optionally 'stunserver' on "92.68.150.254":
25netjail_opt '--stun' $@
26STUN=$RESULT
27
28if [ $KNOWN -gt 0 ]; then
29 shift 2
30
31 KNOWN=$KNOWN_NUM
32
33 netjail_check $(($LOCAL_M * $GLOBAL_N + $KNOWN))
34fi
35
36if [ $STUN -gt 0 ]; then
37 netjail_check_bin stunserver
38
39 shift 1
40fi
41
42netjail_check_bin $1
43
44LOCAL_GROUP="192.168.15"
45GLOBAL_GROUP="92.68.150"
46KNOWN_GROUP="92.68.151"
47
48CLEANUP=0
49echo "Start [local: $LOCAL_GROUP.0/24, global: $GLOBAL_GROUP.0/16, stun: $STUN]"
50
51netjail_bridge
52NETWORK_NET=$RESULT
53
54for X in $(seq $KNOWN); do
55 netjail_node
56 KNOWN_NODES[$X]=$RESULT
57 netjail_node_link_bridge ${KNOWN_NODES[$X]} $NETWORK_NET "$KNOWN_GROUP.$X" 16
58 KNOWN_LINKS[$X]=$RESULT
59done
60
61declare -A NODES
62declare -A NODE_LINKS
63
64for N in $(seq $GLOBAL_N); do
65 netjail_node
66 ROUTERS[$N]=$RESULT
67 netjail_node_link_bridge ${ROUTERS[$N]} $NETWORK_NET "$GLOBAL_GROUP.$N" 16
68 NETWORK_LINKS[$N]=$RESULT
69 netjail_bridge
70 ROUTER_NETS[$N]=$RESULT
71
72 for M in $(seq $LOCAL_M); do
73 netjail_node
74 NODES[$N,$M]=$RESULT
75 netjail_node_link_bridge ${NODES[$N,$M]} ${ROUTER_NETS[$N]} "$LOCAL_GROUP.$M" 24
76 NODE_LINKS[$N,$M]=$RESULT
77 done
78
79 ROUTER_ADDR="$LOCAL_GROUP.$(($LOCAL_M+1))"
80 netjail_node_link_bridge ${ROUTERS[$N]} ${ROUTER_NETS[$N]} $ROUTER_ADDR 24
81 ROUTER_LINKS[$N]=$RESULT
82
83 netjail_node_add_nat ${ROUTERS[$N]} $ROUTER_ADDR 24
84
85 for M in $(seq $LOCAL_M); do
86 netjail_node_add_default ${NODES[$N,$M]} $ROUTER_ADDR
87 done
88done
89
90WAITING=""
91KILLING=""
92
93if [ $STUN -gt 0 ]; then
94 netjail_node
95 STUN_NODE=$RESULT
96 netjail_node_link_bridge $STUN_NODE $NETWORK_NET "$GLOBAL_GROUP.254" 16
97 STUN_LINK=$RESULT
98
99 netjail_node_exec $STUN_NODE 0 1 stunserver &
100 KILLING="$!"
101fi
102
103for X in $(seq $KNOWN); do
104 INDEX=$(($X - 1))
105
106 FD_X=$(($INDEX * 2 + 3 + 0))
107 FD_Y=$(($INDEX * 2 + 3 + 1))
108
109 netjail_node_exec ${KNOWN_NODES[$X]} $FD_X $FD_Y $@ &
110 WAITING="$! $WAITING"
111done
112
113for N in $(seq $GLOBAL_N); do
114 for M in $(seq $LOCAL_M); do
115 INDEX=$(($LOCAL_M * ($N - 1) + $M - 1 + $KNOWN))
116
117 FD_X=$(($INDEX * 2 + 3 + 0))
118 FD_Y=$(($INDEX * 2 + 3 + 1))
119
120 netjail_node_exec ${NODES[$N,$M]} $FD_X $FD_Y $@ &
121 WAITING="$! $WAITING"
122 done
123done
124
125cleanup() {
126 if [ $STUN -gt 0 ]; then
127 netjail_node_unlink_bridge $STUN_LINK
128 netjail_node_clear $STUN_NODE
129 fi
130
131 for X in $(seq $KNOWN); do
132 netjail_node_unlink_bridge ${KNOWN_LINKS[$X]}
133 netjail_node_clear ${KNOWN_NODES[$X]}
134 done
135
136 for N in $(seq $GLOBAL_N); do
137 for M in $(seq $LOCAL_M); do
138 netjail_node_unlink_bridge ${NODE_LINKS[$N,$M]}
139 netjail_node_clear ${NODES[$N,$M]}
140 done
141
142 netjail_node_unlink_bridge ${ROUTER_LINKS[$N]}
143 netjail_bridge_clear ${ROUTER_NETS[$N]}
144 netjail_node_unlink_bridge ${NETWORK_LINKS[$N]}
145 netjail_node_clear ${ROUTERS[$N]}
146 done
147
148 netjail_bridge_clear $NETWORK_NET
149}
150
151trapped_cleanup() {
152 netjail_killall $WAITING
153 netjail_killall $KILLING
154
155 cleanup
156}
157
158trap 'trapped_cleanup' ERR
159
160netjail_waitall $WAITING
161netjail_killall $KILLING
162wait
163
164cleanup
165
166echo "Done"
diff --git a/contrib/scripts/news_delta.sh b/contrib/scripts/news_delta.sh
new file mode 100755
index 000000000..20fb98649
--- /dev/null
+++ b/contrib/scripts/news_delta.sh
@@ -0,0 +1,6 @@
1#!/bin/bash
2
3OLDVERSION=$1
4
5git --no-pager log --grep="^NEWS: " -i --no-merges --no-color --format="%s%n%b" $1..HEAD | grep -i "^NEWS:\s[a-zA-Z][a-zA-Z]*" | sed 's/NEWS:/ -/i'
6echo ""
diff --git a/contrib/scripts/testbed_cleanup.sh b/contrib/scripts/testbed_cleanup.sh
deleted file mode 100755
index ee0200d44..000000000
--- a/contrib/scripts/testbed_cleanup.sh
+++ /dev/null
@@ -1,14 +0,0 @@
1#!/bin/sh
2
3###################################################################################
4# Script to clean a previous run of testbed which has crashed. This scripts kills #
5# the peers and cleans the temporary files created for those peers #
6# #
7# Author: Sree Harsha Totakura #
8###################################################################################
9
10for host in `cut -d : -f 1 < infiniband_cluster.hosts | cut -d @ -f 2`
11do
12 echo "ssh --> $host"
13 ssh $host 'pkill -SIGKILL gnunet; rm -rf /tmp/gnunet-pipe*; rm -rf /tmp/testbed*'
14done
diff --git a/contrib/scripts/update_news.sh b/contrib/scripts/update_news.sh
new file mode 100755
index 000000000..014ac8bd7
--- /dev/null
+++ b/contrib/scripts/update_news.sh
@@ -0,0 +1,15 @@
1#!/bin/bash
2NEW_VERSION=$1
3if [ -z $NEW_VERSION ]; then
4 NEW_VERSION="Unreleased"
5fi
6DELTA_SH="contrib/scripts/news_delta.sh"
7LASTVER=$(head -n1 NEWS | tr -d :)
8
9echo "$NEW_VERSION:" > NEWS.delta || exit 1
10$DELTA_SH $LASTVER >> NEWS.delta || exit 1
11cp NEWS NEWS.bak || exit 1
12cat NEWS.delta > NEWS || exit 1
13cat NEWS.bak >> NEWS || exit 1
14rm NEWS.bak NEWS.delta
15