forked from thirdbyte/ssj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
66 lines (48 loc) · 1.44 KB
/
install.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
65
66
#!/bin/bash
function check {
if ! docker --version &>/dev/null; then
echo "Docker is not installed. Terminating..."
exit 1
fi
if ! groups | grep -q "docker"; then
echo "The user '$USER' is not present in the 'docker' group. Terminating..."
exit 1
fi
if ! git --version &>/dev/null; then
echo "Git is not installed. Terminating..."
exit 1
fi
if ! ping -q -c 1 -W 1 github.com &>/dev/null; then
echo "Could not connect to the Internet. Terminating..."
exit 1
fi
}
function init_dir {
mkdir -p $HOME/.ssj
mkdir -p $HOME/.local/bin
mkdir -p $HOME/.local/share/applications
mkdir -p $HOME/.local/share/icons
}
function cp_files {
cp -r /tmp/ssj/home/. $HOME/.ssj/
cp /tmp/ssj/files/ssj $HOME/.local/bin/
cp /tmp/ssj/files/ssj.desktop $HOME/.local/share/applications/
cp /tmp/ssj/files/ssj.png $HOME/.local/share/icons/
}
function add_path {
if ! echo $PATH | grep -q "$HOME/.local/bin"; then
echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.bashrc
source $HOME/.bashrc
fi
}
check
docker pull scarfaced/ssj:latest && \
git clone https://github.com/thirdbyte/ssj /tmp/ssj && \
init_dir && \
cp_files && \
chmod +x $HOME/.local/bin/ssj && \
add_path && \
rm -rf /tmp/ssj && \
echo "" && \
echo "Installation successful! Please reboot."
docker image rm $(docker images -q --filter "dangling=true") &>/dev/null