summaryrefslogtreecommitdiff
path: root/sys-apps/hdparm/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-apps/hdparm/files
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-apps/hdparm/files')
-rw-r--r--sys-apps/hdparm/files/hdparm-9.48-sysmacros.patch23
-rw-r--r--sys-apps/hdparm/files/hdparm-9.50-build.patch32
-rw-r--r--sys-apps/hdparm/files/hdparm-9.51-build.patch32
-rw-r--r--sys-apps/hdparm/files/hdparm-conf.d.326
-rw-r--r--sys-apps/hdparm/files/hdparm-init-860
5 files changed, 173 insertions, 0 deletions
diff --git a/sys-apps/hdparm/files/hdparm-9.48-sysmacros.patch b/sys-apps/hdparm/files/hdparm-9.48-sysmacros.patch
new file mode 100644
index 000000000000..98a08c7d36d0
--- /dev/null
+++ b/sys-apps/hdparm/files/hdparm-9.48-sysmacros.patch
@@ -0,0 +1,23 @@
+https://bugs.gentoo.org/580052
+https://sourceforge.net/p/hdparm/patches/44/
+
+--- a/geom.c
++++ b/geom.c
+@@ -15,6 +15,7 @@
+ #include <errno.h>
+ #include <dirent.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <sys/ioctl.h>
+ #include <linux/types.h>
+ #include <linux/fs.h>
+--- a/sysfs.c
++++ b/sysfs.c
+@@ -15,6 +15,7 @@
+ #include <dirent.h>
+ #include <limits.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <linux/types.h>
+
+ #include "hdparm.h"
diff --git a/sys-apps/hdparm/files/hdparm-9.50-build.patch b/sys-apps/hdparm/files/hdparm-9.50-build.patch
new file mode 100644
index 000000000000..ff1948acb01e
--- /dev/null
+++ b/sys-apps/hdparm/files/hdparm-9.50-build.patch
@@ -0,0 +1,32 @@
+* drop hardcoded -O2 flag from CFLAGS
+* drop hardcoded -s (strip) flag from LDFLAGS, and respect user LDFLAGS
+* fix hardcoded `make` and hardcoded -j2 flags
+* respect CFLAGS when linking
+
+--- a/Makefile
++++ b/Makefile
+@@ -13,9 +13,8 @@
+ CC ?= gcc
+ STRIP ?= strip
+
+-CFLAGS := -O2 -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs $(CFLAGS)
++CFLAGS += -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs
+
+-LDFLAGS = -s
+ #LDFLAGS = -s -static
+ INSTALL = install
+ INSTALL_DATA = $(INSTALL) -m 644
+@@ -24,11 +23,10 @@ INSTALL_PROGRAM = $(INSTALL)
+
+ OBJS = hdparm.o identify.o sgio.o sysfs.o geom.o fallocate.o fibmap.o fwdownload.o dvdspeed.o wdidle3.o
+
+-all:
+- make -j2 hdparm
++all: hdparm
+
+ hdparm: hdparm.h sgio.h $(OBJS)
+- $(CC) $(LDFLAGS) -o hdparm $(OBJS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o hdparm $(OBJS)
+ $(STRIP) hdparm
+
+ hdparm.o: hdparm.h sgio.h
diff --git a/sys-apps/hdparm/files/hdparm-9.51-build.patch b/sys-apps/hdparm/files/hdparm-9.51-build.patch
new file mode 100644
index 000000000000..2c6bdba68e3f
--- /dev/null
+++ b/sys-apps/hdparm/files/hdparm-9.51-build.patch
@@ -0,0 +1,32 @@
+* drop hardcoded -O2 flag from CFLAGS
+* drop hardcoded -s (strip) flag from LDFLAGS, and respect user LDFLAGS
+* fix hardcoded `make` and hardcoded -j2 flags
+* respect CFLAGS when linking
+
+--- hdparm-9.51/Makefile
++++ hdparm-9.51/Makefile
+@@ -13,9 +13,8 @@
+ CC ?= gcc
+ STRIP ?= strip
+
+-CFLAGS := -O2 -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs $(CFLAGS)
++CFLAGS += -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs
+
+-LDFLAGS = -s
+ #LDFLAGS = -s -static
+ INSTALL = install
+ INSTALL_DATA = $(INSTALL) -m 644
+@@ -24,11 +23,10 @@
+
+ OBJS = hdparm.o identify.o sgio.o sysfs.o geom.o fallocate.o fibmap.o fwdownload.o dvdspeed.o wdidle3.o
+
+-all:
+- $(MAKE) -j4 hdparm
++all: hdparm
+
+ hdparm: hdparm.h sgio.h $(OBJS)
+- $(CC) $(LDFLAGS) -o hdparm $(OBJS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o hdparm $(OBJS)
+ $(STRIP) hdparm
+
+ hdparm.o: hdparm.h sgio.h
diff --git a/sys-apps/hdparm/files/hdparm-conf.d.3 b/sys-apps/hdparm/files/hdparm-conf.d.3
new file mode 100644
index 000000000000..a1ae626b3b05
--- /dev/null
+++ b/sys-apps/hdparm/files/hdparm-conf.d.3
@@ -0,0 +1,26 @@
+# /etc/conf.d/hdparm: config file for /etc/init.d/hdparm
+
+#
+# Note that options such as -y which force *immediate* power saving options
+# should generally not be placed here. The hdparm init.d script may run at
+# anytime with respect to other init.d scripts that do system wide drive
+# scans (like the hald script), so they will merely get spun right back up.
+# If you wish to use these options, please use the local.start init.d script
+# instead so that you're guaranteed that it will run last.
+#
+
+# You can either set hdparm arguments for each drive using hdX_args,
+# discX_args, cdromX_args and genericX_args, e.g.
+#
+# hda_args="-d1 -X66"
+# disc1_args="-d1"
+# cdrom0_args="-d1"
+
+# or you can set options for all PATA drives
+pata_all_args="-d1"
+
+# or you can set options for all SATA drives
+sata_all_args=""
+
+# or, you can set hdparm options for all drives
+all_args=""
diff --git a/sys-apps/hdparm/files/hdparm-init-8 b/sys-apps/hdparm/files/hdparm-init-8
new file mode 100644
index 000000000000..bb88d447e730
--- /dev/null
+++ b/sys-apps/hdparm/files/hdparm-init-8
@@ -0,0 +1,60 @@
+#!/sbin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before bootmisc
+}
+
+do_hdparm() {
+ local e=
+ eval e=\$${extra_args}
+ [ -z "${args}${all_args}${e}" ] && return 0
+
+ if [ -n "${args:=${all_args} ${e}}" ] ; then
+ local orgdevice=$(readlink -f "${device}")
+ if [ -b "${orgdevice}" ] ; then
+ ebegin "Running hdparm on ${device}"
+ hdparm ${args} "${device}" > /dev/null
+ eend $?
+ fi
+ fi
+}
+
+scan_nondevfs() {
+ # non-devfs compatible system
+ local device
+
+ for device in /dev/hd* /dev/sd* /dev/cdrom* ; do
+ [ -e "${device}" ] || continue
+ case "${device}" in
+ *[0-9]) continue ;;
+ /dev/hd*) extra_args="pata_all_args" ;;
+ /dev/sd*) extra_args="sata_all_args" ;;
+ *) extra_args="_no_xtra_args" ;;
+ esac
+
+ # check that the block device really exists by
+ # opening it for reading
+ local errmsg= status= nomed=1
+ errmsg=$(export LC_ALL=C ; : 2>&1 <"${device}")
+ status=$?
+ case ${errmsg} in
+ *": No medium found") nomed=0;;
+ esac
+ if [ -b "${device}" ] && [ "${status}" = "0" -o "${nomed}" = "0" ] ; then
+ local conf_var="${device##*/}_args"
+ eval args=\$${conf_var}
+ do_hdparm
+ fi
+ done
+}
+
+start() {
+ if get_bootparam "nohdparm" ; then
+ ewarn "Skipping hdparm init as requested in kernel cmdline"
+ return 0
+ fi
+
+ scan_nondevfs
+}