* bug#75550: smartd fails to send an email
@ 2025-01-14 1:36 Tomas Volf
2025-01-14 5:30 ` 45mg
2025-01-14 23:40 ` bug#75550: [PATCH] gnu: smartmontools: Fix PATH in smartd_warning.sh Tomas Volf
0 siblings, 2 replies; 3+ messages in thread
From: Tomas Volf @ 2025-01-14 1:36 UTC (permalink / raw)
To: 75550
Hi,
I have tried to write a service type for smartd from smartmontools,
however the bundled script fails.
When the test (-m root -M test) is executed, some programs seem to be
missing in the $PATH:
--8<---------------cut here---------------start------------->8---
Jan 14 01:34:19 localhost smartd[3138]: Executing test of <mail> to root ...
Jan 14 01:34:19 localhost smartd[3138]: Test of <mail> to root produced unexpected output (118 bytes) to STDOUT/STDERR:
Jan 14 01:34:19 localhost smartd[3138]: /gnu/store/ks6lnp8hssm9zkka47ysa4qp9xd9f8bv-smartmontools-7.4/etc/smartd_warning.sh: line 132: sed: command not found
Jan 14 01:34:19 localhost smartd[3138]: Test of <mail> to root: failed (32-bit/8-bit exit status: 32512/127)
--8<---------------cut here---------------end--------------->8---
At the start of the script I see:
--8<---------------cut here---------------start------------->8---
export PATH="/usr/local/bin:/usr/bin:/bin"
--8<---------------cut here---------------end--------------->8---
That does not look correct. I am not sure if any wrapping is necessary.
Have a nice day,
Tomas
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#75550: smartd fails to send an email
2025-01-14 1:36 bug#75550: smartd fails to send an email Tomas Volf
@ 2025-01-14 5:30 ` 45mg
2025-01-14 23:40 ` bug#75550: [PATCH] gnu: smartmontools: Fix PATH in smartd_warning.sh Tomas Volf
1 sibling, 0 replies; 3+ messages in thread
From: 45mg @ 2025-01-14 5:30 UTC (permalink / raw)
To: Tomas Volf, 75550
Hi Tomas,
Tomas Volf <~@wolfsden.cz> writes:
> Hi,
>
> I have tried to write a service type for smartd from smartmontools,
> however the bundled script fails.
>
> When the test (-m root -M test) is executed, some programs seem to be
> missing in the $PATH:
>
> --8<---------------cut here---------------start------------->8---
> Jan 14 01:34:19 localhost smartd[3138]: Executing test of <mail> to root ...
> Jan 14 01:34:19 localhost smartd[3138]: Test of <mail> to root produced unexpected output (118 bytes) to STDOUT/STDERR:
> Jan 14 01:34:19 localhost smartd[3138]: /gnu/store/ks6lnp8hssm9zkka47ysa4qp9xd9f8bv-smartmontools-7.4/etc/smartd_warning.sh: line 132: sed: command not found
> Jan 14 01:34:19 localhost smartd[3138]: Test of <mail> to root: failed (32-bit/8-bit exit status: 32512/127)
> --8<---------------cut here---------------end--------------->8---
I've seen other package definitions deal with this problem by using
`substitute*` to replace executables specified in scripts, etc. (like
sed here) with the corresponding store paths. See 'light' in (gnu
packages linux) for an example.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#75550: [PATCH] gnu: smartmontools: Fix PATH in smartd_warning.sh.
2025-01-14 1:36 bug#75550: smartd fails to send an email Tomas Volf
2025-01-14 5:30 ` 45mg
@ 2025-01-14 23:40 ` Tomas Volf
1 sibling, 0 replies; 3+ messages in thread
From: Tomas Volf @ 2025-01-14 23:40 UTC (permalink / raw)
To: 75550, guix-patches; +Cc: Tomas Volf, Sharlatan Hellseher
The script started with reset of the $PATH to a value not suitable to Guix.
In addition, the script requires coreutils and sed, so add those into the
$PATH.
* gnu/packages/admin.scm (smartmontools)[arguments]<#:phases>: Add 'fix-path.
Change-Id: Ide97f572e6f369fe24337f945474dc7a65584eda
---
gnu/packages/admin.scm | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 7f50d5f4e9..098e21ff8a 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -2921,8 +2921,19 @@ (define-public smartmontools
"0gcrzcb4g7f994n6nws26g6x15yjija1gyzd359sjv7r3xj1z9p9"))))
(build-system gnu-build-system)
(arguments
- (list #:make-flags
- #~(list "BUILD_INFO=\"(Guix)\"")))
+ (list
+ #:make-flags
+ #~(list "BUILD_INFO=\"(Guix)\"")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'install 'fix-path
+ (lambda _
+ (substitute* (string-append #$output "/etc/smartd_warning.sh")
+ (("export PATH=.*$" all)
+ (string-append "PATH="
+ #$(file-append sed "/bin") ":"
+ #$(file-append coreutils "/bin") ":"
+ "$PATH\n"))))))))
(inputs (list libcap-ng))
(home-page "https://www.smartmontools.org/")
(synopsis "S.M.A.R.T. harddisk control and monitoring tools")
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-14 23:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14 1:36 bug#75550: smartd fails to send an email Tomas Volf
2025-01-14 5:30 ` 45mg
2025-01-14 23:40 ` bug#75550: [PATCH] gnu: smartmontools: Fix PATH in smartd_warning.sh Tomas Volf
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).