aboutsummaryrefslogtreecommitdiffstats
path: root/tools/alpine-setup.sh
blob: 6cb461f6f9828b140a2db32739b2429b28542b5a (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# Setup development environment on alpine systems
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# We drag in tools that might not be needed by all users; it's easier
# that way.
#

if [ "$1" = "--help" ]
then
	printf "\\nUtility to setup a alpine system for Wireshark Development.\\n"
	printf "The basic usage installs the needed software\\n\\n"
	printf "Usage: %s [--install-optional] [--install-deb-deps] [...other options...]\\n" "$0"
	printf "\\t--install-optional: install optional software as well\\n"
	printf "\\t[other]: other options are passed as-is to apt\\n"
	exit 1
fi

# Check if the user is root
if [ "$(id -u)" -ne 0 ]
then
	echo "You must be root."
	exit 1
fi

ADDITIONAL=0
for arg; do
	case $arg in
		--install-optional)
			ADDITIONAL=1
			;;
		*)
			OPTIONS="$OPTIONS $arg"
			;;
	esac
done

BASIC_LIST="cmake \
	ninja \
	gcc \
	g++ \
	glib-dev \
	libgcrypt-dev \
	flex \
	bison \
	perl \
	tiff-dev \
	c-ares-dev \
	qt5-qtbase-dev \
	qt5-qttools-dev \
	qt5-qtmultimedia-dev \
	qt5-qtsvg-dev"

ADDITIONAL_LIST="
	git \
	asciidoctor \
	libssh-dev \
	spandsp-dev \
	libcap-dev \
	libpcap-dev \
	libxml2-dev \
	libmaxminddb-dev \
	krb5-dev \
	lz4-dev \
	gnutls-dev \
	snappy-dev \
	nghttp2-dev \
	lua5.2-dev \
	libnl3-dev \
	sbc-dev \
	minizip-dev \
	speexdsp-dev \
	brotli-dev \
	"

# Adds package $2 to list variable $1 if the package is found.
# If $3 is given, then this version requirement must be satisfied.
add_package() {
	local list="$1" pkgname="$2"

	# fail if the package is not known
	apk list $pkgname &> /dev/null || return 1

	# package is found, append it to list
	eval "${list}=\"\${${list}} \${pkgname}\""
}

ACTUAL_LIST=$BASIC_LIST

# Now arrange for optional support libraries
if [ $ADDITIONAL -ne 0 ]
then
	ACTUAL_LIST="$ACTUAL_LIST $ADDITIONAL_LIST"
fi

apk update || exit 2
apk add $ACTUAL_LIST $OPTIONS || exit 2

if [ $ADDITIONAL -eq 0 ]
then
	printf "\n*** Optional packages not installed. Rerun with --install-optional to have them.\n"
fi