File indexing completed on 2024-11-10 05:11:10
0001 #!/usr/bin/env bash 0002 0003 # exit on any error 0004 set -Ee 0005 0006 # Enter the directory that contains this script file 0007 cd $(dirname $0) 0008 TOP=$( pwd -L ) 0009 0010 if [ $(id -u) -eq 0 ] ; then 0011 echo "This script should not be run as root or with sudo." 0012 return 1 0013 fi 0014 0015 # function to display menus 0016 show_menus() { 0017 clear 0018 echo " " 0019 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 0020 echo " WELCOME TO MYCROFT GUI INSTALLATION SCRIPT " 0021 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 0022 echo " " 0023 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." 0024 echo " " 0025 echo "~~~~~~~~~~~~~~~~~~~~~" 0026 echo " SELECT - DISTRIBUTION " 0027 echo "~~~~~~~~~~~~~~~~~~~~~" 0028 echo "1. KDE NEON / K/UBUNTU 20.04+" 0029 echo "2. MANJARO/ARCH" 0030 echo "3. ALPINE LINUX" 0031 echo "4. openSUSE Leap 15.x" 0032 echo "5. OTHERS" 0033 echo "6. UPDATE INSTALLATION" 0034 echo "7. EXIT" 0035 } 0036 0037 read_options() { 0038 echo " " 0039 local choice 0040 read -p "Enter choice [ 1 - 8 ] " choice 0041 case $choice in 0042 1) kubuntu ;; 0043 2) manjaro ;; 0044 3) alpine ;; 0045 4) opensuse ;; 0046 5) others ;; 0047 6) updateinstall;; 0048 7) exit 0;; 0049 *) echo -e "${RED}Error...${STD}" && sleep 2 0050 esac 0051 } 0052 0053 #trap '' SIGINT SIGQUIT SIGTSTP 0054 0055 function found_exe() { 0056 hash "$1" 2>/dev/null 0057 } 0058 0059 kubuntu() { 0060 echo "Starting Installation For KDE NEON / K/Ubuntu 20.04 +" 0061 echo "" 0062 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" 0063 echo "" 0064 echo "Please Enter Authentication For Installing System Dependencies" 0065 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 0066 build_gui 0067 } 0068 0069 manjaro() { 0070 echo "Starting Installation For Manjaro / Arch" 0071 echo "" 0072 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" 0073 echo "" 0074 echo "Please Enter Authentication For Installing System Dependencies" 0075 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 0076 build_gui 0077 } 0078 0079 alpine() { 0080 echo "Starting Installation For Alpine Linux" 0081 echo "" 0082 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" 0083 echo "They can easily be uninstalled later on by running 'apk del makedeps-mycroft-gui'" 0084 echo "" 0085 echo "Please Enter Authentication For Installing System Dependencies" 0086 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 0087 build_gui 0088 } 0089 0090 opensuse() { 0091 echo "Starting Installation For openSUSE Leap 15.x" 0092 echo "" 0093 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" 0094 echo "" 0095 echo "Please Enter Authentication For Installing System Dependencies" 0096 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 0097 0098 } 0099 0100 updateinstall() { 0101 echo "Pulling Latest Changes From Master" 0102 git pull origin master 0103 echo "Update Completed" 0104 exit 0 0105 } 0106 0107 continue_unknown() { 0108 echo "Starting Installation For Unknown Platform, Builds Will Fail If Required Packages Are Not Found" 0109 build_gui 0110 } 0111 0112 return_previous() { 0113 show_menus 0114 } 0115 0116 others () { 0117 clear 0118 echo "You must manually install the following packages for this platform" 0119 echo "cmake extra-cmake-modules kio kio-extras plasma-framework qt5-websockets qt5-webview qt5-declarative qt5-multimedia qt5-quickcontrols2 qt5-webengine qt5-base" 0120 echo "Consider contributing support for your platform by adding it to this script" 0121 0122 echo "1. Continue Installation" 0123 echo "2. Return To Previous Menu" 0124 echo "3. Exit" 0125 0126 local additional_choice 0127 read -p "Enter choice [ 1 - 3 ] " additional_choice 0128 case $additional_choice in 0129 1) continue_unknown;; 0130 2) return_previous;; 0131 3) exit 0;; 0132 esac 0133 } 0134 0135 function build_gui() { 0136 echo " " 0137 echo "Building Mycroft GUI" 0138 if [[ ! -d build-testing ]] ; then 0139 mkdir build-testing 0140 fi 0141 cd build-testing 0142 cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_CXX_COMPILER=clazy 0143 make -j4 0144 sudo make install 0145 install_lottie 0146 } 0147 0148 function install_lottie() { 0149 echo " " 0150 echo "Installing Lottie-QML" 0151 cd $TOP 0152 if [[ ! -d lottie-qml ]] ; then 0153 git clone https://github.com/kbroulik/lottie-qml 0154 cd lottie-qml 0155 mkdir build 0156 else 0157 cd lottie-qml 0158 git pull 0159 fi 0160 0161 cd build 0162 cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_CXX_COMPILER=clazy 0163 make 0164 sudo make install 0165 complete_installer 0166 } 0167 0168 function complete_installer() { 0169 clear 0170 echo "Select a configuration for the installation" 0171 echo "Note: Selecting a configuration will create a mycroft.conf file installed in /etc/mycroft/ folder" 0172 echo "" 0173 echo "1. Install Mark-2 Configuration To Emulate Mark-2" 0174 echo "2. Install KDE Desktop Configuration" 0175 echo "3. Skip Configuration" 0176 echo "4. Exit" 0177 0178 local configuration_choice 0179 read -p "Enter choice [ 1 - 3 ] " configuration_choice 0180 case $configuration_choice in 0181 1) install_mark2;; 0182 2) install_kde;; 0183 3) skip_config;; 0184 4) exit 0;; 0185 esac 0186 } 0187 0188 0189 function install_mark2() { 0190 echo " " 0191 echo "Installing Mark-2 Configuration" 0192 if [[ ! -f /etc/mycroft/mycroft.conf ]] ; then 0193 if [[ ! -d /etc/mycroft ]] ; then 0194 sudo mkdir /etc/mycroft 0195 fi 0196 0197 cat <<EOF | sudo tee /etc/mycroft/mycroft.conf 0198 { 0199 "enclosure": { 0200 "platform": "mycroft_mark_2" 0201 } 0202 } 0203 EOF 0204 0205 fi 0206 0207 if [[ -f /etc/mycroft/mycroft.conf ]] ; then 0208 echo "Found an existing Mycroft System Level Configuration at /etc/mycroft/mycroft.conf" 0209 echo "Please add the following enclosure settings manually to existing configuration to ensure working setup:" 0210 echo " " 0211 echo '"enclosure": {' 0212 echo ' "platform": "mycroft_mark_2"' 0213 echo '}' 0214 echo "" 0215 fi 0216 echo "Installation complete!" 0217 echo "To run, invoke: mycroft-gui-app" 0218 exit 0 0219 } 0220 0221 function install_kde() { 0222 echo " " 0223 echo "Installing KDE Configuration" 0224 if [[ ! -f /etc/mycroft/mycroft.conf ]] ; then 0225 if [[ ! -d /etc/mycroft ]] ; then 0226 sudo mkdir /etc/mycroft 0227 fi 0228 0229 cat <<EOF | sudo tee /etc/mycroft/mycroft.conf 0230 { 0231 "enclosure": { 0232 "platform": "kde" 0233 } 0234 } 0235 EOF 0236 0237 fi 0238 0239 if [[ -f /etc/mycroft/mycroft.conf ]] ; then 0240 echo "Found an existing Mycroft System Level Configuration at /etc/mycroft/mycroft.conf" 0241 echo "Please add the following enclosure settings manually to existing configuration to ensure working setup:" 0242 echo " " 0243 echo '"enclosure": {' 0244 echo ' "platform": "kde"' 0245 echo '}' 0246 echo "" 0247 fi 0248 echo "Installation complete!" 0249 echo "To run, invoke: mycroft-gui-app" 0250 exit 0 0251 } 0252 0253 function skip_config() { 0254 echo " " 0255 echo "Skipping Configuration" 0256 echo "Installation complete!" 0257 echo "To run, invoke: mycroft-gui-app" 0258 exit 0 0259 } 0260 0261 while true 0262 do 0263 0264 show_menus 0265 read_options 0266 done