add experimental support for the launchd startup

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4216 4ea69e1a-61f1-4043-bf83-b5c94c648137
pull/1/merge
samm-git 7 years ago
parent 193cfa56ea
commit 8f7333a8e9
  1. 5
      smartmontools/ChangeLog
  2. 26
      smartmontools/Makefile.am
  3. 5
      smartmontools/configure.ac
  4. 12
      smartmontools/os_darwin/English_Localizable.strings
  5. 56
      smartmontools/os_darwin/SMART.in
  6. 5
      smartmontools/os_darwin/StartupParameters.plist
  7. 20
      smartmontools/os_darwin/com.smartmontools.smartd.plist.in

@ -1,5 +1,10 @@
$Id$
2016-01-25 Alex Samorukov <samm@os2.kiev.ua>
os_darwin: add launchctl script for the smartd and remove depricated one.
"On current systems there is only one recommend way: launchd"
2016-01-24 Alex Samorukov <samm@os2.kiev.ua>
os_freebsd.cpp: fix possible reallocf with 0 bytes arg (ticket #640)

@ -363,9 +363,7 @@ EXTRA_DIST = \
update-smart-drivedb.in \
update-smart-drivedb.8.in \
m4/pkg.m4 \
os_darwin/SMART.in \
os_darwin/StartupParameters.plist \
os_darwin/English_Localizable.strings \
os_darwin/com.smartmontools.smartd.plist.in \
os_darwin/pkg/PackageInfo.in \
os_darwin/pkg/Distribution.in \
os_darwin/pkg/installer/README.html \
@ -465,31 +463,17 @@ smartd_warning.sh: smartd_warning.sh.in config.status
if INSTALL_INITSCRIPT
if OS_DARWIN
initd_DATA = SMART \
os_darwin/StartupParameters.plist \
os_darwin/English_Localizable.strings
initd_install_name = SMART
initd_DATA = com.smartmontools.smartd.plist
initd_DATA_install = install-initdDATA-darwin
initd_DATA_uninstall = uninstall-initdDATA-darwin
SMART : os_darwin/SMART.in
com.smartmontools.smartd.plist : os_darwin/com.smartmontools.smartd.plist.in
sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
install-initdDATA-darwin: $(initd_DATA)
$(MKDIR_P) $(DESTDIR)$(initddir)
$(MKDIR_P) $(DESTDIR)$(initddir)/SMART
$(MKDIR_P) $(DESTDIR)$(initddir)/SMART/Resources
$(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
$(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
$(DESTDIR)$(initddir)/SMART/StartupParameters.plist
for i in English ; do \
RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
$(MKDIR_P) $$RDIR ;\
$(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
$$RDIR/Localizable.strings ; \
done
$(MKDIR_P) '$(DESTDIR)$(initddir)'
$(INSTALL_SCRIPT) $(top_builddir)/com.smartmontools.smartd.plist $(DESTDIR)$(initddir)/com.smartmontools.smartd.plist
uninstall-initdDATA-darwin:
rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)

@ -224,6 +224,9 @@ case "${host}" in
*-*-freebsd*)
initdfile="smartd.freebsd.initd"
;;
*-apple-darwin*)
initdfile="com.smartmontools.smartd.plist"
;;
*)
initdfile="smartd.initd"
;;
@ -638,7 +641,7 @@ case "$host_os" in
echo "smartd plugin path: [[disabled]]" >&AS_MESSAGE_FD
fi
if test -n "$initddir"; then
echo "smartd initd script: `eval eval eval echo $initddir`/smartd${smartd_suffix}" >&AS_MESSAGE_FD
echo "smartd initd script: `eval eval eval echo $initddir`/${initdfile}" >&AS_MESSAGE_FD
elif test -z "$systemdsystemunitdir"; then
echo "smartd initd script: [[disabled]]" >&AS_MESSAGE_FD
fi

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>SMART disk monitoring</key>
<string>SMART disk monitoring</string>
<key>Starting SMART disk monitoring</key>
<string>Starting SMART disk monitoring</string>
<key>Stopping SMART disk monitoring</key>
<string>Stopping SMART disk monitoring</string>
</dict>
</plist>

@ -1,56 +0,0 @@
#!/bin/sh
# Darwin init file for smartd
#
# Home page of code is: http://www.smartmontools.org
#
# Copyright (C) 2004-8 Geoffrey Keating <geoffk@geoffk.org>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
#
# You should have received a copy of the GNU General Public License (for
# example COPYING); if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# $Id$
##
# SMART monitoring
##
. /etc/rc.common
StartService ()
{
if [ "${SMARTd:=-YES-}" = "-YES-" ] &&
! GetPID smartd > /dev/null; then
ConsoleMessage "Starting SMART disk monitoring"
/usr/sbin/smartd -p /var/run/smartd.pid
fi
}
StopService ()
{
if pid=$(GetPID smartd); then
ConsoleMessage "Stopping SMART disk monitoring"
kill -TERM "${pid}"
else
echo "smartd is not running."
fi
}
RestartService ()
{
if pid=$(GetPID smartd); then
kill -HUP "${pid}"
else
StartService
fi
}
RunService "$1"

@ -1,5 +0,0 @@
{
Description = "SMART disk monitoring";
Provides = ("SMART");
Requires = ("System Log");
}

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>com.smartmontools.smartd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/smartd</string>
<string>-n</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Loading…
Cancel
Save