123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- #!/bin/bash
- install_pkg_arch()
- {
- PACMAN_PKGS="boost boost-libs cmake python python-pip sqlite tcpdump"
-
- echo -e "Packages: Checking..."
- pacman -Qi $PACMAN_PKGS >/dev/null
- if [ $? != 0 ]; then
-
- echo -e "Packages: Installing..."
- sudo pacman -S --needed $PACMAN_PKGS
- else
- echo -e "Packages: Found."
- fi
-
- echo -e "Additional Packages: Checking..."
- pacman -Qi libtins >/dev/null
- if [ $? != 0 ]; then
- echo -e "Additional Packages: Installing..."
- pushd /tmp
-
- wget "https://aur.archlinux.org/cgit/aur.git/snapshot/libtins.tar.gz"
- tar -xzf libtins.tar.gz
- rm libtins.tar.gz
- rm -R libtins
- pushd libtins
-
- makepkg -si
- popd
- popd
- else
- echo -e "Additional Packages: Found."
- fi
- }
- install_pkg_ubuntu()
- {
- APT_PKGS='build-essential libboost-dev libboost-python-dev cmake python3-dev python3-pip python3-venv sqlite tcpdump libtins-dev libpcap-dev'
- which sudo >/dev/null
- if [ $? != 0 ]; then
-
- SUDO="su -c "
- else
- SUDO=sudo
- fi
-
- echo -e "Packages: Checking..."
- dpkg -s $APT_PKGS &>/dev/null
- if [ $? != 0 ]; then
-
- echo -e "Packages: Installing..."
- $SUDO "apt-get install $APT_PKGS"
- else
- echo -e "Packages: Found."
- fi
- }
- install_pkg_darwin()
- {
- BREW_PKGS="cmake python coreutils libdnet libtins sqlite boost boost-python --with-python3"
-
- echo -e "Packages: Checking..."
- brew ls --versions $BREW_PKGS &>/dev/null
- if [ $? != 0 ]; then
-
- echo -e "Packages: Installing..."
- brew install $BREW_PKGS
- else
- echo -e "Packages: Found."
- fi
- }
- echo -e "Updating SQLiteCpp"
- git submodule update --init
- KERNEL=$(uname)
- if [ "$KERNEL" = 'Darwin' ]; then
- echo -e "Detected OS: macOS"
- which brew >/dev/null
- if [ $? != 0 ]; then
- echo -e "Brew not found, please install it manually!"
- exit 1
- fi
- install_pkg_darwin
- exit 0
- elif [ "$KERNEL" = 'Linux' ]; then
-
- OS=$(awk '/DISTRIB_ID=/' /etc/*-release | sed 's/DISTRIB_ID=//' | sed 's/"//g' | tr '[:upper:]' '[:lower:]')
- OS_LIKE=$(awk '/ID_LIKE=/' /etc/*-release | sed 's/ID_LIKE=//' | sed 's/"//g' | tr '[:upper:]' '[:lower:]')
- if [ -z "$OS_LIKE" ]; then
-
- OS_LIKE=$(lsb_release -si | tr '[:upper:]' '[:lower:]')
- fi
- case $OS_LIKE in
- archlinux|arch)
- echo -e "Detected OS: Arch Linux"
- install_pkg_arch
- exit 0
- ;;
- debian)
- echo -e "Detected OS: Debian"
- install_pkg_ubuntu
- exit 0
- ;;
- esac
- fi
- echo -e "Your OS is not supported by this script, please make sure to install the dependencies manually"
- exit 0
|