-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathncli.sh
64 lines (53 loc) · 1.79 KB
/
ncli.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#/bin/bash
VERSION="v0.1"
REPO_PATH="nodus-it/cli"
parseValueFromJson()
{
regex='"'"$1"'":\s"*\K[^\s,]*(?=\s*",)'
echo `echo "$2" | grep -oP $regex`
}
checkForNewerVersion()
{
json=$(curl https://api.github.com/repos/$REPO_PATH/releases/latest --silent)
onlineVersion=$(parseValueFromJson "name" "$json")
if [ "$onlineVersion" == "$VERSION" ]; then
echo "Newest version installed"
else
echo "Update required ($onlineVersion available)"
echo https://github.com/$REPO_PATH/releases/tag/$onlineVersion
read -p "Would you update the script now? [yes] " update
update=${update:-yes}
if [ "$update" == "yes" ]; then
filePath=$(pwd)"/"$(basename "$0")".test" # ToDo Remove Test
curl -o $filePath https://raw.githubusercontent.com/$REPO_PATH/refs/tags/$onlineVersion/LICENCE
echo "Please restart script...."
exit 1;
fi
fi
}
checkForNewerVersion
############################################################################
# #
# Functions #
# #
############################################################################
installDocker()
{
info "Install docker..."
return;
apt update
apt -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" -y
apt -y install docker-ce docker-compose-plugin
}
updateSystem()
{
apt update
apt upgrade
}
installPhp()
{
add-apt-repository ppa:ondrej/php
apt install php8.4 php8.4-cli php8.4-fpm php8.4-mysql php8.4-xml php8.4-mbstring php8.4-curl
}