lilalo

view l3config.pm @ 58:93e98a3fa44d

Наконец-то пофиксил неверное определение присутствия l3-agent в FreeBSD
author devi
date Sat Jan 14 00:12:41 2006 +0200 (2006-01-14)
parents d3fcff5e3757
children 1e1422588716
line source
2 package l3config;
4 use Exporter;
5 use vars qw(@ISA @EXPORT $VERSION);
6 use Getopt::Long;
8 @ISA = ('Exporter');
9 @EXPORT = qw(%Config &init_config);
11 our $System_Config_File = "/etc/lilalo.conf";
12 our $User_Config_File = "$ENV{HOME}/.lilalo.conf";
13 $ENV{HOME} ||= "/tmp";
16 our %Config = (
17 "skip_empty" => "yes",
18 "skip_interrupted" => "no",
19 "skip_wrong" => "no",
20 "editors" => ["vi", "pico", "ee", "vim", "nano"],
21 "pagers" => ["more", "less", "zmore", "zless", "info",
22 "man", "mc", "trafshow", "screen", "cfdisk",
23 "trafshow-bsd", "yes", "lynx", "links", "centericq"
24 ],
25 "terminal" => ["mc"],
26 "suppress_editors" => "yes",
27 "suppress_pagers" => "yes",
28 "suppress_terminal" => "yes",
30 "terminal_width" => 400,
31 "terminal_height" => 100,
32 "verbose" => "yes",
34 "head_lines" => 5,
35 "tail_lines" => 5,
36 "cache_head_lines" => 50,
37 "cache_tail_lines" => 50,
38 "skip_text" => "...",
39 "show_time" => "yes",
40 "show_diffs" => "yes",
41 "show_comments" => "yes",
42 "show_notes" => "yes",
44 "input" => "$ENV{HOME}/.lilalo",
45 "diffs" => "",
46 "input_mask" => "*.script",
47 "encoding" => "utf-8",
49 "cache" => "$ENV{HOME}/.lilalo/report.xml",
50 "cache_stat" => "$ENV{HOME}/.lilalo/.report.dat",
52 "output" => "/tmp/report.html",
53 "output_mask" => "INDEX",
54 "output_format" => "html",
55 "frontend_css" => "/l3/l3.css",
56 "frontend_google_ico" => "/l3/google.ico",
57 "frontend_linux_ico" => "/l3/linux.ico",
58 "frontend_freebsd_ico" => "/l3/freebsd.ico",
59 "frontend_opennet_ico" => "/l3/opennet.ico",
60 "frontend_local_ico" => "/l3/freebsd.ico",
62 "mywi_server" => "127.0.0.1",
63 "mywi_port" => "19801",
65 "stat_inactivity_interval" => "1800",
67 "signature" => "#lm:",
68 "from" => "",
69 "to" => "",
70 "lab" => "",
71 "keywords" => "linux command",
72 "files_keywords" => "linux file",
74 comment_width => "300",
75 note_width => "500",
76 time_width => "60",
78 "mode" => "daemon", # daemon | normal
79 "daemon_sleep_interval" => "10",
80 "detach" => "yes",
81 "agent_pidfile" => "$ENV{HOME}/.lilalo/l3-agent.pid",
83 "backend_address" => "192.168.15.254",
84 "backend_port" => "18030",
85 "backend_pidfile" => "/tmp/l3-backend.pid",
86 "backend_datafile" => "/var/lilalo/lablogs-xml/backend.xml",
88 "l3-agent" => "l3-agent",
89 "l3-backend" => "l3-backend",
91 "course-name" => "",
92 "course-code" => "",
93 "course-date" => "",
94 "course-center" => "",
95 "course-trainer" => "",
96 "course-student" => "",
98 "filter" => "",
99 #lm
100 "show_host" => "no",
102 # Вспомогательные программы
103 #"l3-report" => "./lm-report",
104 "l3-report" => "./l3-report",
106 # Каталоги
107 "path_lilalo" => "/var/lilalo/",
108 "path_classes" => "/var/lilalo/classes/",
109 "path_lablogs" => "/var/lilalo/lablogs/",
110 "courses_path" => "/var/lilalo/courses/",
111 "outpath" => "/var/lilalo/out/",
112 "path_web" => "/var/www/l3", # Путь к web-отчётам
113 "path_share" => "./share/", # Путь к web-отчётам
115 # Файлы
116 "runfile" => "lm.run",
117 "logfile" => "lm.log",
119 "class" => "class", # Имя файла класса
120 "class_suffix" => ".xml", # Cуффикс файла класса
121 "classfile" => "",
123 "sshkey" => "$ENV{HOME}/.ssh/id_dsa.pub",
124 "lmssh" => "./lm-ssh",
125 "lminstall" => "./lm-install",
126 "ssh_user" => "root",
128 "l3scripts" => "l3scripts",
131 "cgi_path_info" => "",
132 "cgi2file" => "",
134 "year" => "2006",
135 );
137 sub read_config_file
138 {
139 my $config = $_[0];
140 my $filename = $_[1];
141 open(CONFIG, "$filename")
142 or return;
143 while (<CONFIG>) {
144 s/#.*//;
145 next if /^\s*$/;
146 my ($var, $val) = split /\s*=\s*/, $_, 2;
147 $var =~ s/\s*//;
148 $config->{$var} = $val;
149 }
150 close(CONFIG);
151 }
154 sub init_config
155 {
156 my %argv_config;
157 my %file_config;
158 read_config_file(\%file_config, $System_Config_File);
159 read_config_file(\%file_config, $User_Config_File);
160 GetOptions(\%argv_config, map "$_=s", keys %Config);
161 %Config = (%Config, %file_config, %argv_config);
162 }