#!/bin/bash set -e update_package_manager() { if command -v apt-get &>/dev/null; then echo "Detected APT package manager." if command -v sudo &>/dev/null; then echo "sudo is installed." else su -c "apt-get update && apt-get install sudo -y" fi sudo apt-get update && sudo apt-get upgrade -y elif command -v dnf &>/dev/null; then echo "Detected DNF package manager." sudo dnf update -y elif command -v pacman &>/dev/null; then echo "Detected Pacman package manager." if command -v sudo &>/dev/null; then echo "sudo is installed." sudo pacman-key --init && sudo pacman-key --populate && sudo pacman -Syu --noconfirm else su -c "pacman-key --init && pacman-key --populate && pacman -Syu --noconfirm && pacman -Sy sudo --noconfirm" fi else echo "Unable to detect the package manager." exit 1 fi } install_requirements() { if command -v apt-get &>/dev/null; then sudo apt install chromium chromium-driver network-manager network-manager-openvpn openvpn python3 python3-pip python3-tk xvfb git wget curl unzip nano nodejs -y elif command -v dnf &>/dev/null; then sudo dnf install chromium chrom*driver NetworkManager NetworkManager-openvpn openvpn python python*-pip python*-tkinter xorg-x11-server-Xvfb git wget unzip nano nodejs -y elif command -v pacman &>/dev/null; then sudo pacman -Sy chromium networkmanager networkmanager-openvpn openvpn python python-pip xorg-server-xvfb git curl wget unzip nano base-devel nodejs --noconfirm fi } update_package_manager install_requirements git clone https://git.justw.tf/Lightemerald/mcr-bot && cd mcr-bot git clone https://git.justw.tf/Lightemerald/Microsoft-Rewards-bot && cd Microsoft-Rewards-bot && pip install -r requirements.txt cd .. && mkdir vpn && mkdir accounts cp ./.env.sample .env npm i chmod +x ./*.sh clear echo -e "Edit config.txt\nAdd your VPN files (.ovpn) in ./vpn\nThen run setup-vpn.sh\nAdd your accounts files (.json) with the same name as the VPN in ./accounts\nFinally, run 'npm start''"