forked from DFabric/DPlatform-Shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
37 lines (32 loc) · 1.18 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
[ $(id -u) != 0 ] && whiptail --title '/!\ WARNING - Not runned as root /!\' --msgbox " You don't run this as root!
You will need to have root permissions" 8 48
# Detect package manager
if hash apt-get 2>/dev/null ;then
PKG=deb
hash whiptail dialog 2>/dev/null && install="debconf-apt-progress -- apt-get install -y" || install="apt-get install -y"
remove="apt-get purge -y"
elif hash dnf 2>/dev/null ;then
PKG=rpm
install="dnf install -y"
remove="dnf remove -y"
elif hash yum 2>/dev/null ;then
PKG=rpm
install="yum install -y"
remove="yum remove -y"
elif hash pacman 2>/dev/null ;then
PKG=pkg
install="pacman -Syu"
remove="pacman -Rsy"
else
echo "Your operating system isn't supported" 8 48; exit 1
fi
# Prerequisites
hash git whiptail curl wget 2>/dev/null || $install git whiptail curl wget
# Current directory
DIR=$(cd -P $(dirname $0) && pwd)
cd $DIR
# Check available updates or clone the project
[ -d $DIR/.git ] && git pull
[ -d $DIR/DPlatform-ShellCore ] && DIR=$DIR/DPlatform-ShellCore || [ "${DIR##*/}" != DPlatform-ShellCore ] && git clone -b master --single-branch https://github.com/DFabric/DPlatform-ShellCore && DIR=$DIR/DPlatform-ShellCore
. $DIR/dplatform.sh