Skip to content

Commit

Permalink
Allow working without xset on RHEL 10 types
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBearAK committed Dec 17, 2024
1 parent 1c79846 commit c73e737
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
29 changes: 16 additions & 13 deletions scripts/toshy-service-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,23 @@ source "$HOME/.config/toshy/.venv/bin/activate"
# Check if the desktop session is X11
if [[ "$XDG_SESSION_TYPE" == "x11" ]]; then
# Check if xset is installed
if ! command -v xset &> /dev/null; then
echo "Toshy Config Service: xset could not be found, please install it." >&2
exit 1
if command -v xset &> /dev/null; then
# Loop until the X server is ready using xset
while true; do
if xset -q &>/dev/null; then
break
else
echo "Toshy Config Service: X server not ready?" >&2
# Sleep for a short period before trying again
sleep 2
fi
done
else
DELAY="5"
echo "Toshy Config Service: xset not found, sleeping for $DELAY seconds." >&2
# Fallback to a short sleep delay
sleep $DELAY
fi
# Loop until the X server is ready
while true; do
if xset -q &>/dev/null; then
break
else
echo "Toshy Config Service: X server not ready?" >&2
# Sleep for a short period before trying again
sleep 2
fi
done
elif [[ -z "$XDG_SESSION_TYPE" ]]; then
sleep 2
echo "Toshy Config Service: XDG_SESSION_TYPE not set. Restarting service." >&2
Expand Down
8 changes: 7 additions & 1 deletion setup_toshy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,13 +1202,19 @@ def is_crb_repo_enabled():

epel_10_rpm_url = 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm'
try:
cmd_lst = ['sudo', 'dnf', 'install', epel_10_rpm_url]
cmd_lst = ['sudo', 'dnf', 'install', '-y', epel_10_rpm_url]
print("Installing EPEL 10 release package...")
subprocess.run(cmd_lst, check=True)
except subprocess.CalledProcessError as proc_err:
error(f"Problem installing the EPEL 10 release package:\n{proc_err}")
safe_shutdown(1)

# The 'xset' command does not appear to be provided by any available
# package in RHEL 10 distro types (e.g. AlmaLinux 10):
pkgs_to_remove = ["xset"]
cnfg.pkgs_for_distro = [pkg for pkg in cnfg.pkgs_for_distro if pkg not in pkgs_to_remove]



class NativePackageInstaller:
"""Object to handle tasks related to installing native packages"""
Expand Down

0 comments on commit c73e737

Please sign in to comment.