lilalo

view l3config.pm @ 79:44973d76ba4d

Подправлен скрипт l3bashrc.
Теперь определение запущен ли скрипт на текущем терминале или нет,
выполняется через PPID
Идентификатор сессии изменён.
Теперь это просто 8байтоное случайное число + время начала сессии.

l3scripts:
Вместо процедуры инсталляции lm-install
мы теперь просто копируем l3bashrc в lilalo и всё
author devi
date Sun Feb 19 16:02:42 2006 +0200 (2006-02-19)
parents 58ea78973bbb
children d9a700d48bef
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 "full_output_commands" => ["cat"],
26 "terminal" => ["mc"],
27 "suppress_editors" => "yes",
28 "suppress_pagers" => "yes",
29 "suppress_terminal" => "yes",
31 "terminal_width" => 400,
32 "terminal_height" => 100,
33 "verbose" => "yes",
35 "head_lines" => 5,
36 "tail_lines" => 5,
37 "cache_head_lines" => 50,
38 "cache_tail_lines" => 50,
39 "skip_text" => "...",
40 "show_time" => "yes",
41 "show_diffs" => "yes",
42 "show_comments" => "yes",
43 "show_notes" => "yes",
45 "input" => "$ENV{HOME}/.lilalo",
46 "diffs" => "",
47 "input_mask" => "*.script",
48 "encoding" => "utf-8",
50 "cache" => "$ENV{HOME}/.lilalo/report.xml",
51 "cache_stat" => "$ENV{HOME}/.lilalo/.report.dat",
53 "output" => "/tmp/report.html",
54 "output_mask" => "INDEX",
55 "output_format" => "html",
56 "frontend_css" => "/l3/l3.css",
57 "frontend_google_ico" => "/l3/google.ico",
58 "frontend_linux_ico" => "/l3/linux.ico",
59 "frontend_freebsd_ico" => "/l3/freebsd.ico",
60 "frontend_opennet_ico" => "/l3/opennet.ico",
61 "frontend_local_ico" => "/l3/freebsd.ico",
63 "mywi_server" => "127.0.0.1",
64 "mywi_port" => "19801",
66 "stat_inactivity_interval" => "1800",
68 "signature" => "#lm:",
69 "from" => "",
70 "to" => "",
71 "lab" => "",
72 "keywords" => "linux command",
73 "files_keywords" => "linux file",
75 comment_width => "300",
76 note_width => "500",
77 time_width => "6em",
79 "mode" => "daemon", # daemon | normal
80 "daemon_sleep_interval" => "10",
81 "detach" => "yes",
82 "agent_pidfile" => "$ENV{HOME}/.lilalo/l3-agent.pid",
84 "backend_address" => "192.168.15.254",
85 "backend_port" => "18030",
86 "backend_pidfile" => "/tmp/l3-backend.pid",
87 "backend_datafile" => "/var/lilalo/lablogs-xml/backend.xml",
89 "l3-agent" => "l3-agent",
90 "l3-backend" => "l3-backend",
92 "course-name" => "",
93 "course-code" => "",
94 "course-date" => "",
95 "course-center" => "",
96 "course-trainer" => "",
97 "course-student" => "",
99 "filter" => "",
100 #lm
101 "show_host" => "no",
103 # Вспомогательные программы
104 #"l3-report" => "./lm-report",
105 "l3-report" => "./l3-report",
107 # Каталоги
108 "path_lilalo" => "/var/lilalo/",
109 "path_classes" => "/var/lilalo/classes/",
110 "path_lablogs" => "/var/lilalo/lablogs/",
111 "courses_path" => "/var/lilalo/courses/",
112 "outpath" => "/var/lilalo/out/",
113 "path_web" => "/var/www/l3", # Путь к web-отчётам
114 "path_share" => "./share/", # Путь к web-отчётам
116 # Файлы
117 "runfile" => "lm.run",
118 "logfile" => "lm.log",
120 "class" => "class", # Имя файла класса
121 "class_suffix" => ".xml", # Cуффикс файла класса
122 "classfile" => "",
124 "sshkey" => "$ENV{HOME}/.ssh/id_dsa.pub",
125 "lmssh" => "./lm-ssh",
126 "lminstall" => "./lm-install",
127 "ssh_user" => "r",
129 "l3scripts" => "l3scripts",
132 "cgi_path_info" => "",
133 "cgi2file" => "",
135 "year" => "2006",
136 );
138 sub read_config_file
139 {
140 my $config = $_[0];
141 my $filename = $_[1];
142 open(CONFIG, "$filename")
143 or return;
144 while (<CONFIG>) {
145 s/#.*//;
146 next if /^\s*$/;
147 my ($var, $val) = split /\s*=\s*/, $_, 2;
148 $var =~ s/\s*//;
149 $config->{$var} = $val;
150 }
151 close(CONFIG);
152 }
155 sub init_config
156 {
157 my %argv_config;
158 my %file_config;
159 read_config_file(\%file_config, $System_Config_File);
160 read_config_file(\%file_config, $User_Config_File);
161 GetOptions(\%argv_config, map "$_=s", keys %Config);
162 %Config = (%Config, %file_config, %argv_config);
163 }