git://git.iain.cx/iain
/
profile.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow specifying path to tmux.
[profile.git]
/
opt
/
bin
/
ktmux_helper
diff --git
a/opt/bin/ktmux_helper
b/opt/bin/ktmux_helper
index
31605c8
..
0e48ad4
100755
(executable)
--- a/
opt/bin/ktmux_helper
+++ b/
opt/bin/ktmux_helper
@@
-1,10
+1,16
@@
#!/usr/bin/perl
#
# ktmux_helper: Run krenew in the background for tmux.
#!/usr/bin/perl
#
# ktmux_helper: Run krenew in the background for tmux.
+# Usage: ktmux_helper [options]
+# Options: -I <path> Specify path to kinit.
+# -L <path> Specify path to klist.
+# -R <path> Specify path to krenew.
+# -T <path> Specify path to tmux.
# Notes: Doesn't handle multiple sessions properly.
#
use FindBin;
# Notes: Doesn't handle multiple sessions properly.
#
use FindBin;
+use Getopt::Std;
use POSIX ":sys_wait_h";
my $PROG = $FindBin::Script;
use POSIX ":sys_wait_h";
my $PROG = $FindBin::Script;
@@
-21,6
+27,14
@@
my $tmux_helper = &get_tmux_helper;
exit 0 if $tmux_helper;
$tmux_helper = $$;
exit 0 if $tmux_helper;
$tmux_helper = $$;
+my %opts;
+getopts('I:L:R:T:', \%opts);
+
+my $kinit = $opts{'I'} || "kinit";
+my $klist = $opts{'L'} || "klist";
+my $krenew = $opts{'R'} || "krenew";
+my $tmux = $opts{'T'} || "tmux";
+
my $exitasap = 0;
my $pid = 0;
my $exitasap = 0;
my $pid = 0;
@@
-47,7
+61,7
@@
LOOP: while (&ping_tmux) {
}
else {
exit 1 if &check_credentials;
}
else {
exit 1 if &check_credentials;
- exec
"krenew"
, "-K", "60";
+ exec
$krenew
, "-K", "60";
print "$PROG: Can't run krenew: $!\n";
exit 111;
}
print "$PROG: Can't run krenew: $!\n";
exit 111;
}
@@
-88,7
+102,7
@@
sub ping_tmux {
# Try to check existing Kerberos credentials.
sub check_credentials {
# Try to check existing Kerberos credentials.
sub check_credentials {
- system
"klist"
, "-s";
+ system
$klist
, "-s";
return 1 if $? < 0;
return 0 unless $?;
kill USR1, $tmux_helper;
return 1 if $? < 0;
return 0 unless $?;
kill USR1, $tmux_helper;
@@
-99,7
+113,7
@@
sub check_credentials {
sub want_credentials {
# Do we already know?
return sleep 1 if &check_kinit_child;
sub want_credentials {
# Do we already know?
return sleep 1 if &check_kinit_child;
- system
"tmux", "new-window", "-n", "Renew Kerberos credentials", "exec
kinit";
+ system
$tmux, "new-window", "-n", "Renew Kerberos credentials", "exec $
kinit";
}
sub cleanup {
}
sub cleanup {