summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-04-01 17:31:31 +0000
committerLudovic Courtès <ludo@gnu.org>2008-04-01 17:31:31 +0000
commit9231ea99d96e589eeb96a9e3c6c4f8d64a394c49 (patch)
tree3d0a3522bcb75c5d94495a1f1906321d847a062d
parentbd9b19c180587a5c02d4085f442501a710e11a0a (diff)
downloadnixpkgs-9231ea99d96e589eeb96a9e3c6c4f8d64a394c49.tar
nixpkgs-9231ea99d96e589eeb96a9e3c6c4f8d64a394c49.tar.gz
nixpkgs-9231ea99d96e589eeb96a9e3c6c4f8d64a394c49.tar.bz2
nixpkgs-9231ea99d96e589eeb96a9e3c6c4f8d64a394c49.tar.lz
nixpkgs-9231ea99d96e589eeb96a9e3c6c4f8d64a394c49.tar.xz
nixpkgs-9231ea99d96e589eeb96a9e3c6c4f8d64a394c49.tar.zst
nixpkgs-9231ea99d96e589eeb96a9e3c6c4f8d64a394c49.zip
hibernate: Fix impurities.
svn path=/nixpkgs/trunk/; revision=11445
-rw-r--r--pkgs/os-specific/linux/hibernate/default.nix14
-rw-r--r--pkgs/os-specific/linux/hibernate/hibernate.patch37
2 files changed, 50 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/hibernate/default.nix b/pkgs/os-specific/linux/hibernate/default.nix
index 2b6a9bda374..91dc9068103 100644
--- a/pkgs/os-specific/linux/hibernate/default.nix
+++ b/pkgs/os-specific/linux/hibernate/default.nix
@@ -9,13 +9,25 @@ in
       sha256 = "1xpc2i16jczc3nhvxlkn6fb044srqrh528gnp92cwy4hxf2nzi1z";
     };
 
-    patches = [ ./install.patch ./gen-manpages.patch ];
+    patches = [ ./install.patch ./gen-manpages.patch ./hibernate.patch ];
 
     buildInputs = [ gawk ];
 
     installPhase = ''
       # FIXME: Storing config files under `$out/etc' is not very useful.
+
+      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
+
       PREFIX="$out" CONFIG_PREFIX="$out" ./install.sh
+
+      ln -s "$out/share/hibernate/scriptlets.d" "$out/etc/hibernate"
     '';
 
     meta = {
diff --git a/pkgs/os-specific/linux/hibernate/hibernate.patch b/pkgs/os-specific/linux/hibernate/hibernate.patch
new file mode 100644
index 00000000000..24de1637d3c
--- /dev/null
+++ b/pkgs/os-specific/linux/hibernate/hibernate.patch
@@ -0,0 +1,37 @@
+--- hibernate-script-1.98.1/hibernate.sh	2008-03-31 09:40:29.000000000 +0200
++++ hibernate-script-1.98.1/hibernate.sh	2008-04-01 18:24:23.000000000 +0200
+@@ -224,7 +224,7 @@ FindXServer() {
+ 
+ 	    xauth="`get_env_var_of_process $xpid XAUTHORITY`"
+ 	    xhome="`get_env_var_of_process $xpid HOME`"
+-	    xuser=`/bin/ls -ld /proc/$xpid/ | awk '{print $3}'`
++	    xuser=`ls -ld /proc/$xpid/ | awk '{print $3}'`
+ 	    [ -z $xauth ] && [ -n $xhome ] && [ -f $xhome/.Xauthority ] && xauth=$xhome/.Xauthority
+ 
+ 	    [ -z $xauth ] && continue
+@@ -273,14 +273,14 @@ UsingSuspendMethod() {
+ # chain.
+ SortSuspendBits() {
+     # explicit path required to be ash compatible.
+-    /bin/echo -ne "$SUSPEND_BITS" | sort -n
++    echo -ne "$SUSPEND_BITS" | sort -n
+ }
+ 
+ # SortResumeBits: Returns a list of functions registered in the correct order
+ # to call for resuming, prefixed by their position number.
+ SortResumeBits() {
+     # explicit path required to be ash compatible.
+-    /bin/echo -ne "$RESUME_BITS" | sort -rn
++    echo -ne "$RESUME_BITS" | sort -rn
+ }
+ 
+ # WrapHelpText: takes text from stdin, wraps it with an indent of 5 and width
+@@ -557,7 +557,7 @@ LoadScriptlets() {
+     CURRENT_SOURCED_SCRIPTLET=""
+     for scriptlet_dir in $SCRIPTLET_PATH ; do
+ 	[ -d "$scriptlet_dir" ] || continue
+-	[ -z "`/bin/ls -1 $scriptlet_dir`" ] && continue
++	[ -z "`ls -1 $scriptlet_dir`" ] && continue
+ 	for scriptlet in $scriptlet_dir/* ; do
+ 	    # Avoid editor backup files.
+ 	    case "$scriptlet" in *~|*.bak) continue ;; esac