mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-19 18:40:01 +02:00
Modified config_gen script
This commit is contained in:
parent
8f66d63b08
commit
eee739625f
@ -1,103 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" == "--help" ]; then
|
||||
echo This tool generates config files.
|
||||
echo Please edit the variables in the script
|
||||
echo and run $0 \> output.config.
|
||||
exit
|
||||
fi
|
||||
|
||||
# local variables
|
||||
dir=/home/l_brueckner_m/xsw/settingsdir/eiger
|
||||
|
||||
# HOSTNAMES is special
|
||||
# Beside of the hostname line it also defines the amount of (half) modules
|
||||
# for the body part
|
||||
# take care for the last space
|
||||
HOSTNAMES="beb069 beb068 beb067 beb066 "
|
||||
|
||||
## header contains constant values at the beginning of the file
|
||||
header=(
|
||||
detsizechan="3072 512"
|
||||
)
|
||||
|
||||
## the body part is for each half module
|
||||
# counters will count automatically
|
||||
counters=(
|
||||
rx_tcpport="1956"
|
||||
rx_udpport="50001"
|
||||
)
|
||||
|
||||
# constant values
|
||||
constants=(
|
||||
rx_hostname="pc1875"
|
||||
lock=0
|
||||
settingsdir=$dir
|
||||
caldir=$dir
|
||||
outdir=/home/l_brueckner_m/xsw/out
|
||||
)
|
||||
|
||||
# lists contains space separated lists each value for each half module
|
||||
lists=(
|
||||
#detectormac="aa:bb:cc:dd:ee:ff 11:22:33:44:55:66"
|
||||
)
|
||||
|
||||
|
||||
## footer contains constant values for the end of the file
|
||||
footer=(
|
||||
outdir=$OUTDIR
|
||||
threaded=1
|
||||
)
|
||||
|
||||
|
||||
function get_name_value
|
||||
{
|
||||
name=${1%%=*}
|
||||
value=${1#*=}
|
||||
}
|
||||
|
||||
function shift_var
|
||||
{
|
||||
shifts=$1
|
||||
shift
|
||||
shift $shifts
|
||||
value=$1
|
||||
}
|
||||
|
||||
|
||||
echo hostname ${HOSTNAMES// /+}
|
||||
for i in "${header[@]}"; do
|
||||
get_name_value "$i"
|
||||
echo $name $value
|
||||
done
|
||||
|
||||
echo
|
||||
|
||||
num=0
|
||||
for host in $HOSTNAMES; do
|
||||
for i in "${counters[@]}"; do
|
||||
get_name_value "$i"
|
||||
echo $num:$name $((value+$num))
|
||||
done
|
||||
|
||||
for i in "${lists[@]}"; do
|
||||
get_name_value "$i"
|
||||
shift_var $num $value
|
||||
echo $num:$name $value
|
||||
done
|
||||
|
||||
for i in "${constants[@]}"; do
|
||||
get_name_value "$i"
|
||||
echo $num:$name $value
|
||||
done
|
||||
echo
|
||||
num=$((num+1))
|
||||
done
|
||||
|
||||
for i in "${footer[@]}"; do
|
||||
get_name_value "$i"
|
||||
echo $name $value
|
||||
done
|
||||
|
||||
exit
|
||||
|
47
examples/config_gen_script/beb_31_25.config_gen
Normal file
47
examples/config_gen_script/beb_31_25.config_gen
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# local variables
|
||||
dir=/home/l_msdetect/martin/sls_detectors_package/settingsdir/eiger
|
||||
|
||||
# HOSTNAMES is special
|
||||
# Beside of the hostname line it also defines the amount of (half) modules
|
||||
# for the body part
|
||||
# take care for the last space
|
||||
HOSTNAMES="beb031 beb025 "
|
||||
|
||||
## header contains constant values at the beginning of the file
|
||||
header=(
|
||||
detsizechan="2048 512"
|
||||
)
|
||||
|
||||
## the body part is for each half module
|
||||
# counters will count automatically
|
||||
# the number behind ':' indicates the incrementation value
|
||||
|
||||
counters=(
|
||||
rx_tcpport="1958:1"
|
||||
rx_udpport="50001:2"
|
||||
rx_udpport2="50002:2"
|
||||
)
|
||||
|
||||
# constant values
|
||||
constants=(
|
||||
rx_hostname="mpc1975"
|
||||
lock=0
|
||||
settingsdir=$dir
|
||||
caldir=$dir
|
||||
)
|
||||
|
||||
# lists contains space separated lists each value for each half module
|
||||
lists=(
|
||||
#detectorip="10.1.1.214 10.1.1.213 10.1.1.216 10.1.1.211 10.1.1.215 10.1.1.210 10.1.1.217 10.1.1.212"
|
||||
)
|
||||
|
||||
|
||||
## footer contains constant values for the end of the file
|
||||
footer=(
|
||||
outdir=/home/l_msdetect/martin/out
|
||||
threaded=1
|
||||
clkdivider=2
|
||||
)
|
||||
|
71
examples/config_gen_script/config_gen
Executable file
71
examples/config_gen_script/config_gen
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" == "--help" ]; then
|
||||
echo This tool generates config files.
|
||||
echo Please edit the variables in the script
|
||||
echo and run $0 \> output.config.
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
echo This script generates config files for slsDetector out of config_gen files
|
||||
echo Please specify the config_gen file
|
||||
exit
|
||||
fi
|
||||
|
||||
. $1
|
||||
|
||||
|
||||
function get_name_value
|
||||
{
|
||||
name=${1%%=*}
|
||||
value=${1#*=}
|
||||
}
|
||||
|
||||
function shift_var
|
||||
{
|
||||
shifts=$1
|
||||
shift
|
||||
shift $shifts
|
||||
value=$1
|
||||
}
|
||||
|
||||
|
||||
echo hostname ${HOSTNAMES// /+}
|
||||
for i in "${header[@]}"; do
|
||||
get_name_value "$i"
|
||||
echo $name $value
|
||||
done
|
||||
|
||||
echo
|
||||
|
||||
num=0
|
||||
for host in $HOSTNAMES; do
|
||||
for i in "${counters[@]}"; do
|
||||
get_name_value "$i"
|
||||
value2=${value%%:*}
|
||||
inc=${value#*:}
|
||||
echo $num:$name $((value2+$((num*$inc))))
|
||||
done
|
||||
|
||||
for i in "${lists[@]}"; do
|
||||
get_name_value "$i"
|
||||
shift_var $num $value
|
||||
echo $num:$name $value
|
||||
done
|
||||
|
||||
for i in "${constants[@]}"; do
|
||||
get_name_value "$i"
|
||||
echo $num:$name $value
|
||||
done
|
||||
echo
|
||||
num=$((num+1))
|
||||
done
|
||||
|
||||
for i in "${footer[@]}"; do
|
||||
get_name_value "$i"
|
||||
echo $name $value
|
||||
done
|
||||
|
||||
exit
|
||||
|
47
examples/config_gen_script/eiger_2m_1gb.config_gen
Normal file
47
examples/config_gen_script/eiger_2m_1gb.config_gen
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# local variables
|
||||
dir=/home/l_msdetect/martin/sls_detectors_package/settingsdir/eiger
|
||||
|
||||
# HOSTNAMES is special
|
||||
# Beside of the hostname line it also defines the amount of (half) modules
|
||||
# for the body part
|
||||
# take care for the last space
|
||||
HOSTNAMES="beb074 beb071 beb064 beb102 beb087 beb088 beb072 beb073 "
|
||||
|
||||
## header contains constant values at the beginning of the file
|
||||
header=(
|
||||
detsizechan="4096 512"
|
||||
)
|
||||
|
||||
## the body part is for each half module
|
||||
# counters will count automatically
|
||||
# the number behind ':' indicates the incrementation value
|
||||
|
||||
counters=(
|
||||
rx_tcpport="1991:1"
|
||||
rx_udpport="50011:2"
|
||||
rx_udpport2="50012:2"
|
||||
)
|
||||
|
||||
# constant values
|
||||
constants=(
|
||||
rx_hostname="10.1.1.100"
|
||||
rx_udpip="10.1.1.100"
|
||||
lock=0
|
||||
settingsdir=$dir
|
||||
caldir=$dir
|
||||
)
|
||||
|
||||
# lists contains space separated lists each value for each half module
|
||||
lists=(
|
||||
detectorip="10.1.1.214 10.1.1.213 10.1.1.216 10.1.1.211 10.1.1.215 10.1.1.210 10.1.1.217 10.1.1.212"
|
||||
)
|
||||
|
||||
|
||||
## footer contains constant values for the end of the file
|
||||
footer=(
|
||||
outdir=/home/l_msdetect/martin/out
|
||||
threaded=1
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user