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

Consider implement the OEM Kernel alert using a separate script file #26

Open
brlin-tw opened this issue Mar 20, 2024 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@brlin-tw
Copy link

brlin-tw commented Mar 20, 2024

Currently, the OEM Kernel alert dialog is implemented directly into the one-liner command:

Which is counter-intuitive, lacks transparency, and hard to troubleshoot problems like #24.

We also need to hack through the escaping requirements introduced by The Exec key | Desktop Entry Specification which increases the difficulty in maintaining a working solution for the users.

I suggest moving the logic into a separate shell script file and instructing the user to install it to a proper location and write the autostart configuration file to execute it instead.

I've read through and made a sample script(installed in ~/.local/bin/check-oem-kernel-update) as the following:

#!/usr/bin/env bash
# Check whether an updated OEM kernel package is installed, and notify
# the user to also update the default boot entry of the GRUB bootloader

set \
    -o errexit \
    -o nounset

latest_oem_kernel=$(
    ls /boot/vmlinuz-* \
        | grep '6.5.0-10..-oem' \
        | sort -V \
        | tail -n1 \
        | awk -F'/' '{print $NF}' \
        | sed 's/vmlinuz-//'
)

current_grub_kernel=$(
    grep '^GRUB_DEFAULT=' /etc/default/grub \
        | sed \
            -e 's/GRUB_DEFAULT=\"Advanced options for Ubuntu>Ubuntu, with Linux //g' \
            -e 's/\"//g'
)

if test "${latest_oem_kernel}" != "${current_grub_kernel}"; then
    zenity_opts=(
        --text-info
        
        # No longer works on Ubuntu >=23.10, see #25.
        #--html
        
        --width=300
        --height=200
        --title="Kernel Update Notification"
    )
    zenity "${zenity_opts[@]}" \
        --filename=<(
            echo -e \
                "A newer OEM D kernel is available than what is set in GRUB.  Open the following URL in the web browser to learn more:"
            echo
            echo "    https://github.com/FrameworkComputer/linux-docs/blob/main/22.04-OEM-D.md"
        )
fi

I've modified the autostart script as the following and can verify the alert dialog is properly triggered after login:

[Desktop Entry]
Type=Application
Exec=check-oem-kernel-update
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=Kernel check
Name=Kernel check
Comment[en_US]=
Comment=
@brlin-tw brlin-tw changed the title Consider implement the OEM Kernel alert using separate script file Consider implement the OEM Kernel alert using a separate script file Mar 20, 2024
@ctsdownloads ctsdownloads self-assigned this Mar 27, 2024
@ctsdownloads ctsdownloads added the enhancement New feature or request label Mar 27, 2024
@ctsdownloads
Copy link
Collaborator

Going to dive deeper into this once we circle back into 24.04. Good suggestion, added to wishlist as a great idea. Thanks for the feedback.

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

No branches or pull requests

2 participants