• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# SPDX-License-Identifier: GPL-2.0-only
4# This file is part of Scapy
5# See https://scapy.net/ for more information
6
7# Usage:
8# ./install.sh [install mode]
9
10# Detect install mode
11if [[ "${1}" == "libpcap" ]]
12then
13    SCAPY_USE_LIBPCAP="yes"
14    if [[ ! -z "$GITHUB_ACTIONS" ]]
15    then
16      echo "SCAPY_USE_LIBPCAP=yes" >> $GITHUB_ENV
17    fi
18fi
19
20# Install on osx
21if [ "${OSTYPE:0:6}" = "darwin" ]
22then
23  if [ ! -z $SCAPY_USE_LIBPCAP ]
24  then
25    brew update
26    brew install libpcap
27  fi
28fi
29
30CUR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
31
32# Install wireshark data, ifconfig, vcan, samba, openldap
33if [ "$OSTYPE" = "linux-gnu" ]
34then
35  sudo apt-get update
36  sudo apt-get -qy install tshark net-tools || exit 1
37  sudo apt-get -qy install can-utils || exit 1
38  sudo apt-get -qy install linux-modules-extra-$(uname -r) || exit 1
39  sudo apt-get -qy install samba smbclient
40  # For OpenLDAP, we need to pre-populate some setup questions
41  sudo debconf-set-selections <<< 'slapd slapd/password2 password Bonjour1'
42  sudo debconf-set-selections <<< 'slapd slapd/password1 password Bonjour1'
43  sudo debconf-set-selections <<< 'slapd slapd/domain string scapy.net'
44  sudo apt-get -qy install slapd
45  ldapadd -D "cn=admin,dc=scapy,dc=net" -w Bonjour1 -f $CUR/openldap-testdata.ldif -c
46  # Make sure libpcap is installed
47  if [ ! -z $SCAPY_USE_LIBPCAP ]
48  then
49    sudo apt-get -qy install libpcap-dev  || exit 1
50  fi
51fi
52
53# Update pip & setuptools (tox uses those)
54python -m pip install --upgrade pip setuptools wheel --ignore-installed
55
56# Make sure tox is installed and up to date
57python -m pip install -U tox --ignore-installed
58
59# Dump Environment (so that we can check PATH, UT_FLAGS, etc.)
60set
61