summaryrefslogtreecommitdiff
path: root/app-laptop/hdapsd/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-laptop/hdapsd/files
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-laptop/hdapsd/files')
-rw-r--r--app-laptop/hdapsd/files/hdapsd.conf-2014102424
-rw-r--r--app-laptop/hdapsd/files/hdapsd.init-2014102476
2 files changed, 100 insertions, 0 deletions
diff --git a/app-laptop/hdapsd/files/hdapsd.conf-20141024 b/app-laptop/hdapsd/files/hdapsd.conf-20141024
new file mode 100644
index 000000000000..a83d8bb181ac
--- /dev/null
+++ b/app-laptop/hdapsd/files/hdapsd.conf-20141024
@@ -0,0 +1,24 @@
+# Configuration for the HDAPS daemon (hdapsd). All settings here are
+# optional and will override those set in /etc/hdapsd.conf (if hdapsd
+# was built with libconfig support).
+
+# The list of the disk devices that hdapsd should monitor. Usually
+# this is "hda", "sda", or "hda sda". The hdaps daemon will attempt to
+# auto-detect your drive if this is left empty. Empty by default.
+#
+#DISKLIST="sda"
+
+# Hdapsd sensitivity. The lower the threshold, the earlier the heads
+# are parked when movement is detected. The default is determined by
+# hdapsd, and is currently 15.
+#
+#THRESHOLD="10"
+
+# Log to syslog? Disabled by default.
+#
+#SYSLOG="true"
+
+# Set any extra options here, like -a for "adaptive mode". Empty by
+# default.
+#
+#OPTIONS="-a"
diff --git a/app-laptop/hdapsd/files/hdapsd.init-20141024 b/app-laptop/hdapsd/files/hdapsd.init-20141024
new file mode 100644
index 000000000000..6113b60b7d7c
--- /dev/null
+++ b/app-laptop/hdapsd/files/hdapsd.init-20141024
@@ -0,0 +1,76 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+
+description="Hard Drive Active Protection System daemon"
+command="/usr/sbin/hdapsd"
+pidfile="/run/hdapsd.pid"
+
+# Always daemonize when started by OpenRC, and don't make the pidfile
+# configurable. Even if the user sets something dumb for the pidfile
+# in /etc/hdapsd.conf, we want it to work! Fortunately the settings
+# passed on the command-line override the config file.
+command_args="--background --pidfile=${pidfile}"
+
+
+depend() {
+ need localmount
+}
+
+checkconfig() {
+ # An empty DISKLIST is allowed because the disk will be
+ # auto-detected.
+ for DISK in ${DISKLIST}; do
+ if [ ! -b /dev/${DISK} ]; then
+ eerror "Could not find disk /dev/${DISK}!"
+ eerror "Adjust the DISK setting in /etc/conf.d/hdapsd"
+ return 1
+ fi
+
+ if [ ! -e /sys/block/${DISK}/queue/protect ] && \
+ [ ! -e /sys/block/${DISK}/device/unload_heads ] ; then
+ eerror "No protect entry for ${DISK}!"
+ eerror "Make sure your kernel is patched with the blk_freeze patch"
+ return 1
+ fi
+ done
+
+ # Load the tp_smapi module first. This is not a requirement, but
+ # it helps hdapsd's adaptive mode.
+ if [ ! -e /sys/devices/platform/smapi ] ; then
+ modprobe tp_smapi 2>/dev/null
+ fi
+
+ if [ ! -d /sys/devices/platform/hdaps ] ; then
+ ebegin "Loading hdaps module"
+ modprobe hdaps
+ eend $? || return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+
+ for DISK in ${DISKLIST}; do
+ command_args="${command_args} -d ${DISK}"
+ done
+
+ # Since all of these settings are now optional, we append them
+ # only if we need to.
+ if [ ! -z "${THRESHOLD}" ] ; then
+ command_args="${command_args} --sensitivity ${THRESHOLD}"
+ fi
+
+ if [ ! -z "${SYSLOG}" ] ; then
+ command_args="${command_args} --syslog"
+ fi
+
+ if [ ! -z "${OPTIONS}" ] ; then
+ command_args="${command_args} ${OPTIONS}"
+ fi
+
+ ebegin "Starting the ${description}"
+ start-stop-daemon --start --exec "${command}" --pidfile "${pidfile}" \
+ -- ${command_args}
+ eend $?
+}