From adad2590378c0981d8457120f92b8b23dac294af Mon Sep 17 00:00:00 2001 From: JEEVITHA KANNAN K S Date: Mon, 30 Sep 2024 15:51:05 +0530 Subject: [PATCH 1/5] Fix flatpak paths --- core/tabs/applications-setup/bottles-setup.sh | 12 ++--- .../communication-apps/slack-setup.sh | 15 ++++++- .../communication-apps/zoom-setup.sh | 15 ++++++- .../applications-setup/office-suite-setup.sh | 2 +- core/tabs/applications-setup/setup-flatpak.sh | 44 +++---------------- core/tabs/common-script.sh | 27 ++++++++++++ 6 files changed, 64 insertions(+), 51 deletions(-) diff --git a/core/tabs/applications-setup/bottles-setup.sh b/core/tabs/applications-setup/bottles-setup.sh index 02fef60b..56b42d5b 100755 --- a/core/tabs/applications-setup/bottles-setup.sh +++ b/core/tabs/applications-setup/bottles-setup.sh @@ -3,14 +3,9 @@ . ../common-script.sh installBottles() { - if ! command_exists flatpak; then - printf "%b\n" "${YELLOW}Installing Bottles...${RC}" - case "$PACKAGER" in - *) - . ./setup-flatpak.sh - flatpak install -y flathub com.usebottles.bottles - ;; - esac + if ! flatpak_app_exists "com.usebottles.bottles"; then + printf "%b\n" "${YELLOW}Installing Bottles...${RC}" + flatpak install -y flathub com.usebottles.bottles else printf "%b\n" "${GREEN}Bottles is already installed.${RC}" fi @@ -18,4 +13,5 @@ installBottles() { checkEnv checkEscalationTool +checkFlatpak installBottles \ No newline at end of file diff --git a/core/tabs/applications-setup/communication-apps/slack-setup.sh b/core/tabs/applications-setup/communication-apps/slack-setup.sh index 5ecdd27f..0e6e6c54 100644 --- a/core/tabs/applications-setup/communication-apps/slack-setup.sh +++ b/core/tabs/applications-setup/communication-apps/slack-setup.sh @@ -2,15 +2,26 @@ . ../../common-script.sh +checkSlackInstallation() { + case "$PACKAGER" in + pacman) + command_exists slack + ;; + *) + checkFlatpak + flatpak_app_exists com.slack.Slack + ;; + esac +} + installSlack() { - if ! command_exists slack; then + if ! checkSlackInstallation; then printf "%b\n" "${YELLOW}Installing Slack...${RC}" case "$PACKAGER" in pacman) "$AUR_HELPER" -S --needed --noconfirm slack-desktop ;; *) - . ./setup-flatpak.sh flatpak install -y flathub com.slack.Slack ;; esac diff --git a/core/tabs/applications-setup/communication-apps/zoom-setup.sh b/core/tabs/applications-setup/communication-apps/zoom-setup.sh index 4b50013a..b3ace0d1 100644 --- a/core/tabs/applications-setup/communication-apps/zoom-setup.sh +++ b/core/tabs/applications-setup/communication-apps/zoom-setup.sh @@ -2,15 +2,26 @@ . ../../common-script.sh +checkZoomInstallation() { + case "$PACKAGER" in + pacman) + command_exists zoom + ;; + *) + checkFlatpak + flatpak_app_exists us.zoom.Zoom + ;; + esac +} + installZoom() { - if ! command_exists zoom; then + if ! checkZoomInstallation; then printf "%b\n" "${YELLOW}Installing Zoom...${RC}" case "$PACKAGER" in pacman) "$AUR_HELPER" -S --needed --noconfirm zoom ;; *) - . ./setup-flatpak.sh flatpak install -y flathub us.zoom.Zoom ;; esac diff --git a/core/tabs/applications-setup/office-suite-setup.sh b/core/tabs/applications-setup/office-suite-setup.sh index 61a08ebd..c999542d 100644 --- a/core/tabs/applications-setup/office-suite-setup.sh +++ b/core/tabs/applications-setup/office-suite-setup.sh @@ -200,4 +200,4 @@ officeSuiteSetup() { checkEnv checkEscalationTool checkAURHelper -officeSuiteSetup +officeSuiteSetup \ No newline at end of file diff --git a/core/tabs/applications-setup/setup-flatpak.sh b/core/tabs/applications-setup/setup-flatpak.sh index 75da28af..379467a6 100755 --- a/core/tabs/applications-setup/setup-flatpak.sh +++ b/core/tabs/applications-setup/setup-flatpak.sh @@ -2,9 +2,7 @@ . ../common-script.sh -# Used to detect the desktop environment, Only used for the If statement in the setup_flatpak function. -# Perhaps this should be moved to common-script.sh later on? -detect_de() { +checkDE() { if [ -n "$XDG_CURRENT_DESKTOP" ]; then case "$XDG_CURRENT_DESKTOP" in *GNOME*) @@ -17,42 +15,11 @@ detect_de() { fi } -# Install Flatpak if not already installed. -setup_flatpak() { - if ! command_exists flatpak; then - printf "%b\n" "${YELLOW}Installing Flatpak...${RC}" - case "$PACKAGER" in - pacman) - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak - ;; - *) - "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak - ;; - esac - printf "%b\n" "Adding Flathub remote..." - "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - else - if command_exists flatpak; then - if ! flatpak remotes | grep -q "flathub"; then - printf "%b" "${YELLOW}Detected Flatpak package manager but Flathub remote is not added. Would you like to add it? (y/N): ${RC}" - read -r add_remote - case "$add_remote" in - [Yy]*) - printf "%b\n" "Adding Flathub remote..." - "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - ;; - esac - else - # Needed mostly for systems without a polkit agent running (Error: updating: Unable to connect to system bus) - printf "%b\n" "${GREEN}Flathub already setup. You can quit.${RC}" - fi - fi - fi - +installExtra() { if [ "$PACKAGER" = "apt-get" ] || [ "$PACKAGER" = "nala" ]; then - detect_de + checkDE # Only used for Ubuntu GNOME. Ubuntu GNOME doesnt allow flathub to be added as a remote to their store. - # So in case the user wants to use a GUI siftware manager they can setup it here + # So in case the user wants to use a GUI software manager they can setup it here if [ "$DE" = "GNOME" ]; then printf "%b" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/N): ${RC}" read -r install_gnome @@ -72,4 +39,5 @@ setup_flatpak() { checkEnv checkEscalationTool -setup_flatpak +checkFlatpak +installExtra \ No newline at end of file diff --git a/core/tabs/common-script.sh b/core/tabs/common-script.sh index 12ab1146..9d5bc2f4 100644 --- a/core/tabs/common-script.sh +++ b/core/tabs/common-script.sh @@ -12,6 +12,33 @@ command_exists() { command -v "$1" >/dev/null 2>&1 } +flatpak_app_exists() { + flatpak info "$1" >/dev/null 2>&1 +} + +checkFlatpak() { + if ! command_exists flatpak; then + printf "%b\n" "${YELLOW}Installing Flatpak...${RC}" + case "$PACKAGER" in + pacman) + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak + ;; + *) + "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak + ;; + esac + printf "%b\n" "Adding Flathub remote..." + "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + else + if ! flatpak remotes | grep -q "flathub"; then + printf "%b\n" "${YELLOW}Adding Flathub remote...${RC}" + "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + else + printf "%b\n" "${CYAN}Flatpak is installed${RC}" + fi + fi +} + checkAURHelper() { ## Check & Install AUR helper if [ "$PACKAGER" = "pacman" ]; then From 637fdc54d35ab1c84b49189fdaa01bf787ab6e0d Mon Sep 17 00:00:00 2001 From: JEEVITHA KANNAN K S Date: Tue, 1 Oct 2024 11:43:28 +0530 Subject: [PATCH 2/5] Refact office suites flatpak --- Cargo.lock | 4 +- .../Developer-tools/meld-setup.sh | 15 +- .../applications-setup/office-suite-setup.sh | 203 ------------------ .../office-suites/libreoffice.sh | 15 +- .../office-suites/onlyoffice.sh | 15 +- .../office-suites/wpsoffice.sh | 15 +- 6 files changed, 54 insertions(+), 213 deletions(-) delete mode 100644 core/tabs/applications-setup/office-suite-setup.sh diff --git a/Cargo.lock b/Cargo.lock index c33834f6..1ff46393 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -491,7 +491,7 @@ checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "linutil_core" -version = "24.9.28" +version = "24.9.23" dependencies = [ "ego-tree", "include_dir", @@ -503,7 +503,7 @@ dependencies = [ [[package]] name = "linutil_tui" -version = "24.9.28" +version = "24.9.23" dependencies = [ "ansi-to-tui", "anstyle", diff --git a/core/tabs/applications-setup/Developer-tools/meld-setup.sh b/core/tabs/applications-setup/Developer-tools/meld-setup.sh index bd0bb3c2..aacafe27 100644 --- a/core/tabs/applications-setup/Developer-tools/meld-setup.sh +++ b/core/tabs/applications-setup/Developer-tools/meld-setup.sh @@ -2,8 +2,20 @@ . ../../common-script.sh +checkMeldInstallation() { + case "$PACKAGER" in + pacman|apt-get|nala) + command_exists meld + ;; + *) + checkFlatpak + flatpak_app_exists org.gnome.meld + ;; + esac +} + installMeld() { - if ! command_exists meld; then + if ! checkMeldInstallation; then printf "%b\n" "${YELLOW}Installing Meld...${RC}" case "$PACKAGER" in pacman) @@ -13,7 +25,6 @@ installMeld() { "$ESCALATION_TOOL" "$PACKAGER" -y install meld ;; *) - . ../setup-flatpak.sh flatpak install -y flathub org.gnome.meld ;; esac diff --git a/core/tabs/applications-setup/office-suite-setup.sh b/core/tabs/applications-setup/office-suite-setup.sh deleted file mode 100644 index c999542d..00000000 --- a/core/tabs/applications-setup/office-suite-setup.sh +++ /dev/null @@ -1,203 +0,0 @@ -#!/bin/sh -e - -. ../common-script.sh - -install_onlyoffice() { - if ! command_exists onlyoffice-desktopeditors; then - printf "%b\n" "${YELLOW}Installing Only Office..${RC}." - case "$PACKAGER" in - apt-get|nala) - curl -O https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb - "$ESCALATION_TOOL" "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb - ;; - zypper|dnf) - . ./setup-flatpak.sh - flatpak install -y flathub org.onlyoffice.desktopeditors - ;; - pacman) - "$AUR_HELPER" -S --needed --noconfirm onlyoffice - ;; - *) - printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" - exit 1 - ;; - esac - else - printf "%b\n" "${GREEN}Only Office is already installed.${RC}" - fi -} - -install_libreoffice() { - if ! command_exists libreoffice; then - printf "%b\n" "${YELLOW}Installing Libre Office...${RC}" - case "$PACKAGER" in - apt-get|nala) - "$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core - ;; - zypper|dnf) - . ./setup-flatpak.sh - flatpak install -y flathub org.libreoffice.LibreOffice - ;; - pacman) - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh - ;; - *) - printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" - exit 1 - ;; - esac - else - printf "%b\n" "${GREEN}Libre Office is already installed.${RC}" - fi -} - -install_wpsoffice() { - if ! command_exists com.wps.Office; then - printf "%b\n" "${YELLOW}Installing WPS Office...${RC}" - case "$PACKAGER" in - pacman) - "$AUR_HELPER" -S --noconfirm wps-office - ;; - *) - . ./setup-flatpak.sh - flatpak install flathub com.wps.Office - ;; - esac - else - printf "%b\n" "${GREEN}WPS Office is already installed.${RC}" - fi -} - -# needs to be updated every year for latest version -install_freeoffice() { - if ! command_exists softmaker-freeoffice-2024 freeoffice softmaker; then - printf "%b\n" "${YELLOW}Installing Free Office...${RC}" - case "$PACKAGER" in - apt-get|nala) - curl -O https://www.softmaker.net/down/softmaker-freeoffice-2024_1218-01_amd64.deb - "$ESCALATION_TOOL" "$PACKAGER" install -y ./softmaker-freeoffice-2024_1218-01_amd64.deb - ;; - zypper) - "$ESCALATION_TOOL" "$PACKAGER" addrepo -f https://shop.softmaker.com/repo/rpm SoftMaker - "$ESCALATION_TOOL" "$PACKAGER" --gpg-auto-import-keys refresh - "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install softmaker-freeoffice-2024 - ;; - pacman) - "$AUR_HELPER" -S --noconfirm freeoffice - ;; - dnf) - "$ESCALATION_TOOL" curl -O -qO /etc/yum.repos.d/softmaker.repo https://shop.softmaker.com/repo/softmaker.repo - "$ESCALATION_TOOL" "$PACKAGER" install -y softmaker-freeoffice-2024 - ;; - *) - printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" - exit 1 - ;; - esac - else - printf "%b\n" "${GREEN}Free Office is already installed.${RC}" - fi -} - -install_evince() { - if ! command_exists evince; then - printf "%b\n" "${YELLOW}Installing Evince...${RC}" - case "$PACKAGER" in - pacman) - "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm evince - ;; - *) - "$ESCALATION_TOOL" "$PACKAGER" install -y evince - ;; - esac - else - printf "%b\n" "${GREEN}Evince is already installed.${RC}" - fi -} - -install_okular() { - if ! command_exists okular; then - printf "%b\n" "${YELLOW}Installing Okular...${RC}" - case "$PACKAGER" in - pacman) - "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm okular - ;; - *) - "$ESCALATION_TOOL" "$PACKAGER" install -y okular - ;; - esac - else - printf "%b\n" "${GREEN}Okular is already installed.${RC}" - fi -} - -install_pdfstudioviewer() { - if ! command_exists pdfstudioviewer2024/pdfstudioviewer2024; then - printf "%b\n" "${YELLOW}Installing PDF Studio Viewer...${RC}" - curl -O https://download.qoppa.com/pdfstudioviewer/PDFStudioViewer_linux64.sh - "$ESCALATION_TOOL" chmod +x PDFStudioViewer_linux64.sh - if sh PDFStudioViewer_linux64.sh; then - printf "%b\n" "${GREEN}PDF Studio Viewer installed successfully!${RC}" - else - printf "%b\n" "${RED}Installation failed!${RC}" - fi - rm PDFStudioViewer_linux64.sh - else - printf "%b\n" "${GREEN}PDF Studio Viewer is already installed.${RC}" - fi -} - -install_pdfstudio() { - if ! command_exists pdfstudio2024/pdfstudio2024; then - printf "%b\n" "${YELLOW}Installing PDF Studio...${RC}" - curl -O https://download.qoppa.com/pdfstudio/PDFStudio_linux64.sh - "$ESCALATION_TOOL" chmod +x PDFStudio_linux64.sh - if sh PDFStudio_linux64.sh; then - printf "%b\n" "${GREEN}PDF Studio installed successfully!${RC}" - else - printf "%b\n" "${RED}PDF Studio installation failed!${RC}" - fi - rm PDFStudio_linux64.sh - else - printf "%b\n" "${GREEN}PDF Studio is already installed.${RC}" - fi -} - -officeSuiteSetup() { - clear - printf "%b\n" "Office Suite Setup Script" - printf "%b\n" "----------------------------" - printf "%b\n" "Select the suite you want to install:" - printf "%b\n" "1. OnlyOffice" - printf "%b\n" "2. LibreOffice" - printf "%b\n" "3. WPS Office" - printf "%b\n" "4. Free Office" - printf "%b\n" "Select the PDF Suite you want to install:" - printf "%b\n" "----------------------------" - printf "%b\n" "5. Evince" - printf "%b\n" "6. Okular" - printf "%b\n" "7. PDF Studio Viewer" - printf "%b\n" "8. PDF Studio (Paid Software)" - printf "%b\n" "----------------------------" - printf "%b" "Enter your choices (e.g., 1 3 5): " - read -r choice - for ch in $choice; do - case $ch in - 1) install_onlyoffice ;; - 2) install_libreoffice ;; - 3) install_wpsoffice ;; - 4) install_freeoffice ;; - 5) install_evince ;; - 6) install_okular ;; - 7) install_pdfstudioviewer ;; - 8) install_pdfstudio ;; - *) printf "%b\n" "${RED}Invalid option: $ch ${RC}" ;; - esac - done - printf "%b\n" "${GREEN}Installation complete!${RC}" -} - -checkEnv -checkEscalationTool -checkAURHelper -officeSuiteSetup \ No newline at end of file diff --git a/core/tabs/applications-setup/office-suites/libreoffice.sh b/core/tabs/applications-setup/office-suites/libreoffice.sh index a9850fdc..00184cea 100644 --- a/core/tabs/applications-setup/office-suites/libreoffice.sh +++ b/core/tabs/applications-setup/office-suites/libreoffice.sh @@ -2,15 +2,26 @@ . ../common-script.sh +checkLibeOfficeInstallation() { + case "$PACKAGER" in + zypper|dnf) + checkFlatpak + flatpak_app_exists org.libreoffice.LibreOffice + ;; + *) + command_exists meld + ;; + esac +} + installLibreOffice() { - if ! command_exists libreoffice; then + if ! checkLibeOfficeInstallation; then printf "%b\n" "${YELLOW}Installing Libre Office...${RC}" case "$PACKAGER" in apt-get|nala) "$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core ;; zypper|dnf) - . ./setup-flatpak.sh flatpak install -y flathub org.libreoffice.LibreOffice ;; pacman) diff --git a/core/tabs/applications-setup/office-suites/onlyoffice.sh b/core/tabs/applications-setup/office-suites/onlyoffice.sh index aaea7547..078789d0 100644 --- a/core/tabs/applications-setup/office-suites/onlyoffice.sh +++ b/core/tabs/applications-setup/office-suites/onlyoffice.sh @@ -2,8 +2,20 @@ . ../common-script.sh +checkOnlyOfficeInstallation() { + case "$PACKAGER" in + zypper|dnf) + checkFlatpak + flatpak_app_exists org.onlyoffice.desktopeditors + ;; + *) + command_exists onlyoffice-desktopeditors + ;; + esac +} + installOnlyOffice() { - if ! command_exists onlyoffice-desktopeditors; then + if ! checkOnlyOfficeInstallation; then printf "%b\n" "${YELLOW}Installing Only Office..${RC}." case "$PACKAGER" in apt-get|nala) @@ -11,7 +23,6 @@ installOnlyOffice() { "$ESCALATION_TOOL" "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb ;; zypper|dnf) - . ./setup-flatpak.sh flatpak install -y flathub org.onlyoffice.desktopeditors ;; pacman) diff --git a/core/tabs/applications-setup/office-suites/wpsoffice.sh b/core/tabs/applications-setup/office-suites/wpsoffice.sh index ce1bbc72..bf64c0b2 100644 --- a/core/tabs/applications-setup/office-suites/wpsoffice.sh +++ b/core/tabs/applications-setup/office-suites/wpsoffice.sh @@ -2,15 +2,26 @@ . ../common-script.sh +checkWpsOfficeInstallation() { + case "$PACKAGER" in + pacman) + command_exists wps + ;; + *) + checkFlatpak + flatpak_app_exists com.wps.Office + ;; + esac +} + installWpsOffice() { - if ! command_exists com.wps.Office; then + if ! checkWpsOfficeInstallation; then printf "%b\n" "${YELLOW}Installing WPS Office...${RC}" case "$PACKAGER" in pacman) "$AUR_HELPER" -S --needed --noconfirm wps-office ;; *) - . ./setup-flatpak.sh flatpak install flathub com.wps.Office ;; esac From bcd1e4caccb2fff23800c2d545417b5650e75672 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Wed, 9 Oct 2024 20:05:34 +0530 Subject: [PATCH 3/5] Merge flatpak_app_exists and command_exists --- .../Developer-tools/meld-setup.sh | 15 ++------------- core/tabs/applications-setup/bottles-setup.sh | 2 +- .../communication-apps/slack-setup.sh | 15 ++------------- .../communication-apps/zoom-setup.sh | 15 ++------------- .../office-suites/libreoffice.sh | 15 ++------------- .../office-suites/onlyoffice.sh | 15 ++------------- .../applications-setup/office-suites/wpsoffice.sh | 15 ++------------- core/tabs/common-script.sh | 6 ++---- 8 files changed, 15 insertions(+), 83 deletions(-) diff --git a/core/tabs/applications-setup/Developer-tools/meld-setup.sh b/core/tabs/applications-setup/Developer-tools/meld-setup.sh index aacafe27..031a09ae 100644 --- a/core/tabs/applications-setup/Developer-tools/meld-setup.sh +++ b/core/tabs/applications-setup/Developer-tools/meld-setup.sh @@ -2,20 +2,8 @@ . ../../common-script.sh -checkMeldInstallation() { - case "$PACKAGER" in - pacman|apt-get|nala) - command_exists meld - ;; - *) - checkFlatpak - flatpak_app_exists org.gnome.meld - ;; - esac -} - installMeld() { - if ! checkMeldInstallation; then + if ! command_exists org.gnome.meld && ! command_exists meld; then printf "%b\n" "${YELLOW}Installing Meld...${RC}" case "$PACKAGER" in pacman) @@ -25,6 +13,7 @@ installMeld() { "$ESCALATION_TOOL" "$PACKAGER" -y install meld ;; *) + checkFlatpak flatpak install -y flathub org.gnome.meld ;; esac diff --git a/core/tabs/applications-setup/bottles-setup.sh b/core/tabs/applications-setup/bottles-setup.sh index 56b42d5b..0b29bedb 100755 --- a/core/tabs/applications-setup/bottles-setup.sh +++ b/core/tabs/applications-setup/bottles-setup.sh @@ -3,7 +3,7 @@ . ../common-script.sh installBottles() { - if ! flatpak_app_exists "com.usebottles.bottles"; then + if ! command_exists com.usebottles.bottles; then printf "%b\n" "${YELLOW}Installing Bottles...${RC}" flatpak install -y flathub com.usebottles.bottles else diff --git a/core/tabs/applications-setup/communication-apps/slack-setup.sh b/core/tabs/applications-setup/communication-apps/slack-setup.sh index 0e6e6c54..24d6e532 100644 --- a/core/tabs/applications-setup/communication-apps/slack-setup.sh +++ b/core/tabs/applications-setup/communication-apps/slack-setup.sh @@ -2,26 +2,15 @@ . ../../common-script.sh -checkSlackInstallation() { - case "$PACKAGER" in - pacman) - command_exists slack - ;; - *) - checkFlatpak - flatpak_app_exists com.slack.Slack - ;; - esac -} - installSlack() { - if ! checkSlackInstallation; then + if ! command_exists com.slack.Slack && ! command_exists slack; then printf "%b\n" "${YELLOW}Installing Slack...${RC}" case "$PACKAGER" in pacman) "$AUR_HELPER" -S --needed --noconfirm slack-desktop ;; *) + checkFlatpak flatpak install -y flathub com.slack.Slack ;; esac diff --git a/core/tabs/applications-setup/communication-apps/zoom-setup.sh b/core/tabs/applications-setup/communication-apps/zoom-setup.sh index b3ace0d1..19d7e407 100644 --- a/core/tabs/applications-setup/communication-apps/zoom-setup.sh +++ b/core/tabs/applications-setup/communication-apps/zoom-setup.sh @@ -2,26 +2,15 @@ . ../../common-script.sh -checkZoomInstallation() { - case "$PACKAGER" in - pacman) - command_exists zoom - ;; - *) - checkFlatpak - flatpak_app_exists us.zoom.Zoom - ;; - esac -} - installZoom() { - if ! checkZoomInstallation; then + if ! command_exists us.zoom.Zoom && ! command_exists zoom; then printf "%b\n" "${YELLOW}Installing Zoom...${RC}" case "$PACKAGER" in pacman) "$AUR_HELPER" -S --needed --noconfirm zoom ;; *) + checkFlatpak flatpak install -y flathub us.zoom.Zoom ;; esac diff --git a/core/tabs/applications-setup/office-suites/libreoffice.sh b/core/tabs/applications-setup/office-suites/libreoffice.sh index 00184cea..1e149e9f 100644 --- a/core/tabs/applications-setup/office-suites/libreoffice.sh +++ b/core/tabs/applications-setup/office-suites/libreoffice.sh @@ -2,26 +2,15 @@ . ../common-script.sh -checkLibeOfficeInstallation() { - case "$PACKAGER" in - zypper|dnf) - checkFlatpak - flatpak_app_exists org.libreoffice.LibreOffice - ;; - *) - command_exists meld - ;; - esac -} - installLibreOffice() { - if ! checkLibeOfficeInstallation; then + if ! command_exists org.libreoffice.LibreOffice && ! command_exists libreoffice; then printf "%b\n" "${YELLOW}Installing Libre Office...${RC}" case "$PACKAGER" in apt-get|nala) "$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core ;; zypper|dnf) + checkFlatpak flatpak install -y flathub org.libreoffice.LibreOffice ;; pacman) diff --git a/core/tabs/applications-setup/office-suites/onlyoffice.sh b/core/tabs/applications-setup/office-suites/onlyoffice.sh index 078789d0..7f524051 100644 --- a/core/tabs/applications-setup/office-suites/onlyoffice.sh +++ b/core/tabs/applications-setup/office-suites/onlyoffice.sh @@ -2,20 +2,8 @@ . ../common-script.sh -checkOnlyOfficeInstallation() { - case "$PACKAGER" in - zypper|dnf) - checkFlatpak - flatpak_app_exists org.onlyoffice.desktopeditors - ;; - *) - command_exists onlyoffice-desktopeditors - ;; - esac -} - installOnlyOffice() { - if ! checkOnlyOfficeInstallation; then + if ! command_exists org.onlyoffice.desktopeditors && ! command_exists onlyoffice-desktopeditors; then printf "%b\n" "${YELLOW}Installing Only Office..${RC}." case "$PACKAGER" in apt-get|nala) @@ -23,6 +11,7 @@ installOnlyOffice() { "$ESCALATION_TOOL" "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb ;; zypper|dnf) + checkFlatpak flatpak install -y flathub org.onlyoffice.desktopeditors ;; pacman) diff --git a/core/tabs/applications-setup/office-suites/wpsoffice.sh b/core/tabs/applications-setup/office-suites/wpsoffice.sh index bf64c0b2..67cfb307 100644 --- a/core/tabs/applications-setup/office-suites/wpsoffice.sh +++ b/core/tabs/applications-setup/office-suites/wpsoffice.sh @@ -2,26 +2,15 @@ . ../common-script.sh -checkWpsOfficeInstallation() { - case "$PACKAGER" in - pacman) - command_exists wps - ;; - *) - checkFlatpak - flatpak_app_exists com.wps.Office - ;; - esac -} - installWpsOffice() { - if ! checkWpsOfficeInstallation; then + if ! command_exists com.wps.Office && ! command_exists wps; then printf "%b\n" "${YELLOW}Installing WPS Office...${RC}" case "$PACKAGER" in pacman) "$AUR_HELPER" -S --needed --noconfirm wps-office ;; *) + checkFlatpak flatpak install flathub com.wps.Office ;; esac diff --git a/core/tabs/common-script.sh b/core/tabs/common-script.sh index 9d5bc2f4..8d9a5a84 100644 --- a/core/tabs/common-script.sh +++ b/core/tabs/common-script.sh @@ -9,13 +9,11 @@ CYAN='\033[36m' GREEN='\033[32m' command_exists() { + ## Export flatpak binary paths. Should not be exported to PATH https://github.com/flatpak/flatpak/issues/3573#issuecomment-1330754720 + export XDG_DATA_DIRS=/home/jeeva/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:$XDG_DATA_DIRS command -v "$1" >/dev/null 2>&1 } -flatpak_app_exists() { - flatpak info "$1" >/dev/null 2>&1 -} - checkFlatpak() { if ! command_exists flatpak; then printf "%b\n" "${YELLOW}Installing Flatpak...${RC}" From 9546bcd25086a5eae9159f323120ed45b04dfc9e Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Wed, 9 Oct 2024 20:32:26 +0530 Subject: [PATCH 4/5] Fix binary path bug --- core/tabs/common-script.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/tabs/common-script.sh b/core/tabs/common-script.sh index 8d9a5a84..319e83f8 100644 --- a/core/tabs/common-script.sh +++ b/core/tabs/common-script.sh @@ -9,8 +9,7 @@ CYAN='\033[36m' GREEN='\033[32m' command_exists() { - ## Export flatpak binary paths. Should not be exported to PATH https://github.com/flatpak/flatpak/issues/3573#issuecomment-1330754720 - export XDG_DATA_DIRS=/home/jeeva/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:$XDG_DATA_DIRS + export PATH=/home/jeeva/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH command -v "$1" >/dev/null 2>&1 } @@ -25,8 +24,9 @@ checkFlatpak() { "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak ;; esac - printf "%b\n" "Adding Flathub remote..." + printf "%b\n" "${YELLOW}Adding Flathub remote...${RC}" "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + printf "%b\n" "${YELLOW}Applications installed by Flatpak may not appear on your desktop until the user session is restarted...${RC}" else if ! flatpak remotes | grep -q "flathub"; then printf "%b\n" "${YELLOW}Adding Flathub remote...${RC}" From fb7f0259c2b24ca775ccfa1589311ab99e5a5771 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Mon, 14 Oct 2024 09:58:34 +0530 Subject: [PATCH 5/5] Add apk pgm --- Cargo.lock | 4 ++-- core/tabs/common-script.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1ff46393..c33834f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -491,7 +491,7 @@ checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "linutil_core" -version = "24.9.23" +version = "24.9.28" dependencies = [ "ego-tree", "include_dir", @@ -503,7 +503,7 @@ dependencies = [ [[package]] name = "linutil_tui" -version = "24.9.23" +version = "24.9.28" dependencies = [ "ansi-to-tui", "anstyle", diff --git a/core/tabs/common-script.sh b/core/tabs/common-script.sh index 319e83f8..907ba2ea 100644 --- a/core/tabs/common-script.sh +++ b/core/tabs/common-script.sh @@ -20,6 +20,9 @@ checkFlatpak() { pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak ;; + apk) + "$ESCALATION_TOOL" "$PACKAGER" add flatpak + ;; *) "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak ;;