Add smartmontools (#1066)
authorFlorian Fainelli <florian@openwrt.org>
Wed, 27 Dec 2006 19:08:15 +0000 (19:08 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Wed, 27 Dec 2006 19:08:15 +0000 (19:08 +0000)
SVN-Revision: 5907

utils/smartmontools/Makefile [new file with mode: 0644]
utils/smartmontools/files/smartd.conf [new file with mode: 0644]
utils/smartmontools/files/smartd.init [new file with mode: 0755]
utils/smartmontools/patches/01-compile-fix.patch [new file with mode: 0644]

diff --git a/utils/smartmontools/Makefile b/utils/smartmontools/Makefile
new file mode 100644 (file)
index 0000000..479cfe4
--- /dev/null
@@ -0,0 +1,60 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=smartmontools
+PKG_VERSION:=5.36
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/smartmontools
+PKG_MD5SUM:=2e424f2d35efa38a29ebca419c1dbe3c
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/smartmontools
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=S.M.A.R.T Monitoring Tool
+  DESCRIPTION:=\
+       smartmontools contains utility programs (smartctl, smartd) to \\\
+       control/monitor storage systems using the Self-Monitoring, Analysis \\\
+       and Reporting Technology System (S.M.A.R.T.) built into most modern \\\
+       ATA and SCSI disks. It is derived from smartsuite.
+  URL:=http://smartmontools.sourceforge.net/
+endef
+
+# uses GNU configure
+
+define Build/Configure 
+       (cd $(PKG_BUILD_DIR); ./autogen.sh );
+       $(call Build/Configure/Default,, \
+       ac_libc_have_working_snprintf=yes \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)"
+endef
+
+define Package/smartmontools/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/smartctl $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/smartd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/smartd.conf $(1)/etc
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DATA) ./files/smartd.init $(1)/etc/init.d/smartd
+endef
+
+$(eval $(call BuildPackage,smartmontools))
diff --git a/utils/smartmontools/files/smartd.conf b/utils/smartmontools/files/smartd.conf
new file mode 100644 (file)
index 0000000..0740fcf
--- /dev/null
@@ -0,0 +1 @@
+/dev/hdb -H
diff --git a/utils/smartmontools/files/smartd.init b/utils/smartmontools/files/smartd.init
new file mode 100755 (executable)
index 0000000..0e8d571
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=95
+start() {
+  [ -f /etc/smartd.conf ] || {
+    echo "/etc/smartd.conf does not exist !";
+    exit 0;
+  };
+  [ -d /var/run ] || mkdir -p /var/run
+  [ -x /usr/sbin/smartd ] && /usr/sbin/smartd -q never -p /var/run/smartd.pid
+}
+
+stop() {
+  killall smartd
+}
+
+restart() {
+        stop
+        sleep 1
+        start
+}
+
+reload() {
+        kill -HUP `cat /var/run/smartd.pid` &>/dev/null
+}
+
+
diff --git a/utils/smartmontools/patches/01-compile-fix.patch b/utils/smartmontools/patches/01-compile-fix.patch
new file mode 100644 (file)
index 0000000..5ea1d18
--- /dev/null
@@ -0,0 +1,29 @@
+--- smartmontools-5.36/configure.in.orig       2006-12-17 03:01:38.000000000 +0100
++++ smartmontools-5.36/configure.in    2006-12-17 03:00:35.000000000 +0100
+@@ -74,16 +74,16 @@
+ AC_CHECK_FUNCS([uname])
+ # Check whether snprintf appends null char and returns expected length on overflow
+-AH_TEMPLATE(HAVE_WORKING_SNPRINTF, [Define to 1 if the `snprintf' function is sane])
+-AC_MSG_CHECKING([for working snprintf])
+-AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ char buf[]="ABCDEFGHI";
+-               int i=snprintf(buf,8,"12345678"); return !(!buf[7] && i==8); ]])],
+-              [libc_have_working_snprintf=yes], [libc_have_working_snprintf=no])
+-AC_SUBST(libc_have_working_snprintf)
+-if test "$libc_have_working_snprintf" = "yes"; then
+-  AC_DEFINE(HAVE_WORKING_SNPRINTF)
+-fi
+-AC_MSG_RESULT([$libc_have_working_snprintf])
++#AH_TEMPLATE(HAVE_WORKING_SNPRINTF, [Define to 1 if the `snprintf' function is sane])
++#AC_MSG_CHECKING([for working snprintf])
++#AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ char buf[]="ABCDEFGHI";
++#               int i=snprintf(buf,8,"12345678"); return !(!buf[7] && i==8); ]])],
++#              [libc_have_working_snprintf=yes], [libc_have_working_snprintf=no])
++#AC_SUBST(libc_have_working_snprintf)
++#if test "$libc_have_working_snprintf" = "yes"; then
++#  AC_DEFINE(HAVE_WORKING_SNPRINTF)
++#fi
++#AC_MSG_RESULT([$libc_have_working_snprintf])
+ # check for __attribute__((packed))
+ AH_TEMPLATE(HAVE_ATTR_PACKED, [Define to 1 if C compiler supports __attribute__((packed))])