Browse Source

ap/msva-perl: Daemonize the agent properly.

slackware-14.2
Damien Goutte-Gattat 8 years ago
parent
commit
ba01831356
  1. 31
      ap/msva-perl/msva-perl-0.9.2-fork.diff
  2. 2
      ap/msva-perl/msva-perl.SlackBuild

31
ap/msva-perl/msva-perl-0.9.2-fork.diff

@ -1,12 +1,35 @@
diff -Naur msva-perl-0.9.2.orig/Crypt/Monkeysphere/MSVA.pm msva-perl-0.9.2/Crypt/Monkeysphere/MSVA.pm
--- msva-perl-0.9.2.orig/Crypt/Monkeysphere/MSVA.pm 2013-09-09 08:22:59.000000000 +0200
+++ msva-perl-0.9.2/Crypt/Monkeysphere/MSVA.pm 2013-11-12 00:48:19.970724235 +0100
@@ -841,6 +841,9 @@
+++ msva-perl-0.9.2/Crypt/Monkeysphere/MSVA.pm 2013-11-12 12:54:30.857762903 +0100
@@ -41,7 +41,7 @@
use Crypt::Monkeysphere::OpenPGP;
use JSON;
- use POSIX qw(strftime);
+ use POSIX;
# we need the version of GnuPG::Interface that knows about pubkey_data, etc:
use GnuPG::Interface 0.43;
@@ -841,6 +841,23 @@
# FIXME: consider daemonizing here to behave more like
# ssh-agent. maybe avoid backgrounding by setting
# MSVA_NO_BACKGROUND.
+ if ( fork() ) {
+ exit 0;
+ unless (exists $ENV{MSVA_NO_BACKGROUND}) {
+ POSIX::setsid or die "setsid: $!";
+ my $pid = fork();
+ if ( $pid < 0 ) {
+ die "fork: $!";
+ } elsif ( $pid ) {
+ exit 0;
+ }
+ chdir "/";
+ umask 0;
+ foreach (0..2) {
+ POSIX::close $_;
+ }
+ open (STDIN, "</dev/null");
+ open (STDOUT, ">/dev/null");
+ open (STDERR, ">&STDOUT");
+ }
};
if (exists $ENV{MSVA_MONITOR_CHANGES} &&

2
ap/msva-perl/msva-perl.SlackBuild

@ -33,7 +33,7 @@ WGET=${WGET:-http://archive.monkeysphere.info/debian/pool/monkeysphere/m/msva-pe
# Build infos
NAMEPKG=${NAMEPKG:-msva-perl}
BUILD=${BUILD:-1GGD}
BUILD=${BUILD:-2GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
EXT=${EXT:-txz}

Loading…
Cancel
Save