Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -e

source /etc/os-release

PYTHON=python3
USER=$(whoami)
if [ "$USER" == "root" ]; then
Expand All @@ -24,16 +26,19 @@ function config() {
}

function install() {
OS=$(hostnamectl | grep -i "operating system")
echo "$OS"
case $OS in
*Arch?Linux*)
install_arch
;;
*)
install_debian
;;
esac
if [[ "$ID_LIKE" == *"rhel"* ]]; then
install_redhat
if [[ "rhel centos fedora" == *"$ID"* ]]; then
install_redhat
elif [[ "$ID_LIKE" == *"arch"* ]]; then
install_arch
elif [[ "$ID" == "arch" ]]; then
install_arch
elif [[ "$ID_LIKE" == *"debian"* ]]; then
install_debian
elif [[ "$ID" == "debian"]]; then
install_debian
fi
# Debian9 package 'python-selenium' does not work with chromedriver,
# Install from pip, which is newer
$SUDO $PYTHON -m pip install selenium
Expand All @@ -46,6 +51,21 @@ function install_arch(){
$SUDO pacman -Qi chromium > /dev/null || $SUDO pacman -S chromium
}

function install_redhat(){
echo "Installing necessary packages..."
epelresult=$($SUDO dnf repolist | grep epel)
if [[ "$epelresult" == "epel"* ]]; then
echo "EPEL installed, skipping..."
else
echo "Adding EPEL Repository..."
$SUDO dnf -y check-update
$SUDO dnf -y config-manager --set-enabled crb
$SUDO dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(echo ${VERSION_ID} | cut -d '.' -f -1).noarch.rpm
fi

$SUDO dnf -y install chromedriver chromium python3-pip
}

function install_debian(){
echo "Installing necessary packages..."
read -p 'Perform apt-get update? (y/n): ' update
Expand Down