GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.25k stars 813 forks source link

[Bug]: Red Hat 9 dependency check - mailx #4570

Open danatinflux opened 4 months ago

danatinflux commented 4 months ago

User story

Red Hat 9 no longer installs mailx. However, whenever I start Rust, it checks for it and tries to install it. This is making it more difficult to run commands in crontab, as it always asks for the sudo password when restarting or checking for updates.

Game

Rust

Linux distro

RedHat 9

Command

command: backup

Further information

When using the 'rustserver' command, it always checks for the mailx package, which is no longer installed on RH9.

 [rustserver@REDACT~]$ /home/rustserver/rustserver backup
[ WARN ] Backing up rustserver: Missing dependencies: mailx[sudo] password for rustserver:
Information! Automatically installing missing dependencies.
Updating Subscription Management repositories.
Last metadata expiration check: 0:46:28 ago on Sun 05 May 2024 08:14:36 AM PDT.
No match for argument: mailx
Error: Unable to find a match: mailx 

This makes it a challenge to use the 'rustserver' command for crontab commands like backup, update, et. al.

Relevant log output

No response

Steps to reproduce

1) Use the 'rustserver' command to attempt a backup. 2) The dependency will fail and the user will be asked for the sudo password to install the dependency (which it cannot).

dgibbs64 commented 4 months ago

Probably this line causing the issue https://github.com/MicLieg/LinuxGSM/blob/b3e40a59e994df6ea42d781a938522affc785b75/lgsm/modules/check_deps.sh#L116-L117

This will need to be updated to reflect changes in dependency names. I belive the replacement is s-nail

danatinflux commented 4 months ago

Fantastic! Thanks so much----I hadn't thought of grepping the 'modules' dir.

Changes made:

fn_deps_email() {
        # Adds postfix to required dependencies if email alert is enabled.
        if [ "${emailalert}" == "on" ]; then
                if [ -f /usr/bin/mailx ]; then
                        if [ -d /etc/exim4 ]; then
                                array_deps_required+=(exim4)
                        elif [ -d /etc/sendmail ]; then
                                array_deps_required+=(sendmail)
                        elif [ "$(command -v yum 2> /dev/null)" ] || [ "$(command -v dnf 2> /dev/null)" ]; then
                                array_deps_required+=(s-nail postfix)
                        elif [ "$(command -v apt 2> /dev/null)" ]; then
                                array_deps_required+=(mailutils postfix)
                        fi
                else
                        if [ "$(command -v yum 2> /dev/null)" ] || [ "$(command -v dnf 2> /dev/null)" ]; then
                                array_deps_required+=(s-nail postfix)
                        elif [ "$(command -v apt 2> /dev/null)" ]; then
                                array_deps_required+=(mailutils postfix)
                        fi
                fi
        fi
}

Seems to be working perfectly, thanks!