source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/tools/MakeConfig.pl @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 1.1 KB
Line 
1#!/usr/bin/perl
2
3use Getopt::Std;
4getopt('f');
5$config_file_name = $opt_f;
6if ( $config_file_name eq "" ) {
7    print "Error. Configuration name not given\n";
8    print "Usage: MakeConfig -f name\n";
9    exit(0);
10}
11
12# list of directories under config
13# could be dinamucally built, but it's good enough like this
14
15@dirs = ("Shower","Optics","General","Electronics","LightToEuso");
16
17# get current dir and assumes it is esaf root
18# FIXME: check that this is true to be done
19chomp($cwd=`pwd`);
20
21# delete temp file
22if ( -f "/tmp/.mkcnfg.cfg" ) {
23    unlink "/tmp/.mkcnfg.cfg";
24} 
25
26# loop on directories and cat all .cfg files into a temporary file
27foreach $dir (@dirs) {
28    $dd = "$cwd/config/$dir";
29    @files = `ls $dd/*.cfg`;
30    foreach $fil (@files) {
31        chomp($fil);
32        `cat $fil >> /tmp/.mkcnfg.cfg`;
33    }
34}
35
36# cp temporary file to right place
37if ( -f "$cwd/config/Standard/$config_file_name" ) {
38    print "A standard config with this name already exists\n";
39    print "Not overwritten\n";
40    exit;
41}
42
43`cp /tmp/.mkcnfg.cfg $cwd/config/Standard/$config_file_name`;
44`echo $config_file_name | cat >> $cwd/config/Standard/Config.cfg`;
45
Note: See TracBrowser for help on using the repository browser.