2017-02-05 11:23:14 +00:00
|
|
|
{ stdenv, lib, fetchurl, gnome3, glib, libSM, gdk_pixbuf, libX11, libXinerama, iproute,
|
2015-12-14 16:43:08 +00:00
|
|
|
makeWrapper, libredirect, ppp, coreutils, gawk, pango }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "forticlientsslvpn";
|
|
|
|
# forticlient will be copied into /tmp before execution. this is necessary as
|
|
|
|
# the software demands $base to be writeable
|
|
|
|
|
2016-07-18 16:57:36 +00:00
|
|
|
# TODO: chroot and create the following files instead of copying files manually
|
2016-05-02 15:39:34 +00:00
|
|
|
# mkdir /etc/ppp ; touch /etc/ppp/options
|
|
|
|
# ln -s /run/current-system/sw/bin/tail /usr/bin/tail
|
2016-07-18 16:57:36 +00:00
|
|
|
# ln -s /run/current-system/sw/bin/pppd /usr/sbin/pppd
|
2016-05-02 15:39:34 +00:00
|
|
|
|
2015-12-14 16:43:08 +00:00
|
|
|
src = fetchurl {
|
|
|
|
# archive.org mirror:
|
2017-12-28 15:02:32 +00:00
|
|
|
url = https://archive.org/download/ForticlientsslvpnLinux4.4.23171.tar/forticlientsslvpn_linux_4.4.2317.tar.gz;
|
|
|
|
# url = http://www.zen.co.uk/userfiles/knowledgebase/FortigateSSLVPNClient/forticlientsslvpn_linux_4.4.2317.tar.gz;
|
2015-12-14 16:43:08 +00:00
|
|
|
sha256 = "19clnf9rgrnwazlpah8zz5kvz6kc8lxawrgmksx25k5ywflmbcrr";
|
|
|
|
};
|
|
|
|
phases = [ "unpackPhase" "buildPhase" "installPhase" "fixupPhase" ];
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
2016-03-03 18:45:46 +00:00
|
|
|
binPath = lib.makeBinPath [
|
2015-12-14 16:43:08 +00:00
|
|
|
coreutils
|
|
|
|
gawk
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
libPath = lib.makeLibraryPath [
|
|
|
|
stdenv.cc.cc
|
|
|
|
];
|
|
|
|
|
|
|
|
guiLibPath = lib.makeLibraryPath [
|
2017-02-05 11:23:14 +00:00
|
|
|
gnome3.gtk
|
2015-12-14 16:43:08 +00:00
|
|
|
glib
|
|
|
|
libSM
|
|
|
|
gdk_pixbuf
|
|
|
|
libX11
|
|
|
|
libXinerama
|
|
|
|
pango
|
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
# TODO: 32bit, use the 32bit folder
|
|
|
|
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
--set-rpath "$libPath" \
|
|
|
|
64bit/forticlientsslvpn_cli
|
|
|
|
|
|
|
|
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
--set-rpath "$libPath:$guiLibPath" \
|
|
|
|
64bit/forticlientsslvpn
|
|
|
|
|
|
|
|
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
|
|
|
--set-rpath "$libPath" \
|
|
|
|
64bit/helper/subproc
|
|
|
|
|
|
|
|
sed -i 's#\(export PATH=\).*#\1"${binPath}"#' 64bit/helper/waitppp.sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/opt/fortinet"
|
|
|
|
|
|
|
|
cp -r 64bit/. "$out/opt/fortinet"
|
|
|
|
wrapProgram $out/opt/fortinet/forticlientsslvpn \
|
|
|
|
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
|
2016-07-18 16:57:36 +00:00
|
|
|
--set NIX_REDIRECTS /usr/bin/tail=${coreutils}/bin/tail:/usr/sbin/ip=${iproute}/bin/ip:/usr/sbin/pppd=${ppp}/bin/pppd
|
2015-12-14 16:43:08 +00:00
|
|
|
|
|
|
|
mkdir -p "$out/bin/"
|
|
|
|
|
|
|
|
cat > $out/bin/forticlientsslvpn <<EOF
|
|
|
|
#!/bin/sh
|
|
|
|
# prepare suid bit in tmp
|
|
|
|
# TODO maybe tmp does not support suid
|
|
|
|
set -euf
|
|
|
|
tmpforti=\$(${coreutils}/bin/mktemp -d)
|
|
|
|
trap "rm -rf \$tmpforti;" INT TERM EXIT
|
|
|
|
cp -r $out/opt/fortinet/. \$tmpforti
|
|
|
|
chmod +s \$tmpforti/helper/subproc
|
|
|
|
cd \$tmpforti
|
|
|
|
"./forticlientsslvpn" "\$@"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod +x $out/bin/forticlientsslvpn
|
|
|
|
chmod -x $out/opt/fortinet/helper/showlicense
|
|
|
|
'';
|
|
|
|
meta = {
|
|
|
|
homepage = http://www.fortinet.com;
|
|
|
|
description = "Forticlient SSL-VPN client";
|
2016-01-18 11:53:07 +00:00
|
|
|
license = lib.licenses.unfree;
|
2015-12-14 16:43:08 +00:00
|
|
|
maintainers = [ lib.maintainers.makefu ];
|
|
|
|
};
|
|
|
|
}
|