summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnAverageHuman2016-02-28 17:11:14 -0500
committerAnAverageHuman2016-02-28 17:11:14 -0500
commitdf07fe67434c07a2e7f118079afcb090b3baf9d0 (patch)
tree56017c82efffe416271931ea70b09273ac1ee121
downloadaur-df07fe67434c07a2e7f118079afcb090b3baf9d0.tar.gz
Initial commit
-rw-r--r--.SRCINFO37
-rw-r--r--PKGBUILD57
-rw-r--r--hibernate-script-2.0-arch.patch54
-rw-r--r--hibernate-script.install13
-rw-r--r--hibernate.rc81
-rw-r--r--pmutils_hook1
-rw-r--r--pmutils_module53
7 files changed, 296 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..fa300dc0aad0
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,37 @@
+# Generated by mksrcinfo v8
+# Sun Feb 28 22:01:32 UTC 2016
+pkgbase = hibernate-script
+ pkgdesc = Set of scripts for managing tux on ice, hibernation and suspend to RAM
+ pkgver = 2.0
+ pkgrel = 9
+ url = http://www.tuxonice.net
+ install = hibernate-script.install
+ arch = any
+ license = GPL
+ depends = sh
+ optdepends = pm-utils: hibernate-script sets itself as default when used with pm-utils
+ options = !strip
+ backup = etc/hibernate/hibernate.conf
+ backup = etc/hibernate/tuxonice.conf
+ backup = etc/hibernate/disk.conf
+ backup = etc/hibernate/ram.conf
+ backup = etc/hibernate/common.conf
+ backup = etc/hibernate/blacklisted-modules
+ backup = etc/hibernate/ususpend-both.conf
+ backup = etc/hibernate/sysfs-ram.conf
+ backup = etc/hibernate/ususpend-ram.conf
+ backup = etc/hibernate/sysfs-disk.conf
+ backup = etc/hibernate/ususpend-disk.conf
+ source = http://tuxonice.net/files/hibernate-script-2.0.tar.gz
+ source = hibernate-script-2.0-arch.patch
+ source = hibernate.rc
+ source = pmutils_hook
+ source = pmutils_module
+ md5sums = 5c21770afbae503450e3c4a5502bf29d
+ md5sums = 3cc1d65ba85495e8b32be1965c2ad6a9
+ md5sums = 0c033f583d4fa2e2d249b788fd92a0ce
+ md5sums = 346bb1c63d5535e0e2dd55945e11c308
+ md5sums = 6802a2ce79af5e5744b01fd0bdb781bf
+
+pkgname = hibernate-script
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..1d9694688e74
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,57 @@
+# Maintainer: Ng Oon-Ee <ngoonee.talk@gmail.com>
+# Contributor: Thomas Baechler <thomas@archlinux.org>
+# Contributor: Guillaume ALAUX <guillaume at alaux dot net>
+
+pkgname=hibernate-script
+pkgver=2.0
+pkgrel=9
+pkgdesc="Set of scripts for managing tux on ice, hibernation and suspend to RAM"
+arch=('any')
+url="http://www.tuxonice.net"
+license=('GPL')
+depends=('sh')
+optdepends=('pm-utils: hibernate-script sets itself as default when used with pm-utils')
+options=(!strip)
+install="hibernate-script.install"
+backup=('etc/hibernate/hibernate.conf' 'etc/hibernate/tuxonice.conf' \
+ 'etc/hibernate/disk.conf' 'etc/hibernate/ram.conf' \
+ 'etc/hibernate/common.conf' 'etc/hibernate/blacklisted-modules' \
+ 'etc/hibernate/ususpend-both.conf' 'etc/hibernate/sysfs-ram.conf' \
+ 'etc/hibernate/ususpend-ram.conf' 'etc/hibernate/sysfs-disk.conf' \
+ 'etc/hibernate/ususpend-disk.conf')
+source=(http://tuxonice.net/files/${pkgname}-${pkgver}.tar.gz
+ hibernate-script-${pkgver}-arch.patch
+ hibernate.rc
+ pmutils_hook
+ pmutils_module)
+md5sums=('5c21770afbae503450e3c4a5502bf29d'
+ '3cc1d65ba85495e8b32be1965c2ad6a9'
+ '0c033f583d4fa2e2d249b788fd92a0ce'
+ '346bb1c63d5535e0e2dd55945e11c308'
+ '6802a2ce79af5e5744b01fd0bdb781bf')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ # Fix scriptlets to work properly with Archlinux
+ patch -Np1 -i ${srcdir}/${pkgname}-${pkgver}-arch.patch
+ sed -i 's|#!\/bin\/sh|#!\/bin\/bash|' "${srcdir}/hibernate-script-2.0/hibernate.sh"
+}
+
+package() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+ export BASE_DIR=${pkgdir}
+ export PREFIX=/usr
+ export MAN_DIR=$BASE_DIR$PREFIX/share/man
+ export SCRIPT_DEST=$BASE_DIR$PREFIX/bin/hibernate
+ install -dm755 ${pkgdir}/etc/{rc,logrotate}.d
+ install -dm755 ${pkgdir}/etc/pm/config.d
+ install -dm755 ${pkgdir}/usr/lib/pm-utils/module.d
+ ./install.sh || return 1
+ install -m 755 ${srcdir}/hibernate.rc ${pkgdir}/etc/rc.d/hibernate-cleanup
+ install -m 755 ${srcdir}/pmutils_hook ${pkgdir}/etc/pm/config.d/use_hibernate_script
+ install -m 755 ${srcdir}/pmutils_module ${pkgdir}/usr/lib/pm-utils/module.d/hibernate
+ # Allow for behaviour as in man-page (calling by hibernate-* uses
+ # /etc/hibernate/*.conf file.
+ ln -s /usr/bin/hibernate ${pkgdir}/usr/bin/hibernate-ram
+ ln -s /usr/bin/hibernate ${pkgdir}/usr/bin/hibernate-disk
+}
diff --git a/hibernate-script-2.0-arch.patch b/hibernate-script-2.0-arch.patch
new file mode 100644
index 000000000000..f0058c1f1ee6
--- /dev/null
+++ b/hibernate-script-2.0-arch.patch
@@ -0,0 +1,54 @@
+diff -Nur hibernate-script-1.96.orig/common.conf hibernate-script-1.96/common.conf
+--- hibernate-script-1.96.orig/common.conf 2007-07-16 14:32:41.000000000 +0200
++++ hibernate-script-1.96/common.conf 2007-08-26 17:44:47.000000000 +0200
+@@ -14,7 +14,7 @@
+ # AlwaysForce yes
+ # AlwaysKill yes
+ # HibernateVT 15
+-# Distribution debian (or fedora/gentoo/mandrake/redhat/slackware/suse)
++Distribution arch
+ # XDisplay :0
+
+ ##############################################################################
+diff -Nur hibernate-script-1.96.orig/scriptlets.d/hardware_tweaks hibernate-script-1.96/scriptlets.d/hardware_tweaks
+--- hibernate-script-1.96.orig/scriptlets.d/hardware_tweaks 2007-07-16 14:33:09.000000000 +0200
++++ hibernate-script-1.96/scriptlets.d/hardware_tweaks 2007-08-26 17:44:47.000000000 +0200
+@@ -86,7 +86,7 @@
+ local action
+ action=start
+ [ "$DISTRIBUTION" = "gentoo" ] && action=restart
+- /etc/init.d/915resolution $action || return 1
++ /etc/rc.d/915resolution $action || return 1
+ return 0
+ }
+
+diff -Nur hibernate-script-1.96.orig/scriptlets.d/network hibernate-script-1.96/scriptlets.d/network
+--- hibernate-script-1.96.orig/scriptlets.d/network 2007-07-16 14:33:09.000000000 +0200
++++ hibernate-script-1.96/scriptlets.d/network 2007-08-26 17:44:47.000000000 +0200
+@@ -90,6 +90,14 @@
+ NetworkDetectDistro() {
+ # Use either a given $DISTRIBUTION or autodetect one.
+ case "$DISTRIBUTION" in
++ arch)
++ network_ifup() {
++ /etc/rc.d/network ifup $1
++ }
++ network_ifdown() {
++ /etc/rc.d/network ifdown $1
++ }
++ ;;
+ gentoo)
+ network_ifup() {
+ [ -x "/etc/init.d/net.$1" ] && /etc/init.d/net.$1 start
+diff -Nur hibernate-script-1.96.orig/scriptlets.d/services hibernate-script-1.96/scriptlets.d/services
+--- hibernate-script-1.96.orig/scriptlets.d/services 2007-07-16 14:33:09.000000000 +0200
++++ hibernate-script-1.96/scriptlets.d/services 2007-08-26 17:44:47.000000000 +0200
+@@ -75,7 +75,7 @@
+ debian|ubuntu|redhat|fedora)
+ INITDIR=/etc/init.d
+ ;;
+- slackware)
++ slackware|arch)
+ INITDIR=/etc/rc.d
+ ;;
+ *)
diff --git a/hibernate-script.install b/hibernate-script.install
new file mode 100644
index 000000000000..04c310e7fee8
--- /dev/null
+++ b/hibernate-script.install
@@ -0,0 +1,13 @@
+## arg 1: the new package version
+post_install() {
+ echo " If you use pm-utils, hibernate-script AUTOMATICALLY takes"
+ echo " over all suspend configuration. Please edit/delete the config"
+ echo " in /etc/pm/config.d/use_hibernate_script to prevent this"
+ echo " behaviour. Non pm-utils users are not affected."
+}
+
+post_upgrade() {
+ post_install
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/hibernate.rc b/hibernate.rc
new file mode 100644
index 000000000000..807eeda14b8c
--- /dev/null
+++ b/hibernate.rc
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# This script invalidates any stale swsusp and TuxOnIce images. It
+# searches all swap partitions on your machine, as well as TuxOnIce's
+# filewriter files (by way of the hibernate script telling it where to find
+# it).
+#
+# It should be called on boot, after mounting filesystems, but before enabling
+# swap or clearing out /var/run. Copy this into /etc/init.d/ (or the appropriate
+# place on your system), then add a symlink at the appropriate point on boot.
+# On a Debian system, you would do this:
+# update-rc.d hibernate-cleanup.sh start 31 S .
+#
+# On other SysV-based systems, you would do something like:
+# ln -s ../init.d/hibernate-cleanup.sh /etc/rcS.d/S31hibernate-cleanup.sh
+#
+### BEGIN INIT INFO
+# Provides: hibernate-cleanup
+# Default-Start: S
+# Default-Stop:
+# Required-Start:
+# Required-Stop:
+# Short-Description: invalidates stale swsusp and TuxOnIce image
+# Description: This script invalidates any stale swsusp and TuxOnIce images. It
+# searches all swap partitions on your machine, as well as
+# TuxOnIce's filewriter files (by way of the hibernate
+# script telling it where to find it).
+### END INIT INFO
+
+HIBERNATE_FILEWRITER_TRAIL="/var/run/suspend2_filewriter_image_exists"
+
+clear_swap() {
+ local where wason
+ where=$1
+ wason=
+ swapoff $where 2>/dev/null && wason=yes
+ mkswap $where > /dev/null || stat_append " (failed: $?)"
+ [ -n "$wason" ] && swapon $where
+}
+
+check_swap_sig() {
+ local where what type rest p c
+ while read where what type rest ; do
+ test "$type" = "swap" || continue
+ case "$(dd if=$where bs=1 count=6 skip=4086 2>/dev/null)" in
+ S1SUSP|S2SUSP|ULSUSP|pmdisk|[zZ]*)
+ stat_append "$where"
+ clear_swap $where
+ stat_append ", "
+ esac
+ done < /etc/fstab
+}
+
+check_filewriter_sig() {
+ local target
+ [ -f "$HIBERNATE_FILEWRITER_TRAIL" ] || return 0
+ read target < $HIBERNATE_FILEWRITER_TRAIL
+ [ -f "$target" ] || return
+ case "`dd \"if=$target\" bs=8 count=1 2>/dev/null`" in
+ HaveImag)
+ /bin/echo -ne "TuxOnIce\n\0\0" | dd "of=$target" bs=11 count=1 conv=notrunc 2>/dev/null
+ stat_append -n "$target, "
+ rm -f $HIBERNATE_FILEWRITER_TRAIL
+ esac
+}
+
+case "$1" in
+start)
+ stat_busy "Invalidating stale software suspend images... "
+ check_swap_sig
+ check_filewriter_sig
+ stat_done
+ ;;
+stop)
+ ;;
+*)
+ echo "Usage: $0 {start|stop}"
+esac
diff --git a/pmutils_hook b/pmutils_hook
new file mode 100644
index 000000000000..ae67ce70bb79
--- /dev/null
+++ b/pmutils_hook
@@ -0,0 +1 @@
+SLEEP_MODULE="hibernate tuxonice uswsusp kernel"
diff --git a/pmutils_module b/pmutils_module
new file mode 100644
index 000000000000..e7e7c302cbcb
--- /dev/null
+++ b/pmutils_module
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+export TUXONICE_LOC
+# TODO tuxonice supports all sorts of knobs to twiddle. Since this should be as
+# simple as possible, it does not provide a mechanism for twiddling those knobs.
+# If you need more customization than this file has, consider using a hook to
+# set the appropriate values.
+
+# more locations might be nice
+for loc in "/sys/power/tuxonice" "/sys/power/suspend2"; do
+ [ -d "${loc}" ] && { TUXONICE_LOC="${loc}"; break; }
+done
+
+if [ -n "$TUXONICE_LOC" ]; then
+ toi_maybe_chvt() {
+ local toi_ui="$(cat "$TUXONICE_LOC/user_interface/program")"
+ local toi_ui_en="$(cat "$TUXONICE_LOC/user_interface/enabled")"
+ if [ -x "$toi_ui" ] && [ "$toi_ui_en" = 1 ] && \
+ ! state_exists console; then
+ fgconsole |savestate console
+ chvt 63
+ fi
+ }
+fi
+
+if [ -z "$HIBERNATE_MODULE" -a -n "$TUXONICE_LOC" ] && \
+ [ -f "${TUXONICE_LOC}/do_hibernate" ]; then
+ HIBERNATE_MODULE="tuxonice"
+ do_hibernate()
+ {
+ toi_maybe_chvt
+ echo 5 > "${TUXONICE_LOC}/powerdown_method"
+ /usr/sbin/hibernate
+ }
+fi
+
+if [ -z "$SUSPEND_HYBRID_MODULE" -a -n "$TUXONICE_LOC" ] && \
+ grep -q mem /sys/power/state && \
+ [ -f "${TUXONICE_LOC}/do_hibernate" ]; then
+ SUSPEND_HYBRID_MODULE="tuxonice"
+ do_suspend_hybrid()
+ {
+ toi_maybe_chvt
+ r=0
+ echo 3 >"${TUXONICE_LOC}/powerdown_method"
+ /usr/sbin/hibernate
+ r=$?
+ [ -f /sys/power/tuxonice/did_suspend_to_both ] && \
+ [ "$(cat /sys/power/tuxonice/did_suspend_to_both)" != "1" ] && \
+ REVERSE="thaw"
+ return $r
+ }
+fi