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

[Feature Request] Alert if action is needed after update (e.g. reboot) #190

Open
RudahXimenes opened this issue Jul 17, 2022 · 1 comment

Comments

@RudahXimenes
Copy link

Description

Sometimes when updating, we may need to reboot the system to apply the changes, for example when updating a kernel. So I thought about create a script to check if there is any crucial update that needs to reboot and then show in tray. Then I asked myself: why not suggest to the Arch Linux Update Indicator to include it, as long as I don't know how to deal with extensions and stuff? So here I am.

Script

I found a script in internet to check kernel and libs, then I adapted to crucial updates (kernal, systemd, glibc and xorg). It depends on lsof, so it's a requirement

Here is the script

#!/bin/bash

get_boot_kernel() {
    local get_version=0
    for field in $(file /boot/vmlinuz*); do
        if [[ $get_version -eq 1 ]]; then
            echo $field
            return
        elif [[ $field == version ]]; then
            # the next field contains the version
            get_version=1
        fi
    done
}

rc=1

libs=$(lsof -n +c 0 | grep 'xorg\|libc\|systemd' | grep 'DEL.*lib' | awk '1 { print $1 ": " $NF }' | sort -u)
if [[ -n $libs ]]; then
    cat <<< $libs
    echo "# LIBS: reboot required"
    rc=0
else
    echo "# LIBS: No action needed"
fi

active_kernel=$(uname -r)
current_kernel=$(get_boot_kernel)
if [[ $active_kernel != $current_kernel ]]; then
    echo "$active_kernel < $current_kernel"
    echo "# KERNEL: reboot required"
    rc=0
else
    echo "# KERNEL: No action needed"
fi
exit $rc

Conclusion

Is it possible to add this feature to the extension?
It would be great!

Thank you!

@RaphaelRochet
Copy link
Owner

I kinda like the idea, but I must find another way to do it. I don't want to add a dependency, and I cannot ship a shell script with the extension.
It must be done in javascript. I will try to see if what your script does can be achieved in JS. Hope so ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants