hddtemp.paketlendi

This commit is contained in:
milisman 2016-12-04 17:39:51 +02:00
parent fe1850a75d
commit fab32abc16
7 changed files with 191 additions and 0 deletions

View File

@ -0,0 +1,28 @@
diff -Nuar --exclude '*~' hddtemp-0.3-beta15.orig/src/sata.c hddtemp-0.3-beta15/src/sata.c
--- hddtemp-0.3-beta15.orig/src/sata.c 2006-05-14 02:09:55.579437498 -0700
+++ hddtemp-0.3-beta15/src/sata.c 2006-05-14 02:06:08.495948437 -0700
@@ -88,7 +88,9 @@
return strdup(_("unknown"));
else
{
+ //fprintf(stderr,"sata_model1=%s\n",identify + 54);
sata_fixstring(identify + 54, 24);
+ //fprintf(stderr,"sata_model2=%s\n",identify + 54);
return strdup(identify + 54);
}
}
diff -Nuar --exclude '*~' hddtemp-0.3-beta15.orig/src/satacmds.c hddtemp-0.3-beta15/src/satacmds.c
--- hddtemp-0.3-beta15.orig/src/satacmds.c 2006-05-14 02:09:40.983470339 -0700
+++ hddtemp-0.3-beta15/src/satacmds.c 2006-05-14 02:09:02.319557333 -0700
@@ -98,7 +98,10 @@
/* convert from big-endian to host byte order */
for (p = end ; p != s;) {
unsigned short *pp = (unsigned short *) (p -= 2);
- *pp = ntohs(*pp);
+ char tmp = p[0];
+ p[0] = p[1];
+ p[1] = tmp;
+ //*pp = ntohs(*pp);
}
/* strip leading blanks */

View File

@ -0,0 +1,21 @@
--- hddtemp-0.3-beta15/configure.in~ 2005-10-17 19:14:19 +0000
+++ hddtemp-0.3-beta15/configure.in 2006-12-11 18:23:22 +0000
@@ -18,6 +18,7 @@
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(netinet/in.h)
+AC_CHECK_HEADERS(execinfo.h)
AC_CHECK_TYPE(in_addr_t, ,[AC_DEFINE_UNQUOTED([in_addr_t], [uint32_t], [Define to 'uint32_t' if <netinet/in.h> does not define.])], [#include <netinet/in.h>])
# Checks for typedefs, structures, and compiler characteristics.
--- hddtemp-0.3-beta15/src/backtrace.c-orig 2006-12-11 18:20:41 +0000
+++ hddtemp-0.3-beta15/src/backtrace.c 2006-12-11 18:23:28 +0000
@@ -18,7 +18,7 @@
#include <features.h>
-#if defined(__i386__) && defined(__GLIBC__)
+#ifdef HAS_EXECINFO_H
#include <execinfo.h>

View File

@ -0,0 +1,28 @@
--- hddtemp-0.3-beta15/src/utf8.c~ 2007-03-27 09:09:59.000000000 +0200
+++ hddtemp-0.3-beta15/src/utf8.c 2007-03-27 09:10:06.000000000 +0200
@@ -23,7 +23,9 @@
// Standard includes
#include <stdlib.h>
+#ifdef HAVE_ICONV
#include <iconv.h>
+#endif
#include <langinfo.h>
#include <locale.h>
#include <string.h>
@@ -34,6 +36,7 @@
static char *iconv_from_utf8_to_locale(const char *string, const char* fallback_string)
{
+#ifdef HAVE_ICONV
const size_t buffer_inc = 80; // Increment buffer size in 80 bytes step
const char *charset;
iconv_t cd;
@@ -93,6 +96,7 @@
if (dest_buffer != NULL)
free(dest_buffer); // free buffer
free(src_buffer); // free string
+#endif // HAVE_ICONV
return strdup(fallback_string); // and return fallback string
}

View File

@ -0,0 +1,14 @@
--- hddtemp-0.3-beta15/src/hddtemp.c~ 2006-04-19 02:37:35 +0000
+++ hddtemp-0.3-beta15/src/hddtemp.c 2007-03-26 08:14:17 +0000
@@ -275,9 +275,11 @@
backtrace_sigill();
backtrace_sigbus();
+#if ENABLE_NLS
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+#endif
show_db = debug = numeric = quiet = wakeup = af_hint = syslog_interval = 0;
unit = DEFAULT;

View File

@ -0,0 +1,26 @@
diff -Naurp hddtemp-0.3-beta15-orig/src/satacmds.c hddtemp-0.3-beta15/src/satacmds.c
--- hddtemp-0.3-beta15-orig/src/satacmds.c 2007-02-10 14:25:15.000000000 +0100
+++ hddtemp-0.3-beta15/src/satacmds.c 2007-02-10 14:26:53.000000000 +0100
@@ -54,7 +54,6 @@ int sata_pass_thru(int device, unsigned
unsigned char cdb[16];
unsigned char sense[32];
int dxfer_direction;
- int ret;
memset(cdb, 0, sizeof(cdb));
cdb[0] = ATA_16;
@@ -78,13 +77,7 @@ int sata_pass_thru(int device, unsigned
cdb[6] = cmd[1];
cdb[14] = cmd[0];
- ret = scsi_SG_IO(device, cdb, sizeof(cdb), buffer, cmd[3] * 512, sense, sizeof(sense), dxfer_direction);
-
- /* Verify SATA magics */
- if (sense[0] != 0x72 || sense[7] != 0x0e || sense[9] != 0x0e || sense[10] != 0x00)
- return 1;
- else
- return ret;
+ return scsi_SG_IO(device, cdb, sizeof(cdb), buffer, cmd[3] * 512, sense, sizeof(sense), dxfer_direction);
}
void sata_fixstring(unsigned char *s, int bytecount)

View File

@ -0,0 +1,37 @@
#!/bin/sh
#
# /etc/rc.d/hddtemp: start/stop hddtemp daemon
#
# Check for configuration files
[ -f /etc/hddtemp.db ] || exit 1
case $1 in
start)
printf "Starting hddtemp..."
/usr/sbin/hddtemp -d -l 127.0.0.1 $(ls /dev/sd[a-z] | xargs)
if [ $? = 0 ]; then
printf " done.\n"
else
printf " error.\n"
fi
;;
stop)
printf "Shutting down hddtemp..."
killall -q /usr/sbin/hddtemp
printf " done.\n"
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "usage: $0 [start|stop|restart]"
exit 1
;;
esac
exit $?
# End of file

View File

@ -0,0 +1,37 @@
# Description: Reads your hdd temperature using S.M.A.R.T values.
# URL: http://www.guzu.net/linux/hddtemp.php
# Packager: milisarge
# Depends on:
name=hddtemp
version=0.3-beta15
release=1
source=(http://nongnu.askapache.com/hddtemp/$name-$version.tar.bz2
http://nongnu.askapache.com/hddtemp/hddtemp.db
hddtemp-0.3-beta15-satacmds.patch
hddtemp-0.3-beta15-byteswap.patch
hddtemp-0.3-beta15-execinfo.patch
hddtemp-0.3-beta15-nls.patch
hddtemp-0.3-beta15-iconv.patch
hddtemp.rc)
build() {
cd $name-$version
patch -p 1 -i $SRC/hddtemp-0.3-beta15-satacmds.patch
patch -p 1 -i $SRC/hddtemp-0.3-beta15-byteswap.patch
patch -p 1 -i $SRC/hddtemp-0.3-beta15-execinfo.patch
patch -p 1 -i $SRC/hddtemp-0.3-beta15-nls.patch
patch -p 1 -i $SRC/hddtemp-0.3-beta15-iconv.patch
autoreconf
./configure \
--prefix=/usr \
--mandir=/usr/man \
--with-db-path=/etc/hddtemp.db
make
make DESTDIR=$PKG install
install -m 0644 -D $SRC/hddtemp.db $PKG/etc/hddtemp.db
install -m 0744 -D $SRC/hddtemp.rc $PKG/etc/rc.d/hddtemp
}