summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorDan Theisen <djt@hxx.in>2018-07-06 02:10:32 -0700
committerDan Theisen <djt@hxx.in>2018-07-06 02:34:42 -0700
commit18ab65d12e1f62baae5e5e44da269d87f1022356 (patch)
tree95799fe9c2d59217c7d46f45c8c98bde0349e889 /user
parent8d2f786addf7f1a31f61eae5b8d4b89ff5d27330 (diff)
downloadpackages-18ab65d12e1f62baae5e5e44da269d87f1022356.tar.gz
packages-18ab65d12e1f62baae5e5e44da269d87f1022356.tar.bz2
packages-18ab65d12e1f62baae5e5e44da269d87f1022356.tar.xz
packages-18ab65d12e1f62baae5e5e44da269d87f1022356.zip
user/smartmontools: import, take, minor fix ups
Diffstat (limited to 'user')
-rw-r--r--user/smartmontools/APKBUILD47
-rw-r--r--user/smartmontools/musl-canonicalize_file_name.patch12
-rw-r--r--user/smartmontools/smartd.confd4
-rw-r--r--user/smartmontools/smartd.initd43
4 files changed, 106 insertions, 0 deletions
diff --git a/user/smartmontools/APKBUILD b/user/smartmontools/APKBUILD
new file mode 100644
index 000000000..25b6de93e
--- /dev/null
+++ b/user/smartmontools/APKBUILD
@@ -0,0 +1,47 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Dan Theisen <djt@hxx.in>
+pkgname=smartmontools
+pkgver=6.6
+pkgrel=1
+pkgdesc="Control and monitor S.M.A.R.T. enabled hard drives"
+url="https://www.smartmontools.org/"
+arch="all"
+license="GPL-2.0+"
+makedepends="linux-headers"
+subpackages="$pkgname-doc $pkgname-openrc"
+source="http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz
+ smartd.initd
+ smartd.confd
+ musl-canonicalize_file_name.patch
+ "
+
+build() {
+ cd "$builddir"
+
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc
+ make
+}
+
+check() {
+ cd "$builddir"
+
+ make check
+}
+
+package() {
+ cd "$builddir"
+
+ make DESTDIR="$pkgdir"/ install
+
+ install -Dm755 "$srcdir"/smartd.initd "$pkgdir"/etc/init.d/smartd
+ install -Dm644 "$srcdir"/smartd.confd "$pkgdir"/etc/conf.d/smartd
+}
+
+sha512sums="64bb533dac29f62ddd662a16a12c97df1af9cbac9ac526ce7af0b3bff9da49cf265a2030d91a7160452b56a67e80d7f34c9b4e45bbb320114f55695e2cb5cfaf smartmontools-6.6.tar.gz
+61cae548fc9f3a9fbea20d684502d3816e7b0b60fcf533ae4e1ab850725c208eb6ba5012ae154a46f0b7bb7285a9e63cbdecafed8db7fd63fda0ba59081260cc smartd.initd
+ff45462944f01c0e7cac99443078b253dcbaed4f99ffab85052b12361d9eec4beec81cab334fbede9148b3dd503d5205add32ef4327a788f02a8b1e37f460437 smartd.confd
+eff9a1ca8e10be5b05a4be609973065d6f02f12c9d511d3a7c87fa172934d3739594f00e5a61ed2d6dc65de5fd1ff23ec049b21078d5b1620c5dbafa56d78bbe musl-canonicalize_file_name.patch"
diff --git a/user/smartmontools/musl-canonicalize_file_name.patch b/user/smartmontools/musl-canonicalize_file_name.patch
new file mode 100644
index 000000000..bdc7cc6f1
--- /dev/null
+++ b/user/smartmontools/musl-canonicalize_file_name.patch
@@ -0,0 +1,12 @@
+# Ticket: https://smartmontools.org/ticket/921#ticket
+--- a/os_linux.cpp
++++ b/os_linux.cpp
+@@ -3176,7 +3176,7 @@
+ {
+ char path[128];
+ snprintf(path, sizeof(path), "/sys/block/%s/device", name);
+- char * syshostpath = canonicalize_file_name(path);
++ char * syshostpath = realpath(path, NULL);
+ if (!syshostpath)
+ return false;
+
diff --git a/user/smartmontools/smartd.confd b/user/smartmontools/smartd.confd
new file mode 100644
index 000000000..4b7db4dfd
--- /dev/null
+++ b/user/smartmontools/smartd.confd
@@ -0,0 +1,4 @@
+# /etc/conf.d/smartd: config file for /etc/init.d/smartd
+
+# Insert any other options needed
+SMARTD_OPTS=""
diff --git a/user/smartmontools/smartd.initd b/user/smartmontools/smartd.initd
new file mode 100644
index 000000000..f37284320
--- /dev/null
+++ b/user/smartmontools/smartd.initd
@@ -0,0 +1,43 @@
+#!/sbin/openrc-run
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/smartmontools/files/smartd.rc,v 1.9 2011/09/15 07:58:50 polynomial-c Exp $
+
+depend() {
+ need localmount
+ after bootmisc
+}
+
+extra_started_commands="reload"
+
+checkconfig() {
+ if [ ! -f "/etc/smartd.conf" ] ; then
+ eerror "You should setup your /etc/smartd.conf file!"
+ eerror "See the smartd.conf(5) manpage."
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting S.M.A.R.T. monitoring daemon"
+ start-stop-daemon --start --exec /usr/sbin/smartd \
+ --pidfile /var/run/smartd.pid \
+ -- -p /var/run/smartd.pid ${SMARTD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping S.M.A.R.T. monitoring daemon"
+ start-stop-daemon --stop --exec /usr/sbin/smartd \
+ --pidfile /var/run/smartd.pid
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading configuration"
+ start-stop-daemon --signal HUP --pidfile /var/run/smartd.pid smartd
+ eend $?
+}