-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathINSTALL.sh
executable file
·87 lines (73 loc) · 2.65 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
FOLDER_NAME=$(basename "$PWD")
CURRENT_DIR=$(pwd)
USERNAME=$(whoami)
BLACK=0
RED=1
GREEN=2
BLUE=4
WHITE=7
tput setab $BLUE
tput setaf $BLACK
echo " "
echo "This script will install PESTO on your system, would you like to proceed? (y/N)"
echo " "
tput sgr0
read -r CONFIRM
if [[ "$CONFIRM" != 'y' && "$CONFIRM" != 'Y' && "$CONFIRM" = "" ]]; then
tput setab $RED
tput setaf $BLACK
echo " "
echo "Installation aborted. Terminating ..."
echo " "
tput sgr0
exit 1
fi
echo "Moving files in working directories ..."
sudo cp -r "$CURRENT_DIR" /opt/
sudo cp "/opt/$FOLDER_NAME/desktop_files/basilico.desktop" /usr/share/applications/
sudo cp "/opt/$FOLDER_NAME/desktop_files/pinolo.desktop" /usr/share/applications/
sudo cp "/opt/$FOLDER_NAME/desktop_files/uninstall_pinolo.desktop" /usr/share/applications/
sudo cp "/opt/$FOLDER_NAME/basilico.service" /etc/systemd/system/
echo "Generating python virtual environment ..."
PYTHON_VERSION=$(python3 -c 'import sys; print(sys.version_info[1])')
if [[ "$PYTHON_VERSION" -ge 10 ]]; then
sudo python3 -m venv "/opt/$FOLDER_NAME/venv"
elif [[ "$(which python3.10)" != "" ]]; then
sudo python3.10 -m venv "/opt/$FOLDER_NAME/venv"
else
tput setab $RED
tput setaf $BLACK
echo " "
echo "Python 3.10.0 or higher is needed for installation."
echo "Installation aborted. Terminating ..."
echo " "
tput sgr0
exit 1
fi
sudo chown -R "$USERNAME:$USERNAME" "/opt/$FOLDER_NAME"
source "/opt/$FOLDER_NAME/venv/bin/activate"
pip install -r "/opt/$FOLDER_NAME/requirements.txt"
deactivate
echo "Installing system dependencies"
if [[ "$(which apt)" != "" ]]; then
sudo apt update
sudo apt install -y cloud-utils smartmontools
elif [[ "$(which pacman)" != "" ]]; then
sudo pacman -Sy --noconfirm cloud-utils smartmontools
else
tput setab $RED
tput setaf $BLACK
echo "Cannot install system dependencies. User have to install manually the following packages:"
echo " cloud-utils"
echo " smartmontools"
tput sgr0
fi
echo "Updating systemd services ..."
sudo systemctl daemon-reload
tput setaf $BLACK
tput setab $GREEN
echo " "
echo "Installation completed successfully! Search for PINOLO in your applications launcher."
echo " "
tput sgr0