forked from MycroftAI/mycroft-gui
-
Notifications
You must be signed in to change notification settings - Fork 3
/
dev_setup.sh
executable file
·266 lines (231 loc) · 8.63 KB
/
dev_setup.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#!/usr/bin/env bash
# exit on any error
set -Ee
# Enter the directory that contains this script file
cd $(dirname $0)
TOP=$( pwd -L )
if [ $(id -u) -eq 0 ] ; then
echo "This script should not be run as root or with sudo."
return 1
fi
# function to display menus
show_menus() {
clear
echo " "
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo " WELCOME TO MYCROFT GUI INSTALLATION SCRIPT "
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo " "
echo "Please Note: This is an Interactive script that will take you through a series of installation choices, where you might be required to provide your administrative password to successfully install system dependencies and Mycroft GUI on your system."
echo " "
echo "~~~~~~~~~~~~~~~~~~~~~"
echo " SELECT - DISTRIBUTION "
echo "~~~~~~~~~~~~~~~~~~~~~"
echo "1. KDE NEON / K/UBUNTU 20.04+"
echo "2. MANJARO/ARCH"
echo "3. ALPINE LINUX"
echo "4. openSUSE Leap 15.x"
echo "5. OTHERS"
echo "6. UPDATE INSTALLATION"
echo "7. EXIT"
}
read_options() {
echo " "
local choice
read -p "Enter choice [ 1 - 8 ] " choice
case $choice in
1) kubuntu ;;
2) manjaro ;;
3) alpine ;;
4) opensuse ;;
5) others ;;
6) updateinstall;;
7) exit 0;;
*) echo -e "${RED}Error...${STD}" && sleep 2
esac
}
#trap '' SIGINT SIGQUIT SIGTSTP
function found_exe() {
hash "$1" 2>/dev/null
}
kubuntu() {
echo "Starting Installation For KDE NEON / K/Ubuntu 20.04 +"
echo ""
echo "Following Packages Will Be Installed: git-core g++ cmake extra-cmake-modules gettext pkg-config qml-module-qtwebengine pkg-kde-tools qtbase5-dev qtdeclarative5-dev libkf5kio-dev libqt5websockets5-dev libkf5i18n-dev libkf5notifications-dev libkf5plasma-dev libqt5webview5-dev"
echo ""
echo "Please Enter Authentication For Installing System Dependencies"
sudo apt-get install -y git-core g++ cmake extra-cmake-modules gettext pkg-config qml-module-qtwebengine pkg-kde-tools qtbase5-dev qtdeclarative5-dev libkf5kio-dev libqt5websockets5-dev libkf5i18n-dev libkf5notifications-dev libkf5plasma-dev libqt5webview5-dev qtmultimedia5-dev qml-module-qtmultimedia
build_gui
}
manjaro() {
echo "Starting Installation For Manjaro / Arch"
echo ""
echo "Following Packages Will Be Installed: cmake extra-cmake-modules kio kio-extras plasma-framework qt5-websockets qt5-webview qt5-declarative qt5-multimedia qt5-quickcontrols2 qt5-webengine qt5-base"
echo ""
echo "Please Enter Authentication For Installing System Dependencies"
yes | sudo pacman -S git cmake extra-cmake-modules kio kio-extras plasma-framework qt5-websockets qt5-webview qt5-declarative qt5-multimedia qt5-quickcontrols2 qt5-webengine qt5-base
build_gui
}
alpine() {
echo "Starting Installation For Alpine Linux"
echo ""
echo "The development headers for the following packages will be installed: cmake extra-cmake-modules kio kio-extras plasma-framework qt5-qtwebsockets qt5-qtwebview qt5-qtdeclarative qt5-qtmultimedia qt5-qtquickcontrols2 qt5-qtwebengine qt5-qtbase"
echo "They can easily be uninstalled later on by running 'apk del makedeps-mycroft-gui'"
echo ""
echo "Please Enter Authentication For Installing System Dependencies"
sudo apk add --virtual makedeps-mycroft-gui alpine-sdk cmake extra-cmake-modules kio-dev kio-extras-dev plasma-framework-dev qt5-qtwebsockets-dev qt5-qtwebview-dev qt5-qtdeclarative-dev qt5-qtmultimedia-dev qt5-qtquickcontrols2-dev qt5-qtwebengine-dev qt5-qtbase-dev
build_gui
}
opensuse() {
echo "Starting Installation For openSUSE Leap 15.x"
echo ""
echo "The development headers for the following packages will be installed: cmake extra-cmake-modules kio-devel kio-extras5 plasma-framework libqt5-qtwebsockets libqt5-qtwebview libqt5-qtdeclarative libqt5-qtmultimedia libQt5QuickControls2 libqt5-qtwebengine libqt5-qtbase ki18n kdbusaddons"
echo ""
echo "Please Enter Authentication For Installing System Dependencies"
sudo zypper --non-interactive install cmake extra-cmake-modules kio-devel kio-extras5 plasma-framework-devel libqt5-qtwebsockets-devel libqt5-qtwebview-devel libqt5-qtdeclarative-devel libqt5-qtmultimedia-devel libQt5QuickControls2-devel libqt5-qtwebengine-devel libqt5-qtbase-devel ki18n-devel kdbusaddons-devel
}
updateinstall() {
echo "Pulling Latest Changes From Master"
git pull origin master
echo "Update Completed"
exit 0
}
continue_unknown() {
echo "Starting Installation For Unknown Platform, Builds Will Fail If Required Packages Are Not Found"
build_gui
}
return_previous() {
show_menus
}
others () {
clear
echo "You must manually install the following packages for this platform"
echo "cmake extra-cmake-modules kio kio-extras plasma-framework qt5-websockets qt5-webview qt5-declarative qt5-multimedia qt5-quickcontrols2 qt5-webengine qt5-base"
echo "Consider contributing support for your platform by adding it to this script"
echo "1. Continue Installation"
echo "2. Return To Previous Menu"
echo "3. Exit"
local additional_choice
read -p "Enter choice [ 1 - 3 ] " additional_choice
case $additional_choice in
1) continue_unknown;;
2) return_previous;;
3) exit 0;;
esac
}
function build_gui() {
echo " "
echo "Building Mycroft GUI"
if [[ ! -d build-testing ]] ; then
mkdir build-testing
fi
cd build-testing
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_CXX_COMPILER=clazy
make -j4
sudo make install
install_lottie
}
function install_lottie() {
echo " "
echo "Installing Lottie-QML"
cd $TOP
if [[ ! -d lottie-qml ]] ; then
git clone https://github.com/kbroulik/lottie-qml
cd lottie-qml
mkdir build
else
cd lottie-qml
git pull
fi
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_CXX_COMPILER=clazy
make
sudo make install
complete_installer
}
function complete_installer() {
clear
echo "Select a configuration for the installation"
echo "Note: Selecting a configuration will create a mycroft.conf file installed in /etc/mycroft/ folder"
echo ""
echo "1. Install Mark-2 Configuration To Emulate Mark-2"
echo "2. Install KDE Desktop Configuration"
echo "3. Skip Configuration"
echo "4. Exit"
local configuration_choice
read -p "Enter choice [ 1 - 3 ] " configuration_choice
case $configuration_choice in
1) install_mark2;;
2) install_kde;;
3) skip_config;;
4) exit 0;;
esac
}
function install_mark2() {
echo " "
echo "Installing Mark-2 Configuration"
if [[ ! -f /etc/mycroft/mycroft.conf ]] ; then
if [[ ! -d /etc/mycroft ]] ; then
sudo mkdir /etc/mycroft
fi
cat <<EOF | sudo tee /etc/mycroft/mycroft.conf
{
"enclosure": {
"platform": "mycroft_mark_2"
}
}
EOF
fi
if [[ -f /etc/mycroft/mycroft.conf ]] ; then
echo "Found an existing Mycroft System Level Configuration at /etc/mycroft/mycroft.conf"
echo "Please add the following enclosure settings manually to existing configuration to ensure working setup:"
echo " "
echo '"enclosure": {'
echo ' "platform": "mycroft_mark_2"'
echo '}'
echo ""
fi
echo "Installation complete!"
echo "To run, invoke: mycroft-gui-app"
exit 0
}
function install_kde() {
echo " "
echo "Installing KDE Configuration"
if [[ ! -f /etc/mycroft/mycroft.conf ]] ; then
if [[ ! -d /etc/mycroft ]] ; then
sudo mkdir /etc/mycroft
fi
cat <<EOF | sudo tee /etc/mycroft/mycroft.conf
{
"enclosure": {
"platform": "kde"
}
}
EOF
fi
if [[ -f /etc/mycroft/mycroft.conf ]] ; then
echo "Found an existing Mycroft System Level Configuration at /etc/mycroft/mycroft.conf"
echo "Please add the following enclosure settings manually to existing configuration to ensure working setup:"
echo " "
echo '"enclosure": {'
echo ' "platform": "kde"'
echo '}'
echo ""
fi
echo "Installation complete!"
echo "To run, invoke: mycroft-gui-app"
exit 0
}
function skip_config() {
echo " "
echo "Skipping Configuration"
echo "Installation complete!"
echo "To run, invoke: mycroft-gui-app"
exit 0
}
while true
do
show_menus
read_options
done