commit:     7c2ae667959d10a38dc717234ea1349196bb93ab
Author:     INODE64 <web <AT> inode64 <DOT> com>
AuthorDate: Tue Apr 22 13:41:20 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Apr 24 06:59:47 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c2ae667

sys-power/nut: Support for Python 13 and fix init scripts to use /run/nut

Bug: https://bugs.gentoo.org/954303
Closes: https://bugs.gentoo.org/952749
Signed-off-by: INODE64 <web <AT> inode64.com>
Part-of: https://github.com/gentoo/gentoo/pull/41698
Closes: https://github.com/gentoo/gentoo/pull/41698
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-power/nut/files/nut-2.2.2-init.d-upsdrv                | 6 +++++-
 sys-power/nut/files/nut-2.6.5-init.d-upslog                | 6 +++++-
 sys-power/nut/files/nut-2.6.5-init.d-upsmon                | 4 ++++
 sys-power/nut/files/nut-2.8.0-init.d-upsd                  | 4 ++++
 sys-power/nut/{nut-2.8.2-r1.ebuild => nut-2.8.2-r2.ebuild} | 4 ++--
 sys-power/nut/nut-9999.ebuild                              | 4 ++--
 6 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/sys-power/nut/files/nut-2.2.2-init.d-upsdrv 
b/sys-power/nut/files/nut-2.2.2-init.d-upsdrv
index 9b49ee395568..2d5f04c77994 100644
--- a/sys-power/nut/files/nut-2.2.2-init.d-upsdrv
+++ b/sys-power/nut/files/nut-2.2.2-init.d-upsdrv
@@ -21,6 +21,10 @@ stop() {
        _dostop "$UPSNAME" "$msgtext"
 }
 
+start_pre() {
+       checkpath -q -d -m 0700 -o nut:nut /run/nut
+}
+
 startall() {
        _dostart "" "$msgtext"
 }
@@ -39,5 +43,5 @@ _dostop() {
        # Not in our control at all
        ebegin "Stopping UPS $msgtext"
        /usr/sbin/upsdrvctl stop $UPSNAME
-       eend $? "Failed to stop UPS $msgtext!"
+       ewarn $? "Failed to stop UPS $msgtext!"
 }

diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upslog 
b/sys-power/nut/files/nut-2.6.5-init.d-upslog
index 01a9d47036c5..78ea7a3a5d66 100644
--- a/sys-power/nut/files/nut-2.6.5-init.d-upslog
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upslog
@@ -4,7 +4,7 @@
 
 extra_started_commands="reload"
 
-pidfile=/var/run/upslog.pid
+pidfile=/run/nut/upslog.pid
 bin=/usr/bin/upslog
 
 depend() {
@@ -12,6 +12,10 @@ depend() {
        after upsdrv
 }
 
+start_pre() {
+       checkpath -q -d -m 0700 -o nut:nut /run/nut
+}
+
 start() {
        ebegin "Starting upslog"
        start-stop-daemon --start --quiet --exec ${bin}

diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsmon 
b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
index 729df9c5460b..171f77d31a09 100644
--- a/sys-power/nut/files/nut-2.6.5-init.d-upsmon
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
@@ -11,6 +11,10 @@ depend() {
        use net
 }
 
+start_pre() {
+       checkpath -q -d -m 0700 -o nut:nut /run/nut
+}
+
 start() {
        ebegin "Starting upsmon"
        start-stop-daemon --start --quiet --exec ${bin}

diff --git a/sys-power/nut/files/nut-2.8.0-init.d-upsd 
b/sys-power/nut/files/nut-2.8.0-init.d-upsd
index ce09de52d56d..aba50b8ca156 100644
--- a/sys-power/nut/files/nut-2.8.0-init.d-upsd
+++ b/sys-power/nut/files/nut-2.8.0-init.d-upsd
@@ -13,6 +13,10 @@ depend() {
        after upsdrv
 }
 
+start_pre() {
+       checkpath -q -d -m 0700 -o nut:nut /run/nut
+}
+
 start() {
        ebegin "Starting upsd"
        # clean up first

diff --git a/sys-power/nut/nut-2.8.2-r1.ebuild 
b/sys-power/nut/nut-2.8.2-r2.ebuild
similarity index 99%
rename from sys-power/nut/nut-2.8.2-r1.ebuild
rename to sys-power/nut/nut-2.8.2-r2.ebuild
index 164c71902836..69db777874b8 100644
--- a/sys-power/nut/nut-2.8.2-r1.ebuild
+++ b/sys-power/nut/nut-2.8.2-r2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{10..12} )
+PYTHON_COMPAT=( python3_{10..13} )
 inherit bash-completion-r1 desktop linux-info optfeature
 inherit python-single-r1 systemd tmpfiles toolchain-funcs udev wrapper xdg
 
@@ -123,7 +123,7 @@ src_configure() {
                --with-group=nut
                --with-htmlpath=/usr/share/nut/html
                --with-logfacility=LOG_DAEMON
-               --with-statepath=/var/lib/nut
+               --with-statepath=/run/nut
                --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
                --with-systemdtmpfilesdir="/usr/lib/tmpfiles.d"
                --with-udev-dir="$(get_udevdir)"

diff --git a/sys-power/nut/nut-9999.ebuild b/sys-power/nut/nut-9999.ebuild
index 2b726a626e93..f3c93c05f91c 100644
--- a/sys-power/nut/nut-9999.ebuild
+++ b/sys-power/nut/nut-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{10..12} )
+PYTHON_COMPAT=( python3_{10..13} )
 inherit bash-completion-r1 desktop linux-info optfeature
 inherit python-single-r1 systemd tmpfiles toolchain-funcs udev wrapper xdg
 
@@ -123,7 +123,7 @@ src_configure() {
                --with-group=nut
                --with-htmlpath=/usr/share/nut/html
                --with-logfacility=LOG_DAEMON
-               --with-statepath=/var/lib/nut
+               --with-statepath=/run/nut
                --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
                --with-systemdtmpfilesdir="/usr/lib/tmpfiles.d"
                --with-udev-dir="$(get_udevdir)"

Reply via email to