summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO26
-rw-r--r--PKGBUILD39
-rw-r--r--freefall-openrc.install16
-rw-r--r--freefall.confd6
-rw-r--r--freefall.initd45
5 files changed, 132 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..bb060fa11b3
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,26 @@
+# Generated by mksrcinfo v8
+# Sat Apr 30 22:20:25 UTC 2016
+pkgbase = freefall-openrc
+ pkgdesc = Disk protection for HP/Dell machines.
+ pkgver = 1.0
+ pkgrel = 1
+ url = https://github.com/cromerc/freefall-openrc
+ arch = any
+ license = GPL2
+ depends = freefall
+ depends = openrc
+ provides = freefall-openrc
+ replaces = hpfall-openrc
+ backup = etc/conf.d/freefall
+ source = freefall.initd
+ source = freefall.confd
+ sha256sums = 65dced0f1f866947143b05e6c8452e415eabe6c4293b0cac6ca78c4b4ab923c5
+ sha256sums = 3ed6f497dbb8f6b8a65f369b74d04a826a1b0463b344ce5d1b2000d97f4d5471
+
+pkgname = freefall-openrc
+ pkgdesc = Disk protection for HP/Dell machines.
+ install = freefall-openrc.install
+ depends = freefall
+ depends = openrc
+ backup = etc/conf.d/freefall
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..d38e5c876d5
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,39 @@
+# Maintainer: Chris Cromer <chris@cromer.cl>
+
+pkgname=freefall-openrc
+pkgver=1.0
+pkgrel=1
+pkgdesc="Disk protection for HP/Dell machines."
+arch=('any')
+provides=('freefall-openrc')
+pkgname=('freefall-openrc')
+depends=('freefall' 'openrc')
+replaces=('hpfall-openrc')
+backup=('etc/conf.d/freefall')
+url="https://github.com/cromerc/freefall-openrc"
+license=("GPL2")
+source=("freefall.initd" "freefall.confd")
+sha256sums=('65dced0f1f866947143b05e6c8452e415eabe6c4293b0cac6ca78c4b4ab923c5'
+ '3ed6f497dbb8f6b8a65f369b74d04a826a1b0463b344ce5d1b2000d97f4d5471')
+
+_inst_initd(){
+ install -Dm755 freefall.initd ${pkgdir}/etc/init.d/freefall
+
+ sed -e 's|#!/sbin/runscript|#!/usr/bin/openrc-run|' \
+ -e 's|/var/run|/run|g' \
+ -i ${pkgdir}/etc/init.d/$1
+}
+
+_inst_confd(){
+ install -Dm755 freefall.confd ${pkgdir}/etc/conf.d/freefall
+}
+
+package_freefall-openrc() {
+ pkgdesc="Disk protection for HP/Dell machines."
+ depends=('freefall' 'openrc')
+ backup=('etc/conf.d/freefall')
+ install=freefall-openrc.install
+
+ _inst_confd 'freefall'
+ _inst_initd 'freefall'
+}
diff --git a/freefall-openrc.install b/freefall-openrc.install
new file mode 100644
index 00000000000..08b0974c12e
--- /dev/null
+++ b/freefall-openrc.install
@@ -0,0 +1,16 @@
+_svc="freefall"
+_rlvl="default"
+
+post_install() {
+ _cmd="rc-update add ${_svc} ${_rlvl}"
+ echo " ==> run '${_cmd}'"
+}
+
+post_upgrade() {
+ post_install "$1"
+}
+
+post_remove() {
+ _cmd="rc-update del ${_svc} ${_rlvl}"
+ echo " ==> run '${_cmd}'"
+}
diff --git a/freefall.confd b/freefall.confd
new file mode 100644
index 00000000000..c082615cbca
--- /dev/null
+++ b/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/freefall.initd b/freefall.initd
new file mode 100644
index 00000000000..914bbabcd8b
--- /dev/null
+++ b/freefall.initd
@@ -0,0 +1,45 @@
+#!/sbin/runscript
+# Copyright 2012-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/linux-misc-apps/files/freefall.initd,v 1.1 2014/12/29 00:12:01 robbat2 Exp $
+
+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 $?
+}