lilalo

annotate l3config.pm @ 78:147fb109c012

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