2021-01-15 14:45:37 +00:00
|
|
|
{ lib, stdenv, fetchurl, gawk }:
|
2008-04-01 15:02:54 +01:00
|
|
|
|
2013-11-19 20:33:43 +00:00
|
|
|
let version = "2.0";
|
2008-04-01 15:02:54 +01:00
|
|
|
in
|
2019-08-13 22:52:01 +01:00
|
|
|
stdenv.mkDerivation {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "hibernate";
|
|
|
|
inherit version;
|
2008-04-01 15:02:54 +01:00
|
|
|
src = fetchurl {
|
2013-11-19 20:33:43 +00:00
|
|
|
url = "http://tuxonice.nigelcunningham.com.au/files/hibernate-script-${version}.tar.gz";
|
|
|
|
sha256 = "0ib5bac3spbcwmhf8f9apjbll8x7fgqj4k1s5q3srijh793rfifh";
|
2008-04-01 15:02:54 +01:00
|
|
|
};
|
|
|
|
|
2008-04-01 18:31:31 +01:00
|
|
|
patches = [ ./install.patch ./gen-manpages.patch ./hibernate.patch ];
|
2008-04-01 15:02:54 +01:00
|
|
|
|
|
|
|
buildInputs = [ gawk ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
# FIXME: Storing config files under `$out/etc' is not very useful.
|
2008-04-01 18:31:31 +01:00
|
|
|
|
|
|
|
substituteInPlace "hibernate.sh" --replace \
|
|
|
|
'SWSUSP_D="/etc/hibernate"' "SWSUSP_D=\"$out/etc/hibernate\""
|
|
|
|
|
|
|
|
# Remove all references to `/bin' and `/sbin'.
|
|
|
|
for i in scriptlets.d/*
|
|
|
|
do
|
|
|
|
substituteInPlace "$i" --replace "/bin/" "" --replace "/sbin/" ""
|
|
|
|
done
|
|
|
|
|
2008-04-01 15:02:54 +01:00
|
|
|
PREFIX="$out" CONFIG_PREFIX="$out" ./install.sh
|
2008-04-01 18:31:31 +01:00
|
|
|
|
|
|
|
ln -s "$out/share/hibernate/scriptlets.d" "$out/etc/hibernate"
|
2008-04-01 15:02:54 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "The `hibernate' script for swsusp and Tux-on-Ice";
|
|
|
|
longDescription = ''
|
|
|
|
This package provides the `hibernate' script, a command-line utility
|
2021-01-15 14:45:37 +00:00
|
|
|
that saves the computer's state to disk and switches it off, turning
|
|
|
|
it into "hibernation". It works both with Linux swsusp and Tux-on-Ice.
|
2008-04-01 15:02:54 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-15 14:45:37 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.tuxonice.net/";
|
2021-01-15 14:45:37 +00:00
|
|
|
platforms = lib.platforms.linux;
|
2008-04-01 15:02:54 +01:00
|
|
|
};
|
|
|
|
}
|