summaryrefslogtreecommitdiff
path: root/homepanel-control
blob: cb44727f35837b1e0cc59e4d2ea6bb228e1786fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env perl 
use strict;
use warnings;
use Daemon::Control;
use Path::Tiny;
use Config::Any;
 
my $basedir = path(__FILE__)->parent->realpath;
 
my $config_file = $basedir->child('homepanel.conf');
my $cfg_set = Config::Any->load_files({
    files => [$config_file],
    use_ext => 1,
});
my %config = map { %{(values %$_)[0]} } @$cfg_set;
my $dest_dir = path($config{output_file})->parent->realpath;
my $icons = $basedir->child('icons');
 
exit Daemon::Control->new(
    init_code => <<"INIT",
if [ ! -d $dest_dir/icons ]; then
  mkdir -p $dest_dir
  mount -t tmpfs none $dest_dir
  cp -a $icons $dest_dir/
fi
 
PERL5LIB="/home/dakkar/perl5/libs/HomePanel/lib/perl5\${PERL5LIB+:}\${PERL5LIB}"; export PERL5LIB;
INIT
 
    name        => "HomePanel",
    lsb_sdesc   => 'Home info panel',
    lsb_desc    => 'Show forecast, tube, bus status.',
    path        => path(__FILE__)->realpath,
 
    program     => $basedir->child('driver-async.pl'),
    program_args => [ $config_file ],
 
    user => 'dakkar',
    group => 'users',
    directory => $basedir,
 
    pid_file    => $basedir->child('homepanel.pid'),
    stderr_file => $basedir->child('homepanel.err'),
    stdout_file => $basedir->child('homepanel.out'),
 
    fork        => 2,
 
)->run;