Automatic program path detection

master
Thomas Hooge 3 years ago
parent 1957b9f56c
commit 1f402a5055
  1. 2
      lib/GUI.pm
  2. 3
      tinyca.cnf.example
  3. 9
      tinyca2

@ -111,7 +111,7 @@ sub new {
# initialize main window
$self->{'mw'} = Gtk2::Window->new("toplevel");
$self->{'mw'}->set_title("TinyCA2 Management $self->{'version'}");
$self->{'mw'}->set_icon_from_file("./icons/tinyca.png");
$self->{'mw'}->set_icon_from_file($self->{'init'}->{'progdir'}."/icons/tinyca.png");
$self->{'mw'}->set_resizable(1);
$section = $self->{'init'}->{'cfg'}->{window};

@ -1,3 +1,6 @@
[global]
debug = false
[paths]
basedir = /var/lib/tinyca
exportdir = /tmp

@ -29,6 +29,7 @@ use MIME::Base64;
use POSIX;
use Locale::gettext;
use File::Basename;
use OpenSSL;
use CA;
@ -45,15 +46,17 @@ use REQ;
use KEY;
use TCONFIG;
my $init = {};
$init->{'progdir'} = dirname($0);
setlocale(LC_MESSAGES, "");
bindtextdomain("tinyca2", "./locale/");
bindtextdomain("tinyca2", $init->{'progdir'}."/locale/");
textdomain("tinyca2");
# https://bugs.gentoo.org/show_bug.cgi?id=78576
$ENV{XLIB_SKIP_ARGB_VISUALS}= '1';
my $cfg = HELPERS::read_global_cfg();
my $init = {};
# location of openssl
$init->{'opensslbin'} = $cfg->{paths}{opensslbin} // "/usr/bin/openssl";
@ -77,7 +80,7 @@ if(not -x $init->{'tarbin'}) {
}
# directory with the templates
$init->{'templatedir'} = $cfg->{paths}{templatedir} // "./templates";
$init->{'templatedir'} = $cfg->{paths}{templatedir} // $init->{'progdir'}."/templates";
if(not -d $init->{'templatedir'}) {
print gettext("Can't find templatedir.\n");