Refact office suites flatpak

This commit is contained in:
JEEVITHA KANNAN K S 2024-10-01 11:43:28 +05:30
parent 6e7fe51f91
commit 637fdc54d3
No known key found for this signature in database
GPG Key ID: 5904C34A2F7CE333
6 changed files with 54 additions and 213 deletions

4
Cargo.lock generated
View File

@ -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",

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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