Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Systemupdate error #1426

Open
dieBakterie opened this issue May 2, 2024 · 12 comments
Open

[Enhancement]: Systemupdate error #1426

dieBakterie opened this issue May 2, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@dieBakterie
Copy link
Contributor

dieBakterie commented May 2, 2024

Enhancement

Description

systemupdate.sh doesn't work correctly when no flatpaks installed and therefore flatpak isn't enabled at all.

Steps to Reproduce

  1. Have no flatpaks installed and flatpak not activated.
  2. Use the script, Waybar module or terminal, doesn't matter.
  3. Script fails at line 5, 'cause no flatpaks are installed.

Expected Behavior

Script Updates the packages and installed them.

Actual Behavior

Script fails after Updating without installing them.

Environment

Main System, Kernel 6.8.8(zen)

Proposed Solution

Import the pkg_installed function from globalfunction.sh and import it in Line 12 and add in now Line 13 in the cmd for Updating flatpaks.

@dieBakterie dieBakterie added the bug Something isn't working label May 2, 2024
@kRHYME7
Copy link
Collaborator

kRHYME7 commented May 2, 2024

@dieBakterie change line 12.

export -f pkg_installed
fpk_exup="pkg_installed flatpak && flatpak update"

Please confirm if this works

edit : Remove the exit 1 it is for testing.

@dieBakterie
Copy link
Contributor Author

Thanks i'll try this later.

@Skerse
Copy link
Collaborator

Skerse commented May 2, 2024

I'm confused. i just installed flatpak, installed no flatpak packages, then received no error at all?

image

@dieBakterie
Copy link
Contributor Author

dieBakterie commented May 2, 2024

Yeah if you don't activate flatpak and Install no flatpaks you don't get any error. For me it says error command flatpak doesn't exist

@dieBakterie
Copy link
Contributor Author

dieBakterie commented May 2, 2024


# Check release
if [ ! -f /etc/arch-release ] ; then
    exit 0
fi

# source variables
scrDir=$(dirname "$(realpath "$0")")
source "$scrDir/globalcontrol.sh"
get_aurhlpr
export -f pkg_installed
fpk_exup="pkg_installed flatpak && flatpak update"

# Trigger upgrade
if [ "$1" == "up" ] ; then
    trap 'pkill -RTMIN+20 waybar' EXIT
    command="
    fastfetch
    $0 upgrade
    ${aurhlpr} -Syu
    $fpk_exup
    read -n 1 -p 'Press any key to continue...'
    "
    kitty --title systemupdate sh -c "${command}"
fi

# Check for AUR updates
aur=$(${aurhlpr} -Qua | wc -l)
ofc=$( (while pgrep -x checkupdates > /dev/null ; do sleep 1; done) ; checkupdates | wc -l)

# Check for flatpak updates
if pkg_installed flatpak ; then
    fpk=$(flatpak remote-ls --updates | wc -l)
    fpk_disp="\n󰏓 Flatpak $fpk"
else
    fpk=0
    fpk_disp=""
fi

# Calculate total available updates
upd=$(( ofc + aur + fpk ))

[ "${1}" == upgrade ] && printf "[Official] %-10s\n[AUR]      %-10s\n[Flatpak]  %-10s\n" "$ofc" "$aur" "$fpk" && exit

# Show tooltip
if [ $upd -eq 0 ] ; then
    upd="" #Remove Icon completely
    # upd="󰮯"   #If zero Display Icon only
    echo "{\"text\":\"$upd\", \"tooltip\":\" Packages are up to date\"}"
else
    echo "{\"text\":\"󰮯 $upd\", \"tooltip\":\"󱓽 Official $ofc\n󱓾 AUR $aur$fpk_disp\"}"
fi```

@Skerse
Copy link
Collaborator

Skerse commented May 2, 2024

Yeah if you don't activate flatpak and Install no flatpaks you don't get any error. For me it says error command flatpak doesn't exist

Sorry, I thought you meant if flatpak was installed based on your steps to reproduce:

Have no flatpaks installed and flatpak activated

I know what happens is it just says "error: flatpak not found" and then continues, but I didn't think that was much of an issue.. but I'll rework the script later to have the check working.

@kRHYME7
Copy link
Collaborator

kRHYME7 commented May 2, 2024

export -f pkg_installed
fpk_exup="pkg_installed flatpak && flatpak update"

This check on Line 12 is pretty much it ig?

@Skerse
Copy link
Collaborator

Skerse commented May 2, 2024

export -f pkg_installed
fpk_exup="pkg_installed flatpak && flatpak update"

This check on Line 12 is pretty much it ig?

Yeah, but it's not working apparently.

@dieBakterie
Copy link
Contributor Author

For me it works

@rubiin
Copy link
Contributor

rubiin commented May 8, 2024

can be closed then as it seems solved

@kRHYME7
Copy link
Collaborator

kRHYME7 commented May 8, 2024

The script is fixed now?

will try to fix it later if not yet

@dieBakterie
Copy link
Contributor Author

Yeah would be nice If you add those fixes upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants