diff --git a/.gitignore b/.gitignore index 7c93fe6..8a979f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .vscode/settings.json -log.txt +log.txt \ No newline at end of file diff --git a/best403unlocker b/best403unlocker old mode 100644 new mode 100755 index b396e26..14528bf --- a/best403unlocker +++ b/best403unlocker @@ -8,16 +8,59 @@ if [ "$EUID" -ne 0 ]; then exit 1 fi } +install_required_packages(){ + if [[ -f /etc/os-release ]]; then + source /etc/os-release + + case $ID in + debian|ubuntu|mint|elementary) + apt update -y + apt install -y wget + ;; + arch|manjaro|parch) + pacman -Sy --noconfirm wget + ;; + fedora|rhel|centos|rocky|almalinux) + dnf install -y wget + ;; + suse|opensuse) + zypper install -y wget + ;; + alpine) + apk update + apk add --no-cache wget + ;; + *) + echo "Unsupported OS. Please install wget manually." >& 2 + exit 1 + esac + else + echo "Unsupported OS. Please install wget manually." >& 2 + exit 1 + fi +} check_required_packages_is_installed(){ if ! [ -x "$(command -v wget)" ] then -echo "wget is not installed" >&2 -exit 1 + echo "wget is not installed" + read -p "Do you want to us install wget or cancel it? [Y/n]: " do_install + + if [[ -z $do_install || + $do_install == "Y" || + $do_install == "y" || + $do_install == "Yes" || + $do_install == "yes" + ]]; then + install_required_packages + else + echo "Please install wget manually" >& 2 + exit 1 + fi fi } check_and_source_env() { if [ ! -f /etc/best403unlocker.conf ]; then - wget -c https://raw.githubusercontent.com/ArmanTaheriGhaleTaki/best403unlocker/main/.env -O /etc/best403unlocker.conf + wget -c https://raw.githubusercontent.com/403unlocker/best403unlocker/main/best403unlocker.conf -O /etc/best403unlocker.conf fi source /etc/best403unlocker.conf } @@ -84,4 +127,4 @@ echo '*********************' fi loggin >> /var/log/best403unlocker.log cat /etc/resolv.conf.bakup > /etc/resolv.conf -rm /etc/resolv.conf.bakup +rm /etc/resolv.conf.bakup \ No newline at end of file