about summary refs log tree commit diff
path: root/pkgs/applications/misc/makeself
diff options
context:
space:
mode:
authorKeshav Kini <keshav.kini@gmail.com>2018-08-17 16:59:23 -0700
committerKeshav Kini <keshav.kini@gmail.com>2018-10-03 10:31:58 -0700
commiteb84586cad3c992d460b64f407874fa372a64581 (patch)
tree76512ea7da6ba5642ed5b1ec0305330ac4964fdf /pkgs/applications/misc/makeself
parentfe5d78a1f29f09906c9571fa2e023c81c65095ab (diff)
makeself: backport megastep/makeself#142
Currently, a self-extracting archive created by makeself will fail to
properly execute on NixOS because the boilerplate Bash code it uses to
clean up the temporary directory it extracted its contents into
assumes that the `rm` command is installed at `/bin/rm`, which is not
the case on NixOS.

This commit, a backport of a pull request I made to the upstream
repository at megastep/makeself#142, fixes the issue by causing the
boilerplate code to call `rm` without specifying an absolute path,
which allows the version of `rm` from one's current Nix environment to
be used instead.
Diffstat (limited to 'pkgs/applications/misc/makeself')
-rw-r--r--pkgs/applications/misc/makeself/Use-rm-from-PATH.patch43
-rw-r--r--pkgs/applications/misc/makeself/default.nix5
2 files changed, 47 insertions, 1 deletions
diff --git a/pkgs/applications/misc/makeself/Use-rm-from-PATH.patch b/pkgs/applications/misc/makeself/Use-rm-from-PATH.patch
new file mode 100644
index 0000000000000..80b9ebf4d5712
--- /dev/null
+++ b/pkgs/applications/misc/makeself/Use-rm-from-PATH.patch
@@ -0,0 +1,43 @@
+From 81cf57e4653360af7f1718391e424fa05d8ea000 Mon Sep 17 00:00:00 2001
+From: Keshav Kini <keshav.kini@gmail.com>
+Date: Thu, 9 Aug 2018 18:36:15 -0700
+Subject: [PATCH] Use `rm` from PATH
+
+On NixOS (a Linux distribution), there is no `/bin/rm`, but an `rm`
+command will generally be available in one's path when running shell
+scripts. Here, I change a couple of invocations of `/bin/rm` into
+invocations of `rm` to deal with this issue.
+
+Since `rm` is already called elsewhere in the script without an
+absolute path, I assume this change will not cause any
+regressions. Still, I've tested this on a CentOS machine and a NixOS
+machine, though not other platforms.
+---
+ makeself-header.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/makeself-header.sh b/makeself-header.sh
+index 4d2c005..2babf34 100755
+--- a/makeself-header.sh
++++ b/makeself-header.sh
+@@ -515,7 +515,7 @@ if test x"\$quiet" = xn; then
+ fi
+ res=3
+ if test x"\$keep" = xn; then
+-    trap 'echo Signal caught, cleaning up >&2; cd \$TMPROOT; /bin/rm -rf "\$tmpdir"; eval \$finish; exit 15' 1 2 3 15
++    trap 'echo Signal caught, cleaning up >&2; cd \$TMPROOT; rm -rf "\$tmpdir"; eval \$finish; exit 15' 1 2 3 15
+ fi
+ 
+ if test x"\$nodiskspace" = xn; then
+@@ -581,7 +581,7 @@ if test x"\$script" != x; then
+ fi
+ if test x"\$keep" = xn; then
+     cd "\$TMPROOT"
+-    /bin/rm -rf "\$tmpdir"
++    rm -rf "\$tmpdir"
+ fi
+ eval \$finish; exit \$res
+ EOF
+-- 
+2.14.1
+
diff --git a/pkgs/applications/misc/makeself/default.nix b/pkgs/applications/misc/makeself/default.nix
index a9ec2760e8ad7..a6af1762e289a 100644
--- a/pkgs/applications/misc/makeself/default.nix
+++ b/pkgs/applications/misc/makeself/default.nix
@@ -11,7 +11,10 @@ stdenv.mkDerivation rec {
     sha256 = "1lw3gx1zpzp2wmzrw5v7k31vfsrdzadqha9ni309fp07g8inrr9n";
   };
 
-  patchPhase = ''
+  # backported from https://github.com/megastep/makeself/commit/77156e28ff21231c400423facc7049d9c60fd1bd
+  patches = [ ./Use-rm-from-PATH.patch ];
+
+  postPatch = ''
     sed -e "s|^HEADER=.*|HEADER=$out/share/${name}/makeself-header.sh|" -i makeself.sh
   '';