From 9e3ec9e01c963b5cff6c309fff5d03bb26515cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 21 Oct 2019 22:20:01 +0200 Subject: sys-apps/linux-misc-apps: try to do some fix --- sys-apps/linux-misc-apps/files/freefall.confd | 6 ++++ sys-apps/linux-misc-apps/files/freefall.initd | 44 +++++++++++++++++++++++++++ sys-apps/linux-misc-apps/files/hpfall.confd | 6 ++++ sys-apps/linux-misc-apps/files/hpfall.initd | 44 +++++++++++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 sys-apps/linux-misc-apps/files/freefall.confd create mode 100644 sys-apps/linux-misc-apps/files/freefall.initd create mode 100644 sys-apps/linux-misc-apps/files/hpfall.confd create mode 100644 sys-apps/linux-misc-apps/files/hpfall.initd (limited to 'sys-apps/linux-misc-apps/files') diff --git a/sys-apps/linux-misc-apps/files/freefall.confd b/sys-apps/linux-misc-apps/files/freefall.confd new file mode 100644 index 0000000..c082615 --- /dev/null +++ b/sys-apps/linux-misc-apps/files/freefall.confd @@ -0,0 +1,6 @@ +# /etc/conf.d/freefall + +# The name of the disk device that hpfall should protect. +# Usually this is 'sda' or 'hda' the primary master. + +DISK="sda" diff --git a/sys-apps/linux-misc-apps/files/freefall.initd b/sys-apps/linux-misc-apps/files/freefall.initd new file mode 100644 index 0000000..d0c896e --- /dev/null +++ b/sys-apps/linux-misc-apps/files/freefall.initd @@ -0,0 +1,44 @@ +#!/sbin/openrc-run +# Copyright 2012-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +checkconfig() { + if [ -z "$DISK" ] ; then + eerror "You need to setup DISK in /etc/conf.d/freefall first" + return 1 + fi + + if [ ! -b /dev/${DISK} ]; then + eerror "Could not find disk /dev/${DISK}!" + eerror "Adjust the DISK setting in /etc/conf.d/freefall" + return 1 + fi + + if [ ! -e /sys/block/${DISK}/device/unload_heads ] ; then + eerror "No protect entry for ${DISK}!" + eerror "Kernel 2.6.28 and above is required" + return 1 + fi + + if [ ! -c /dev/freefall ]; then + ebegin "Loading hp_accel module" + modprobe hp_accel + eend $? || return 1 + fi +} + +start () { + checkconfig || return 1 + + ebegin "Starting active hard-drive protection daemon" + start-stop-daemon --start --quiet \ + --exec /usr/sbin/freefall /dev/${DISK} + eend $? +} + +stop() { + ebegin "Stopping active hard-drive protection daemon" + start-stop-daemon --stop --quiet \ + --exec /usr/sbin/freefall + eend $? +} diff --git a/sys-apps/linux-misc-apps/files/hpfall.confd b/sys-apps/linux-misc-apps/files/hpfall.confd new file mode 100644 index 0000000..4f3451b --- /dev/null +++ b/sys-apps/linux-misc-apps/files/hpfall.confd @@ -0,0 +1,6 @@ +# /etc/conf.d/hpfall + +# The name of the disk device that hpfall should protect. +# Usually this is 'sda' or 'hda' the primary master. + +DISK="sda" \ No newline at end of file diff --git a/sys-apps/linux-misc-apps/files/hpfall.initd b/sys-apps/linux-misc-apps/files/hpfall.initd new file mode 100644 index 0000000..8b49306 --- /dev/null +++ b/sys-apps/linux-misc-apps/files/hpfall.initd @@ -0,0 +1,44 @@ +#!/sbin/openrc-run +# Copyright 2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +checkconfig() { + if [ -z "$DISK" ] ; then + eerror "You need to setup DISK in /etc/conf.d/hpfall first" + return 1 + fi + + if [ ! -b /dev/${DISK} ]; then + eerror "Could not find disk /dev/${DISK}!" + eerror "Adjust the DISK setting in /etc/conf.d/hpfall" + return 1 + fi + + if [ ! -e /sys/block/${DISK}/device/unload_heads ] ; then + eerror "No protect entry for ${DISK}!" + eerror "Kernel 2.6.28 and above is required" + return 1 + fi + + if [ ! -c /dev/freefall ]; then + ebegin "Loading hp_accel module" + modprobe hp_accel + eend $? || return 1 + fi +} + +start () { + checkconfig || return 1 + + ebegin "Starting active hard-drive protection daemon" + start-stop-daemon --start --quiet \ + --exec /usr/sbin/hpfall /dev/${DISK} + eend $? +} + +stop() { + ebegin "Stopping active hard-drive protection daemon" + start-stop-daemon --stop --quiet \ + --exec /usr/sbin/hpfall + eend $? +} -- cgit v1.2.3