mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
Merge pull request #12107 from VShell/freenet
freenet: rewrite wrapper to not depend on PATH
This commit is contained in:
commit
e4cc3703c0
@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchurl, fetchgit, ant, jdk, makeWrapper }:
|
||||
{ stdenv, fetchurl, fetchgit, ant, jdk, bash, coreutils, substituteAll }:
|
||||
|
||||
let
|
||||
freenet_ext = fetchurl {
|
||||
@ -15,46 +15,56 @@ let
|
||||
sha256 = "109zn9w8axdkjwhkkcm2s8dvib0mq0n8imjgs3r8hvi128cjsmg9";
|
||||
};
|
||||
version = "build01470";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "freenet-${version}";
|
||||
|
||||
freenet-jars = stdenv.mkDerivation {
|
||||
name = "freenet-jars-${version}";
|
||||
|
||||
src = fetchgit {
|
||||
url = https://github.com/freenet/fred;
|
||||
rev = "refs/tags/${version}";
|
||||
sha256 = "1b6e6fec2b9a729d4a25605fa142df9ea42e59b379ff665f580e32c6178c9746";
|
||||
src = fetchgit {
|
||||
url = https://github.com/freenet/fred;
|
||||
rev = "refs/tags/${version}";
|
||||
sha256 = "1b6e6fec2b9a729d4a25605fa142df9ea42e59b379ff665f580e32c6178c9746";
|
||||
};
|
||||
|
||||
patchPhase = ''
|
||||
cp ${freenet_ext} lib/freenet/freenet-ext.jar
|
||||
cp ${bcprov} lib/bcprov-jdk15on-152.jar
|
||||
|
||||
sed '/antcall.*-ext/d' -i build.xml
|
||||
sed 's/@unknown@/${version}/g' -i build-clean.xml
|
||||
'';
|
||||
|
||||
buildInputs = [ ant jdk ];
|
||||
|
||||
buildPhase = "ant package-only";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/freenet
|
||||
cp lib/bcprov-jdk15on-152.jar $out/share/freenet
|
||||
cp lib/freenet/freenet-ext.jar $out/share/freenet
|
||||
cp dist/freenet.jar $out/share/freenet
|
||||
'';
|
||||
};
|
||||
|
||||
patchPhase = ''
|
||||
cp ${freenet_ext} lib/freenet/freenet-ext.jar
|
||||
cp ${bcprov} lib/bcprov-jdk15on-152.jar
|
||||
in stdenv.mkDerivation {
|
||||
name = "freenet-${version}";
|
||||
inherit version;
|
||||
|
||||
sed '/antcall.*-ext/d' -i build.xml
|
||||
sed 's/@unknown@/${version}/g' -i build-clean.xml
|
||||
'';
|
||||
src = substituteAll {
|
||||
src = ./freenetWrapper;
|
||||
inherit bash coreutils seednodes;
|
||||
freenet = freenet-jars;
|
||||
jre = jdk.jre;
|
||||
};
|
||||
|
||||
buildInputs = [ ant jdk makeWrapper ];
|
||||
jars = freenet-jars;
|
||||
|
||||
buildPhase = "ant package-only";
|
||||
|
||||
freenetWrapper = ./freenetWrapper;
|
||||
phases = [ "installPhase" ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/freenet $out/bin
|
||||
cp lib/bcprov-jdk15on-152.jar $out/share/freenet
|
||||
cp lib/freenet/freenet-ext.jar $out/share/freenet
|
||||
cp dist/freenet.jar $out/share/freenet
|
||||
|
||||
cat <<EOF > $out/bin/freenet.wrapped
|
||||
#!${stdenv.shell}
|
||||
${jdk.jre}/bin/java -cp $out/share/freenet/bcprov-jdk15on-152.jar:$out/share/freenet/freenet-ext.jar:$out/share/freenet/freenet.jar \\
|
||||
-Xmx1024M freenet.node.NodeStarter
|
||||
EOF
|
||||
chmod +x $out/bin/freenet.wrapped
|
||||
makeWrapper $freenetWrapper $out/bin/freenet \
|
||||
--set FREENET_ROOT "$out" \
|
||||
--set FREENET_SEEDNODES "${seednodes}"
|
||||
mkdir -p $out/bin
|
||||
cp $src $out/bin/freenet
|
||||
chmod +x $out/bin/freenet
|
||||
ln -s ${freenet-jars}/share $out/share
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
@ -1,4 +1,6 @@
|
||||
#! /usr/bin/env bash
|
||||
#! @bash@/bin/bash
|
||||
|
||||
PATH=@coreutils@/bin:$PATH
|
||||
|
||||
export FREENET_HOME="$HOME/.local/share/freenet"
|
||||
if [ -n "$XDG_DATA_HOME" ]
|
||||
@ -9,8 +11,8 @@ if [ ! -d $FREENET_HOME ]; then
|
||||
mkdir -p $FREENET_HOME
|
||||
fi
|
||||
|
||||
cp -u $FREENET_SEEDNODES $FREENET_HOME/seednodes.fref
|
||||
cp -u @seednodes@ $FREENET_HOME/seednodes.fref
|
||||
chmod u+rw $FREENET_HOME/seednodes.fref
|
||||
|
||||
cd $FREENET_HOME
|
||||
exec $FREENET_ROOT/bin/freenet.wrapped "$@"
|
||||
@jre@/bin/java -cp @freenet@/share/freenet/bcprov-jdk15on-152.jar:@freenet@/share/freenet/freenet-ext.jar:@freenet@/share/freenet/freenet.jar -Xmx1024M freenet.node.NodeStarter
|
||||
|
Loading…
Reference in New Issue
Block a user