2 # Setup development environment on alpine systems
4 # Wireshark - Network traffic analyzer
5 # By Gerald Combs <gerald@wireshark.org>
6 # Copyright 1998 Gerald Combs
8 # SPDX-License-Identifier: GPL-2.0-or-later
10 # We drag in tools that might not be needed by all users; it's easier
17 printf "\\nUtility to setup a alpine system for Wireshark Development.\\n"
18 printf "The basic usage installs the needed software\\n\\n"
19 printf "Usage: %s [--install-optional] [...other options...]\\n" "$0"
20 printf "\\t--install-optional: install optional software as well\\n"
21 printf "\\t--install-all: install everything\\n"
22 printf "\\t[other]: other options are passed as-is to apk\\n"
40 OPTIONS
="$OPTIONS $arg"
45 # Check if the user is root
46 if [ "$(id -u)" -ne 0 ]
48 echo "You must be root."
100 # Uncomment to add PNG compression utilities used by compress-pngs:
101 # ADDITIONAL_LIST="$ADDITIONAL_LIST
107 # Adds package $2 to list variable $1 if the package is found.
108 # If $3 is given, then this version requirement must be satisfied.
110 local list
="$1" pkgname
="$2"
112 # fail if the package is not known
113 apk list
"$pkgname" &> /dev
/null ||
return 1
115 # package is found, append it to list
116 eval "${list}=\"\${${list}} \${pkgname}\""
119 ACTUAL_LIST
=$BASIC_LIST
121 # Now arrange for optional support libraries
122 if [ $ADDITIONAL -ne 0 ]
124 ACTUAL_LIST
="$ACTUAL_LIST $ADDITIONAL_LIST"
128 # shellcheck disable=SC2086
129 apk add
$ACTUAL_LIST $OPTIONS ||
exit 2
131 if [ $ADDITIONAL -eq 0 ]
133 printf "\n*** Optional packages not installed. Rerun with --install-optional to have them.\n"