Merge remote-tracking branch 'upstream/main' into root

This commit is contained in:
JEEVITHA KANNAN K S 2024-11-01 23:04:15 +05:30
commit 2c559686f5
No known key found for this signature in database
GPG Key ID: 5904C34A2F7CE333
10 changed files with 75 additions and 64 deletions

23
Cargo.lock generated
View File

@ -157,6 +157,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.20" version = "4.5.20"
@ -438,6 +444,7 @@ dependencies = [
"crossterm", "crossterm",
"ego-tree", "ego-tree",
"linutil_core", "linutil_core",
"nix 0.29.0",
"oneshot", "oneshot",
"portable-pty", "portable-pty",
"rand", "rand",
@ -529,6 +536,18 @@ dependencies = [
"pin-utils", "pin-utils",
] ]
[[package]]
name = "nix"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
"bitflags 2.6.0",
"cfg-if",
"cfg_aliases",
"libc",
]
[[package]] [[package]]
name = "nom" name = "nom"
version = "7.1.3" version = "7.1.3"
@ -599,7 +618,7 @@ dependencies = [
"lazy_static", "lazy_static",
"libc", "libc",
"log", "log",
"nix", "nix 0.25.1",
"serial", "serial",
"shared_library", "shared_library",
"shell-words", "shell-words",
@ -1314,4 +1333,4 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
] ]

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installMeld() { installMeld() {
if ! command_exists meld; then if ! command_exists org.gnome.meld && ! command_exists meld; then
printf "%b\n" "${YELLOW}Installing Meld...${RC}" printf "%b\n" "${YELLOW}Installing Meld...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
@ -13,7 +13,7 @@ installMeld() {
elevated_execution "$PACKAGER" -y install meld elevated_execution "$PACKAGER" -y install meld
;; ;;
*) *)
. ../setup-flatpak.sh checkFlatpak
flatpak install -y flathub org.gnome.meld flatpak install -y flathub org.gnome.meld
;; ;;
esac esac

View File

@ -3,14 +3,9 @@
. ../common-script.sh . ../common-script.sh
installBottles() { installBottles() {
if ! command_exists flatpak; then if ! command_exists com.usebottles.bottles; then
printf "%b\n" "${YELLOW}Installing Bottles...${RC}" printf "%b\n" "${YELLOW}Installing Bottles...${RC}"
case "$PACKAGER" in flatpak install -y flathub com.usebottles.bottles
*)
. ./setup-flatpak.sh
flatpak install -y flathub com.usebottles.bottles
;;
esac
else else
printf "%b\n" "${GREEN}Bottles is already installed.${RC}" printf "%b\n" "${GREEN}Bottles is already installed.${RC}"
fi fi
@ -18,4 +13,5 @@ installBottles() {
checkEnv checkEnv
checkEscalationTool checkEscalationTool
checkFlatpak
installBottles installBottles

View File

@ -3,14 +3,14 @@
. ../../common-script.sh . ../../common-script.sh
installSlack() { installSlack() {
if ! command_exists slack; then if ! command_exists com.slack.Slack && ! command_exists slack; then
printf "%b\n" "${YELLOW}Installing Slack...${RC}" printf "%b\n" "${YELLOW}Installing Slack...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$AUR_HELPER" -S --needed --noconfirm slack-desktop "$AUR_HELPER" -S --needed --noconfirm slack-desktop
;; ;;
*) *)
. ../setup-flatpak.sh checkFlatpak
flatpak install -y flathub com.slack.Slack flatpak install -y flathub com.slack.Slack
;; ;;
esac esac

View File

@ -3,14 +3,14 @@
. ../../common-script.sh . ../../common-script.sh
installZoom() { installZoom() {
if ! command_exists zoom; then if ! command_exists us.zoom.Zoom && ! command_exists zoom; then
printf "%b\n" "${YELLOW}Installing Zoom...${RC}" printf "%b\n" "${YELLOW}Installing Zoom...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$AUR_HELPER" -S --needed --noconfirm zoom "$AUR_HELPER" -S --needed --noconfirm zoom
;; ;;
*) *)
. ../setup-flatpak.sh checkFlatpak
flatpak install -y flathub us.zoom.Zoom flatpak install -y flathub us.zoom.Zoom
;; ;;
esac esac

View File

@ -3,14 +3,14 @@
. ../../common-script.sh . ../../common-script.sh
installLibreOffice() { installLibreOffice() {
if ! command_exists libreoffice; then if ! command_exists org.libreoffice.LibreOffice && ! command_exists libreoffice; then
printf "%b\n" "${YELLOW}Installing Libre Office...${RC}" printf "%b\n" "${YELLOW}Installing Libre Office...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
elevated_execution "$PACKAGER" install -y libreoffice-core elevated_execution "$PACKAGER" install -y libreoffice-core
;; ;;
zypper|dnf) zypper|dnf)
. ./setup-flatpak.sh checkFlatpak
flatpak install -y flathub org.libreoffice.LibreOffice flatpak install -y flathub org.libreoffice.LibreOffice
;; ;;
pacman) pacman)

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installOnlyOffice() { installOnlyOffice() {
if ! command_exists onlyoffice-desktopeditors; then if ! command_exists org.onlyoffice.desktopeditors && ! command_exists onlyoffice-desktopeditors; then
printf "%b\n" "${YELLOW}Installing Only Office..${RC}." printf "%b\n" "${YELLOW}Installing Only Office..${RC}."
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
@ -11,7 +11,7 @@ installOnlyOffice() {
elevated_execution "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb elevated_execution "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb
;; ;;
zypper|dnf) zypper|dnf)
. ./setup-flatpak.sh checkFlatpak
flatpak install -y flathub org.onlyoffice.desktopeditors flatpak install -y flathub org.onlyoffice.desktopeditors
;; ;;
pacman) pacman)

View File

@ -3,14 +3,14 @@
. ../../common-script.sh . ../../common-script.sh
installWpsOffice() { installWpsOffice() {
if ! command_exists com.wps.Office; then if ! command_exists com.wps.Office && ! command_exists wps; then
printf "%b\n" "${YELLOW}Installing WPS Office...${RC}" printf "%b\n" "${YELLOW}Installing WPS Office...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$AUR_HELPER" -S --needed --noconfirm wps-office "$AUR_HELPER" -S --needed --noconfirm wps-office
;; ;;
*) *)
. ./setup-flatpak.sh checkFlatpak
flatpak install flathub com.wps.Office flatpak install flathub com.wps.Office
;; ;;
esac esac

View File

@ -2,9 +2,7 @@
. ../common-script.sh . ../common-script.sh
# Used to detect the desktop environment, Only used for the If statement in the setup_flatpak function. checkDE() {
# Perhaps this should be moved to common-script.sh later on?
detect_de() {
if [ -n "$XDG_CURRENT_DESKTOP" ]; then if [ -n "$XDG_CURRENT_DESKTOP" ]; then
case "$XDG_CURRENT_DESKTOP" in case "$XDG_CURRENT_DESKTOP" in
*GNOME*) *GNOME*)
@ -17,42 +15,11 @@ detect_de() {
fi fi
} }
# Install Flatpak if not already installed. installExtra() {
setup_flatpak() {
if ! command_exists flatpak; then
printf "%b\n" "${YELLOW}Installing Flatpak...${RC}"
case "$PACKAGER" in
pacman)
elevated_execution "$PACKAGER" -S --needed --noconfirm flatpak
;;
*)
elevated_execution "$PACKAGER" install -y flatpak
;;
esac
printf "%b\n" "Adding Flathub remote..."
elevated_execution 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..."
elevated_execution 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
if [ "$PACKAGER" = "apt-get" ] || [ "$PACKAGER" = "nala" ]; then 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. # 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 if [ "$DE" = "GNOME" ]; then
printf "%b" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/N): ${RC}" printf "%b" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/N): ${RC}"
read -r install_gnome read -r install_gnome
@ -72,4 +39,5 @@ setup_flatpak() {
checkEnv checkEnv
checkEscalationTool checkEscalationTool
setup_flatpak checkFlatpak
installExtra

View File

@ -9,10 +9,38 @@ CYAN='\033[36m'
GREEN='\033[32m' GREEN='\033[32m'
command_exists() { command_exists() {
for cmd in "$@"; do for cmd in "$@"; do
command -v "$cmd" >/dev/null 2>&1 || return 1 export PATH=/home/jeeva/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH
done command -v "$cmd" >/dev/null 2>&1 || return 1
return 0 done
return 0
}
checkFlatpak() {
if ! command_exists flatpak; then
printf "%b\n" "${YELLOW}Installing Flatpak...${RC}"
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak
;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add flatpak
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
;;
esac
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}"
"$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
} }
elevated_execution() { elevated_execution() {