|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# System Checker |
| 4 | + |
| 5 | +function screenSize() { |
| 6 | + if ! hash tput &> /dev/null |
| 7 | + then |
| 8 | + apt install -y ncurses-utils |
| 9 | + fi |
| 10 | + |
| 11 | + SIZE=$(tput cols) |
| 12 | + |
| 13 | + if [ ! ${SIZE} -ge "60" ] |
| 14 | + then |
| 15 | + printf "\nYour Terminal Window Size must be above ${C2}60${R0} >= ${C1}${SIZE}${R0}\nPinch two fingers together on the screen to zoom out.\n" |
| 16 | + fi |
| 17 | +} |
| 18 | + |
| 19 | +if [[ $OS == *'Android'* ]];then |
| 20 | +screenSize |
| 21 | +TMPDIR=/data/data/com.termux/files/usr/tmp |
| 22 | +pm() { |
| 23 | +apt install -y $1 |
| 24 | +} |
| 25 | +else |
| 26 | +TMPDIR=/tmp |
| 27 | +# Package Managers |
| 28 | + distro=$(source /etc/os-release && echo $ID) |
| 29 | + case $distro in |
| 30 | + arch) |
| 31 | + pm() { |
| 32 | + sudo pacman -Sy --noconfirm $1 |
| 33 | + } |
| 34 | + ;; |
| 35 | + ubuntu) |
| 36 | + pm() { |
| 37 | + sudo apt-get install -y $1 |
| 38 | + } |
| 39 | + ;; |
| 40 | + linuxmint) |
| 41 | + pm() { sudo apt-get install -y $1 |
| 42 | + } |
| 43 | + ;; |
| 44 | + kali) |
| 45 | + pm() { sudo apt-get install -y $1 |
| 46 | + } |
| 47 | + ;; |
| 48 | + parrot) |
| 49 | + pm() { sudo apt-get install -y $1 |
| 50 | + } |
| 51 | + ;; |
| 52 | + debian) |
| 53 | + pm() { sudo apt-get install -y $1 |
| 54 | + } |
| 55 | + ;; |
| 56 | + void) |
| 57 | + pm() { sudo xbps-install $1 |
| 58 | + } |
| 59 | + ;; |
| 60 | + manjaro) |
| 61 | + pm() { sudo pacman -Sy $1 |
| 62 | + } |
| 63 | + ;; |
| 64 | + garuda) |
| 65 | + pm() { sudo pacman -Sy $1 |
| 66 | + } |
| 67 | + ;; |
| 68 | + alpine) |
| 69 | + pm() { sudo apk add $1 |
| 70 | + } |
| 71 | + ;; |
| 72 | + gentoo) |
| 73 | + pm() { sudo emerge --ask $1 |
| 74 | + } |
| 75 | + ;; |
| 76 | + fedora) |
| 77 | + pm() { sudo dnf install -y $1 |
| 78 | + } |
| 79 | + ;; |
| 80 | + predator) |
| 81 | + pm() { sudo pacman -Sy --noconfirm $1 |
| 82 | + } |
| 83 | + ;; |
| 84 | + artix) |
| 85 | + pm() { sudo pacman -Sy --noconfirm $1 |
| 86 | + } |
| 87 | + ;; |
| 88 | + puppy_fossapup64) |
| 89 | + pm() { sudo pkg -d $1 && sudo pkg -i $1 |
| 90 | + } |
| 91 | + ;; |
| 92 | + raspbian) |
| 93 | + pm() { sudo apt install -y $1 |
| 94 | + } |
| 95 | + ;; |
| 96 | + endeavouros) |
| 97 | + pm() { sudo pacman -Sy --noconfirm $1 |
| 98 | + } |
| 99 | + ;; |
| 100 | + freebsd) |
| 101 | + pm() { sudo pkg install -y $1 |
| 102 | + } |
| 103 | + ;; |
| 104 | + *) |
| 105 | + echo "Sorry, but your System doesn't support [package manager] !" |
| 106 | + # Add manualy to use package manager to start psfconsole ! |
| 107 | + exit 0 |
| 108 | + ;; |
| 109 | + esac |
| 110 | +fi |
| 111 | + |
| 112 | +if ! hash svn &> /dev/null |
| 113 | +then |
| 114 | +pm subversion |
| 115 | +fi |
| 116 | + |
| 117 | +installPACKAGE() { |
| 118 | +if ! hash $1 &> /dev/null |
| 119 | +then |
| 120 | +pm $1 |
| 121 | +fi |
| 122 | +} |
| 123 | + |
| 124 | +installPACKAGE "php" |
| 125 | +installPACKAGE "git" |
| 126 | +installPACKAGE "jq" |
| 127 | +installPACKAGE "curl" |
| 128 | +installPACKAGE "clang" |
| 129 | +if [[ $OS == *'Android'* ]];then |
| 130 | +installPACKAGE "python" |
| 131 | +installPACKAGE "python2" |
| 132 | +else |
| 133 | +installPACKAGE "python2" |
| 134 | +installPACKAGE "python3" |
| 135 | +fi |
| 136 | + |
| 137 | +checkPACKAGE() { |
| 138 | +if ! hash svn php git jq curl clang $1 &> /dev/null |
| 139 | +then |
| 140 | +errorPACKAGE |
| 141 | +exit 1 |
| 142 | +fi |
| 143 | +} |
| 144 | + |
| 145 | +errorPACKAGE() { |
| 146 | +printf "${C1}\e[1mE:${R0} Unable to run psfconsole right now cause :\n" |
| 147 | +printf "${C1}\e[1mE:${R0} Dependencies are not Installed yet (psfconsole)\n" |
| 148 | +} |
| 149 | + |
| 150 | +if [[ $OS == *'Android'* ]];then |
| 151 | +checkPACKAGE "python" |
| 152 | +else |
| 153 | +checkPACKAGE "python3" |
| 154 | +fi |
0 commit comments