Skip to content

Commit 0c0f700

Browse files
committed
Initial Commit
0 parents  commit 0c0f700

15 files changed

+547
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sw-builder/hexactrl-sw*
2+
**/id_rsa*
3+
ps/grafana
4+
ps/supply/venv

client/CERN-REPO-hgcwebsw.repo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[hgcal-daq-sw]
2+
name=HCGAL-DAQ-SW
3+
baseurl=https://hgc-online-sw.web.cern.ch/hgc-online-sw/hgcal-daq-sw/almalinux/9/x86_64/
4+
enabled=1
5+
gpgcheck=0
6+
metadata_expire=1m

client/configuration.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
DBDatabase: ''
2+
DBHostname: ''
3+
DBPassword: ''
4+
DBUsername: ''
5+
DataLoc: /home/hgcal/data/
6+
DebugMode: true
7+
DefaultFontSize: '15'
8+
HVResource: ASRL/dev/ttyUSB0::INSTR
9+
HVTerminal: Rear
10+
HVWiresPolarization: Reverse
11+
HasHVSwitch: false
12+
HasLocalDB: true
13+
HasRHSensor: false
14+
Inspectors:
15+
- nanguyen
16+
MACSerial: CM
17+
PCKeyLoc: /home/hgcal/.ssh/id_rsa
18+
TestingPCOpSys: Alma9
19+
TrenzHostname:
20+
- 10.116.24.233

client/module-testing-gui.desktop

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=HGCal Module Testing GUI
4+
Path=/opt/hgcal-module-testing-gui
5+
Exec=/opy/hgcal-module-testing-gui/venv/bin/python3 TestingGUIBase.py
6+
Icon=/usr/share/pixmaps/faces/cat.png

client/requirements.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
async-timeout==4.0.3
2+
asyncpg==0.29.0
3+
awkward0==0.15.5
4+
bcrypt==4.1.3
5+
cachetools==5.3.3
6+
cffi==1.16.0
7+
contourpy==1.2.1
8+
cryptography==42.0.8
9+
cycler==0.12.1
10+
fonttools==4.53.0
11+
importlib_resources==6.4.0
12+
kiwisolver==1.4.5
13+
matplotlib==3.9.0
14+
numpy==1.26.4
15+
packaging==24.1
16+
pandas==2.2.2
17+
paramiko==3.4.0
18+
pillow==10.3.0
19+
pycparser==2.22
20+
PyNaCl==1.5.0
21+
pyparsing==3.1.2
22+
PySimpleGUI==4.60.5
23+
python-dateutil==2.9.0.post0
24+
pytz==2024.1
25+
PyVISA==1.14.1
26+
PyYAML==6.0.1
27+
six==1.16.0
28+
typing_extensions==4.12.2
29+
tzdata==2024.1
30+
uproot3==3.14.4
31+
uproot3-methods==0.10.1
32+
zipp==3.19.2

client/setup.sh

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
#!/bin/bash
2+
3+
# Setup Files
4+
BASEDIR=$(dirname "$0")
5+
RSA_PUBKEY="$BASEDIR/id_rsa.pub"
6+
RSA_PRIVKEY="$BASEDIR/id_rsa"
7+
8+
SSH_DIR="$HOME/.ssh"
9+
RSA_PUBKEY_TARGET="$SSH_DIR/id_rsa.pub"
10+
RSA_PRIVKEY_TARGET="$SSH_DIR/id_rsa"
11+
12+
CERN_REPO="$BASEDIR/CERN-REPO-hgcwebsw.repo"
13+
CERN_REPO_TARGET="/etc/yum.repos.d/CERN-REPO-hgcwebsw.repo"
14+
15+
GUI_LOCATION="/opt/hgcal-module-testing-gui"
16+
GUI_REPO="https://gitlab.cern.ch/acrobert/hgcal-module-testing-gui.git"
17+
GUI_CONFIG="$BASEDIR/configuration.yaml"
18+
GUI_CONFIG_TARGET="$GUI_LOCATION/configuration.yaml"
19+
GUI_REQUIREMENTS="$BASEDIR/requirements.txt"
20+
21+
GUI_VENV="$GUI_LOCATION/venv"
22+
23+
# Verification functions
24+
25+
function verify_exists_file {
26+
if [ ! -f $1 ]; then
27+
echo "Missing file $1; Exiting..."
28+
exit 1
29+
fi
30+
}
31+
32+
function verify_exists_directory {
33+
if [ ! -d $1 ]; then
34+
echo "Missing file $1; Exiting..."
35+
exit 1
36+
fi
37+
}
38+
39+
# Verify validity of files
40+
41+
verify_exists_file $RSA_PUBKEY
42+
verify_exists_file $RSA_PRIVKEY
43+
verify_exists_file $CERN_REPO
44+
verify_exists_file $GUI_CONFIG
45+
verify_exists_file $GUI_REQUIREMENTS
46+
47+
# Install SSH keys
48+
if [ ! -d $SSH_DIR ]; then
49+
echo "$SSH_DIR does not exist. Creating..."
50+
mkdir $SSH_DIR
51+
chmod 700 $SSH_DIR
52+
fi
53+
54+
# Check for existing keys
55+
if [ -f "$RSA_PUBKEY_TARGET" -o -f "$RSA_PRIVKEY_TARGET" ]; then
56+
# Check if a result of this script
57+
if cmp -s -- "$RSA_PUBKEY" "$RSA_PUBKEY_TARGET"; then
58+
if cmp -s -- "$RSA_PRIVKEY" "$RSA_PRIVKEY_TARGET"; then
59+
echo "RSA public/private keypair already present. Skipping..."
60+
else
61+
echo "ERROR: RSA Public key does not match private key! Exiting..."
62+
exit 1
63+
fi
64+
else
65+
# Not part of this script, warn users
66+
echo "Skipping installation of RSA public/private keypair as one already exists."
67+
echo "WARNING: Present keypair may not be authorized on the FPGAs."
68+
fi
69+
else
70+
# No keys installed, so install ours
71+
cp "$RSA_PUBKEY" "$RSA_PUBKEY_TARGET"
72+
chmod 644 $RSA_PUBKEY_TARGET
73+
74+
cp "$RSA_PRIVKEY" "$RSA_PRIVKEY_TARGET"
75+
chmod 600 $RSA_PRIVKEY_TARGET
76+
fi
77+
78+
# Install dependencies
79+
# echo "Install dependencies..."
80+
# sudo yum install epel-release
81+
# sudo yum update
82+
83+
# devtoolset-10 is not a repo in AlmaLinux, repalce with gcc-toolset-13
84+
# sudo yum install pugixml pugixml-devel python3 python3-devel cmake zeromq zeromq-devel cppzmq-devel libyaml libyaml-devel yaml-cpp yaml-cpp-devel boost boost-devel root
85+
86+
87+
# Add CERN Repo
88+
if [ -f CERN_REPO_TARGET ]; then
89+
echo "CERN repo already present. Skipping..."
90+
else
91+
echo "Installing CERN Repo..."
92+
sudo cp $CERN_REPO $CERN_REPO_TARGET
93+
fi
94+
95+
# Install Hexactrl-sw
96+
# echo "Installing Hexactrl-sw..."
97+
# sudo yum update
98+
99+
# sudo yum install hexactrl-sw-rocv3
100+
#
101+
# # Install Python Modules
102+
# echo "Installing Python Dependencies..."
103+
#
104+
# pip3 install --upgrade pip
105+
# pip3 install -r /opt/hexactrl/ROCv3/ctrl/etc/requirements.txt --user
106+
#
107+
# # Enable DAQ Client Service
108+
# echo "Enabling DAQ Client Service"
109+
# sudo systemctl daemon-reload
110+
# sudo systemctl enable daq-client.service
111+
112+
# Install GUI Prereqs
113+
echo "Installing Client GUI Prerequisites"
114+
sudo dnf -y install libpq-devel python3-devel python3-tkinter
115+
116+
# Clone GUI
117+
if [ ! -d $GUI_LOCATION ]; then
118+
echo "Cloning GUI..."
119+
sudo mkdir $GUI_LOCATION
120+
sudo chmod 777 $GUI_LOCATION
121+
git clone "$GUI_REPO" "$GUI_LOCATION"
122+
else
123+
echo "GUI Already Cloned, Skipping..."
124+
fi
125+
126+
# Create VirtualEnv
127+
if [ ! -d $GUI_VENV ]; then
128+
echo "Creating GUI Virtual Environment..."
129+
python3 -m venv "$GUI_VENV"
130+
$GUI_VENV/bin/pip3 install -r "$GUI_REQUIREMENTS"
131+
else
132+
echo "Virtual Environment already exists. Skipping..."
133+
fi
134+
135+
# Add Config
136+
if [ ! -f $GUI_CONFIG_TARGET ]; then
137+
echo "Copying GUI Config..."
138+
cp "$GUI_CONFIG" "$GUI_CONFIG_TARGET"
139+
else
140+
echo "GUI Config already exists, skipping..."
141+
fi

controller/CERN-REPO-hgcwebsw.repo

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[cernrepo_hgcwebsw]
2+
name=CERN-REPO-hgcwebsw
3+
baseurl=https://hgc-online-sw.web.cern.ch/hgc-online-sw/repository/
4+
enabled=1
5+
gpgcheck=0
6+
metadata_expire=1m
7+
[hgcal-daq-sw]
8+
name=HCGAL-DAQ-SW
9+
baseurl=https://hgc-online-sw.web.cern.ch/hgc-online-sw/hgcal-daq-sw/almalinux/9/aarch64/
10+
enabled=1
11+
gpgcheck=0
12+
metadata_expire=1m

controller/log-ip.service

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Unit]
2+
Description=Logs the internal IP network to a file
3+
After=network-online.target
4+
5+
[Service]
6+
ExecStart=/usr/sbin/ifconfig
7+
StandardOutput=file:/opt/ip.txt
8+
9+
[Install]
10+
WantedBy=default.target

controller/setup.sh

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#!/bin/bash
2+
3+
# Setup Files
4+
BASEDIR=$(dirname "$0")
5+
RSA_PUBKEY="$BASEDIR/id_rsa.pub"
6+
7+
SSH_DIR_USER="$HOME/.ssh"
8+
SSH_AUTH_KEYS_USER="$SSH_DIR/authorized_keys"
9+
10+
SSH_DIR_ROOT="/root/.ssh"
11+
SSH_AUTH_KEYS_ROOT="$SSH_DIR_ROOT/.ssh/authorized_keys"
12+
13+
CERN_REPO="$BASEDIR/CERN-REPO-hgcwebsw.repo"
14+
CERN_REPO_TARGET="/etc/yum.repos.d/CERN-REPO-hgcwebsw.repo"
15+
16+
LOG_IP_UNIT="$BASEDIR/log-ip.service"
17+
LOG_IP_TARGET="/etc/systemd/system/log-ip.service"
18+
19+
# Verification functions
20+
21+
function verify_exists_file {
22+
if [ ! -f $1 ]; then
23+
echo "Missing file $1; Exiting..."
24+
exit 1
25+
fi
26+
}
27+
28+
function verify_exists_directory {
29+
if [ ! -d $1 ]; then
30+
echo "Missing file $1; Exiting..."
31+
exit 1
32+
fi
33+
}
34+
35+
# Verify validity of files
36+
37+
verify_exists_file $RSA_PUBKEY
38+
verify_exists_file $CERN_REPO
39+
40+
# Install SSH keys
41+
42+
# User keys
43+
if [ ! -d $SSH_DIR_USER ]; then
44+
echo "$SSH_DIR_USER does not exist. Creating..."
45+
mkdir $SSH_DIR_USER
46+
chmod 700 $SSH_DIR_USER
47+
fi
48+
49+
if [ ! -f "$SSH_AUTH_KEYS_USER"]; then
50+
echo "User's SSH Authorized Keys file does not exist. Creating..."
51+
touch "$SSH_AUTH_KEYS_USER"
52+
chmod 644 "$SSH_AUTH_KEYS_USER"
53+
fi
54+
55+
if [ grep -Fx -f "$RSA_PUBKEY" "$SSH_AUTH_KEYS_USER" ]; then
56+
echo "RSA Pubkey already present in user's authorized keys. Skipping..."
57+
else
58+
echo "Installing RSA Pubkey to user's authorized keys."
59+
cat "$RSA_PUBKEY" | tee -a $SSH_AUTH_KEYS_USER
60+
fi
61+
62+
# Root keys
63+
if [ ! -d $SSH_DIR_ROOT ]; then
64+
echo "$SSH_DIR_ROOT does not exist. Creating..."
65+
mkdir $SSH_DIR_ROOT
66+
chmod 700 $SSH_DIR_ROOT
67+
fi
68+
69+
if [ ! -f "$SSH_AUTH_KEYS_ROOT"]; then
70+
echo "Root SSH Authorized Keys file does not exist. Creating..."
71+
touch "$SSH_AUTH_KEYS_ROOT"
72+
chmod 644 "$SSH_AUTH_KEYS_ROOT"
73+
fi
74+
75+
if [ grep -Fx -f "$RSA_PUBKEY" "$SSH_AUTH_KEYS_ROOT" ]; then
76+
echo "RSA Pubkey already present in root's authorized keys. Skipping..."
77+
else
78+
echo "Installing RSA Pubkey to root's authorized keys."
79+
cat "$RSA_PUBKEY" | sudo tee -a $SSH_AUTH_KEYS_ROOT
80+
fi
81+
82+
# Install dependencies
83+
echo "Install dependencies..."
84+
sudo dnf -y install epel-release
85+
sudo dnf update
86+
87+
# devtoolset-10 is not a repo in AlmaLinux, repalce with gcc-toolset-13
88+
sudo dnf -y --enablerepo=crb install cmake zeromq zeromq-devel cppzmq-devel libyaml libyaml-devel yaml-cpp yaml-cpp-devel boost boost-devel python3 python3-devel autoconf-archive pugixml pugixml-devel gcc-toolset-13
89+
90+
# Add CERN Repo
91+
if [ -f $CERN_REPO_TARGET ]; then
92+
echo "CERN repo already present. Skipping..."
93+
else
94+
echo "Installing CERN Repo..."
95+
sudo cp $CERN_REPO $CERN_REPO_TARGET
96+
fi
97+
98+
# Install fw-loader
99+
echo "Installing fw-loader..."
100+
sudo dnf update
101+
102+
sudo dnf -y install fw-loader hexaboard-hd-tester-v2p0-trophy-v3
103+
104+
# Install ipbus-software (hgcal-uio)
105+
echo "Installing ipbus-software (hgcal-uio)"
106+
107+
sudo dnf -y install cactuscore*
108+
109+
# Install Hexactrl-sw
110+
echo "Installing hexactrl-sw"
111+
112+
sudo dnf install hexactrl-sw-rocv3
113+
114+
# Install Python Modules
115+
echo "Installing Python Dependencies..."
116+
117+
sudo pip3 install --upgrade pip
118+
sudo pip3 -r /opt/hexactrl/ROCv3/ctrl/etc/requirements.txt
119+
120+
# Enable DAQ Client Service
121+
echo "Enabling DAQ Client Service"
122+
sudo systemctl daemon-reload
123+
sudo systemctl enable daq-server.service
124+
sudo systemctl enable i2c-service.service
125+
126+
# Install IP Logging service
127+
if [ -f $LOG_IP_TARGET ]; then
128+
echo "IP Logger already present. Skipping..."
129+
else
130+
echo "Installing IP Logger..."
131+
sudo cp "$LOG_IP_UNIT" "$LOG_IP_TARGET"
132+
sudo systemctl daemon-reload
133+
sudo systemctl enable log-ip
134+
exit

0 commit comments

Comments
 (0)