lilalo
annotate l3config.pm @ 99:05e99d32f1f5
$1 заменена на \1
Иначе не работало
Странно.... Проверить
Иначе не работало
Странно.... Проверить
author | devi |
---|---|
date | Mon Jun 12 09:32:18 2006 +0300 (2006-06-12) |
parents | 4c02cf4123ee |
children | c41cc9a4b5ea |
rev | line source |
---|---|
devi@23 | 1 package l3config; |
devi@23 | 2 |
devi@89 | 3 use utf8; |
devi@23 | 4 use Exporter; |
devi@30 | 5 use vars qw(@ISA @EXPORT $VERSION); |
devi@23 | 6 use Getopt::Long; |
devi@23 | 7 |
devi@23 | 8 @ISA = ('Exporter'); |
devi@23 | 9 @EXPORT = qw(%Config &init_config); |
devi@23 | 10 |
devi@32 | 11 our $System_Config_File = "/etc/lilalo.conf"; |
devi@98 | 12 our $User_Config_File = "$ENV{HOME}/.l3rc"; |
devi@32 | 13 $ENV{HOME} ||= "/tmp"; |
devi@32 | 14 |
devi@32 | 15 |
devi@23 | 16 our %Config = ( |
devi@69 | 17 "skip_empty" => "yes", |
devi@69 | 18 "skip_interrupted" => "no", |
devi@69 | 19 "skip_wrong" => "no", |
devi@69 | 20 "editors" => ["vi", "pico", "ee", "vim", "nano"], |
devi@69 | 21 "pagers" => ["more", "less", "zmore", "zless", "info", |
devi@69 | 22 "man", "mc", "trafshow", "screen", "cfdisk", |
devi@69 | 23 "trafshow-bsd", "yes", "lynx", "links", "centericq" |
devi@69 | 24 ], |
devi@69 | 25 "full_output_commands" => ["cat"], |
devi@69 | 26 "terminal" => ["mc"], |
devi@69 | 27 "suppress_editors" => "yes", |
devi@69 | 28 "suppress_pagers" => "yes", |
devi@69 | 29 "suppress_terminal" => "yes", |
devi@23 | 30 |
devi@69 | 31 "terminal_width" => 400, |
devi@81 | 32 "terminal_height" => 300, |
devi@69 | 33 "verbose" => "yes", |
devi@23 | 34 |
devi@82 | 35 "head_lines" => 10, |
devi@82 | 36 "tail_lines" => 10, |
devi@82 | 37 "cache_head_lines" => 250, |
devi@82 | 38 "cache_tail_lines" => 250, |
devi@69 | 39 "skip_text" => "...", |
devi@69 | 40 "show_time" => "yes", |
devi@69 | 41 "show_diffs" => "yes", |
devi@81 | 42 "show_screenshots" => "yes", |
devi@69 | 43 "show_comments" => "yes", |
devi@69 | 44 "show_notes" => "yes", |
devi@23 | 45 |
devi@69 | 46 "input" => "$ENV{HOME}/.lilalo", |
devi@69 | 47 "diffs" => "", |
devi@69 | 48 "input_mask" => "*.script", |
devi@69 | 49 "encoding" => "utf-8", |
devi@23 | 50 |
devi@69 | 51 "cache" => "$ENV{HOME}/.lilalo/report.xml", |
devi@69 | 52 "cache_stat" => "$ENV{HOME}/.lilalo/.report.dat", |
devi@23 | 53 |
devi@69 | 54 "output" => "/tmp/report.html", |
devi@69 | 55 "output_mask" => "INDEX", |
devi@69 | 56 "output_format" => "html", |
devi@69 | 57 "frontend_css" => "/l3/l3.css", |
devi@81 | 58 "l3shot_path" => "/l3shot/", |
devi@81 | 59 "l3shot_suffix" => ".png", |
devi@69 | 60 "frontend_google_ico" => "/l3/google.ico", |
devi@69 | 61 "frontend_linux_ico" => "/l3/linux.ico", |
devi@69 | 62 "frontend_freebsd_ico" => "/l3/freebsd.ico", |
devi@69 | 63 "frontend_opennet_ico" => "/l3/opennet.ico", |
devi@69 | 64 "frontend_local_ico" => "/l3/freebsd.ico", |
devi@23 | 65 |
devi@69 | 66 "mywi_server" => "127.0.0.1", |
devi@69 | 67 "mywi_port" => "19801", |
devi@31 | 68 |
devi@69 | 69 "stat_inactivity_interval" => "1800", |
devi@23 | 70 |
devi@69 | 71 "signature" => "#lm:", |
devi@69 | 72 "from" => "", |
devi@69 | 73 "to" => "", |
devi@69 | 74 "lab" => "", |
devi@69 | 75 "keywords" => "linux command", |
devi@69 | 76 "files_keywords" => "linux file", |
devi@27 | 77 |
devi@69 | 78 comment_width => "300", |
devi@85 | 79 note_width => "500", |
devi@85 | 80 time_width => "6em", |
devi@30 | 81 |
devi@85 | 82 "mode" => "daemon", # daemon | normal |
devi@69 | 83 "daemon_sleep_interval" => "10", |
devi@85 | 84 "detach" => "yes", |
devi@69 | 85 "agent_pidfile" => "$ENV{HOME}/.lilalo/l3-agent.pid", |
devi@30 | 86 |
devi@99 | 87 "backend_address" => "192.168.15.254", |
devi@69 | 88 "backend_port" => "18030", |
devi@69 | 89 "backend_pidfile" => "/tmp/l3-backend.pid", |
devi@69 | 90 "backend_datafile" => "/var/lilalo/lablogs-xml/backend.xml", |
devi@98 | 91 "backend_datadir" => "/var/lilalo/lablogs-xml/", |
devi@30 | 92 |
devi@85 | 93 "l3-agent" => "l3-agent", |
devi@69 | 94 "l3-backend" => "l3-backend", |
devi@30 | 95 |
devi@69 | 96 "course-name" => "", |
devi@69 | 97 "course-code" => "", |
devi@85 | 98 "course-date" => "", |
devi@69 | 99 "course-center" => "", |
devi@69 | 100 "course-trainer" => "", |
devi@69 | 101 "course-student" => "", |
devi@30 | 102 |
devi@85 | 103 "filter" => "", |
devi@58 | 104 #lm |
devi@69 | 105 "show_host" => "no", |
devi@30 | 106 |
devi@98 | 107 "l3cd" => "", # Текущий контекст перехваченных команд |
devi@98 | 108 # Возможные варианты: |
devi@98 | 109 # КУРС/ДАТА-НАЧАЛА/МАШИНА/ПОЛЬЗОВАТЕЛЬ |
devi@98 | 110 # ДАТА-НАЧАЛА/КУРС/МАШИНА/ПОЛЬЗОВАТЕЛЬ |
devi@98 | 111 # УНИКАЛЬНЫЙ_ПОЛЬЗОВАТЕЛЬ/КУРС/МАШИНА/ПОЛЬЗОВАТЕЛЬ |
devi@98 | 112 |
devi@58 | 113 # Вспомогательные программы |
devi@69 | 114 #"l3-report" => "./lm-report", |
devi@85 | 115 "l3-report" => "./l3-report", |
devi@40 | 116 |
devi@58 | 117 # Каталоги |
devi@69 | 118 "path_lilalo" => "/var/lilalo/", |
devi@69 | 119 "path_classes" => "/var/lilalo/classes/", |
devi@69 | 120 "path_lablogs" => "/var/lilalo/lablogs/", |
devi@69 | 121 "courses_path" => "/var/lilalo/courses/", |
devi@85 | 122 "outpath" => "/var/lilalo/out/", |
devi@85 | 123 "path_web" => "/var/www/l3", # Путь к web-отчётам |
devi@69 | 124 "path_share" => "./share/", # Путь к web-отчётам |
devi@48 | 125 |
devi@58 | 126 # Файлы |
devi@85 | 127 "runfile" => "lm.run", |
devi@85 | 128 "logfile" => "lm.log", |
devi@58 | 129 |
devi@85 | 130 "class" => "class", # Имя файла класса |
devi@69 | 131 "class_suffix" => ".xml", # Cуффикс файла класса |
devi@85 | 132 "classfile" => "", |
devi@58 | 133 |
devi@85 | 134 "sshkey" => "$ENV{HOME}/.ssh/id_dsa.pub", |
devi@85 | 135 "lmssh" => "./lm-ssh", |
devi@85 | 136 "lminstall" => "./lm-install", |
devi@96 | 137 "ssh_user" => "root", |
devi@58 | 138 |
devi@85 | 139 "l3scripts" => "l3scripts", |
devi@58 | 140 |
devi@58 | 141 |
devi@69 | 142 "cgi_path_info" => "", |
devi@85 | 143 "cgi2file" => "", |
devi@58 | 144 |
devi@85 | 145 "year" => "2006", |
devi@58 | 146 ); |
devi@23 | 147 |
devi@23 | 148 sub read_config_file |
devi@23 | 149 { |
devi@23 | 150 my $config = $_[0]; |
devi@23 | 151 my $filename = $_[1]; |
devi@23 | 152 open(CONFIG, "$filename") |
devi@23 | 153 or return; |
devi@23 | 154 while (<CONFIG>) { |
devi@98 | 155 chomp; |
devi@23 | 156 s/#.*//; |
devi@23 | 157 next if /^\s*$/; |
devi@23 | 158 my ($var, $val) = split /\s*=\s*/, $_, 2; |
devi@23 | 159 $var =~ s/\s*//; |
devi@23 | 160 $config->{$var} = $val; |
devi@23 | 161 } |
devi@23 | 162 close(CONFIG); |
devi@23 | 163 } |
devi@23 | 164 |
devi@23 | 165 |
devi@23 | 166 sub init_config |
devi@23 | 167 { |
devi@23 | 168 my %argv_config; |
devi@23 | 169 my %file_config; |
devi@32 | 170 read_config_file(\%file_config, $System_Config_File); |
devi@32 | 171 read_config_file(\%file_config, $User_Config_File); |
devi@23 | 172 GetOptions(\%argv_config, map "$_=s", keys %Config); |
devi@23 | 173 %Config = (%Config, %file_config, %argv_config); |
devi@89 | 174 for my $key (keys %Config) { |
devi@89 | 175 utf8::decode($Config{$key}); |
devi@89 | 176 } |
devi@23 | 177 } |
devi@23 | 178 |