Commit 86f4ef40 authored by Ophélie Gagnard's avatar Ophélie Gagnard

automation/: Move installation/automation-script.sh to automation/. Add tools...

automation/: Move installation/automation-script.sh to automation/. Add tools to generate automation/automation-script.sh
parent 5f9aaa37
......@@ -33,16 +33,22 @@ URL_PATTERN="https://download.opensuse.org/repositories/home:/oph.nxd/Debian_11/
APT_UTILITY_PACKAGES="sudo wget tree"
INSTALL_DEPENDENCIES_PACKAGES="dracut-core dracut dracut-network"
UEFI_KEYS_DEPENDENCIES_PACKAGES="sbsigntool efitools python3"
PACKAGES_TO_SCAN="
hello
tree
wget
gcc
"
APT_SPECIFIC_PACKAGES="${INSTALL_DEPENDENCIES_PACKAGES} ${UEFI_KEYS_DEPENDENCIES_PACKAGES}"
MCA_PACKAGE_FILE="${MCA_NAME_AND_VERSION}_amd64.deb"
FLUENTBIT_PACKAGE_FILE="${FLUENTBIT_NAME_AND_VERSION}_amd64.deb"
MCA_PACKAGE_URL=${URL_PATTERN}${MCA_PACKAGE_FILE}
FLUENTBIT_PACKAGE_URL=${URL_PATTERN}${FLUENTBIT_PACKAGE_FILE}
MCA_PACKAGE_URL="${URL_PATTERN}${MCA_PACKAGE_FILE}"
FLUENTBIT_PACKAGE_URL="${URL_PATTERN}${FLUENTBIT_PACKAGE_FILE}"
FLB_PATH=/opt/${FLUENTBIT_NAME_AND_VERSION}
MCA_PATH=/opt/${MCA_NAME_AND_VERSION}
MCA_CONF_PATH=${MCA_PATH}/etc
FLB_PATH="/opt/${FLUENTBIT_NAME_AND_VERSION}"
MCA_PATH="/opt/${MCA_NAME_AND_VERSION}"
MCA_CONF_PATH="${MCA_PATH}/etc"
echo -e "\nInstalling packages from Debian repositories...\n"
## Utility packages
......@@ -64,10 +70,10 @@ sed "${CONF_REGEX}" "${MCA_CONF_PATH}/flb.conf.in" > "${MCA_CONF_PATH}/flb.conf"
### SCAN THE DESIRED DIRECTORIES ###
BINARY=${MCA_PATH}/bin/metadata-collect-agent
FLB=${FLB_PATH}/bin/fluent-bit
FLB_PLUGIN=${MCA_PATH}/lib/libfluentbit_wendelin.so
FLB_CONF=${MCA_PATH}/etc/flb.conf
BINARY="${MCA_PATH}/bin/metadata-collect-agent"
FLB="${FLB_PATH}/bin/fluent-bit"
FLB_PLUGIN="${MCA_PATH}/lib/libfluentbit_wendelin.so"
FLB_CONF="${MCA_PATH}/etc/flb.conf"
LOG=/var/log/metadata_collect.log
PATH_TO_SCAN=/bin
......
#!/bin/bash
# This script is used to produce a reference database of filesystem scans in Wendelin.
# It automates the process of installing MCA on a KVM.
# It then scans some desired directories. No need to reboot to get a scan.
LOG_FILE=/var/log/test-script-deployment.log
# redirect stdout and stderr to $LOG_FILE
exec >> "$LOG_FILE" 2>&1
if [ -z "$WENDELIN_URL" ]; then
echo ERROR: Variable WENDELIN_URL undefined.
echo Exiting.
exit
fi
if [ -z "$WENDELIN_PWD" ]; then
echo ERROR: Variable WENDELIN_PWD undefined.
echo Exiting.
exit
fi
if [ -z "$WENDELIN_REFERENCE" ]; then
echo ERROR: Variable WENDELIN_REFERENCE undefined.
echo Exiting.
exit
fi
### INSTALL DEPENDENCIES ###
MCA_NAME_AND_VERSION=dep--mca--static_1-1
FLUENTBIT_NAME_AND_VERSION=dep--fluent-bit_1-1
URL_PATTERN="https://download.opensuse.org/repositories/home:/oph.nxd/Debian_11/amd64/"
APT_UTILITY_PACKAGES="%APT_UTILITY_PACKAGES%"
INSTALL_DEPENDENCIES_PACKAGES="%INSTALL_DEPENDENCIES_PACKAGES%"
UEFI_KEYS_DEPENDENCIES_PACKAGES="%UEFI_KEYS_DEPENDENCIES_PACKAGES%"
PACKAGES_TO_SCAN="
"
APT_SPECIFIC_PACKAGES="${INSTALL_DEPENDENCIES_PACKAGES} ${UEFI_KEYS_DEPENDENCIES_PACKAGES}"
MCA_PACKAGE_FILE="${MCA_NAME_AND_VERSION}_amd64.deb"
FLUENTBIT_PACKAGE_FILE="${FLUENTBIT_NAME_AND_VERSION}_amd64.deb"
MCA_PACKAGE_URL="${URL_PATTERN}${MCA_PACKAGE_FILE}"
FLUENTBIT_PACKAGE_URL="${URL_PATTERN}${FLUENTBIT_PACKAGE_FILE}"
FLB_PATH="/opt/${FLUENTBIT_NAME_AND_VERSION}"
MCA_PATH="/opt/${MCA_NAME_AND_VERSION}"
MCA_CONF_PATH="${MCA_PATH}/etc"
echo -e "\nInstalling packages from Debian repositories...\n"
## Utility packages
apt -y install $APT_UTILITY_PACKAGES
## Specific packages
apt -y install $APT_SPECIFIC_PACKAGES
## Packages to scan
apt -y install $PACKAGES_TO_SCAN
## Our own packages
echo -e "\nDownloading packages from OBS repositories...\n"
wget "$MCA_PACKAGE_URL"
wget "$FLUENTBIT_PACKAGE_URL"
echo -e "\nInstalling packages from OBS repositories...\n"
apt -y install "./$MCA_PACKAGE_FILE"
apt -y install "./$FLUENTBIT_PACKAGE_FILE"
CONF_REGEX="s|%WENDELIN_REFERENCE%|${WENDELIN_REFERENCE}|g;s|%WENDELIN_PWD%|${WENDELIN_PWD}|g"
sed "${CONF_REGEX}" "${MCA_CONF_PATH}/flb.conf.in" > "${MCA_CONF_PATH}/flb.conf"
### SCAN THE DESIRED DIRECTORIES ###
BINARY="${MCA_PATH}/bin/metadata-collect-agent"
FLB="${FLB_PATH}/bin/fluent-bit"
FLB_PLUGIN="${MCA_PATH}/lib/libfluentbit_wendelin.so"
FLB_CONF="${MCA_PATH}/etc/flb.conf"
LOG=/var/log/metadata_collect.log
PATH_TO_SCAN=/bin
echo -e "\nScanning and sending content in $PATH_TO_SCAN ...\n"
"$BINARY" "$PATH_TO_SCAN" "$FLB" "$FLB_PLUGIN" "$FLB_CONF" "$LOG"
PATH_TO_SCAN=/sbin
echo -e "\nScanning and sending content in $PATH_TO_SCAN ...\n"
"$BINARY" "$PATH_TO_SCAN" "$FLB" "$FLB_PLUGIN" "$FLB_CONF" "$LOG"
echo -e "\nBuild successful, connect to:\n"
#!/bin/bash
set -e
APT_UTILITY_PACKAGES="sudo wget tree"
INSTALL_DEPENDENCIES_PACKAGES="dracut-core dracut dracut-network"
UEFI_KEYS_DEPENDENCIES_PACKAGES="sbsigntool efitools python3"
PACKAGES_TO_SCAN="package-lists/001-generic_names"
PACKAGE_REGEX="s|%APT_UTILITY_PACKAGES%|$APT_UTILITY_PACKAGES|g;s|%INSTALL_DEPENDENCIES_PACKAGES%|$INSTALL_DEPENDENCIES_PACKAGES|g;s|%UEFI_KEYS_DEPENDENCIES_PACKAGES%|$UEFI_KEYS_DEPENDENCIES_PACKAGES|g;s|%PACKAGES_TO_SCAN%|$PACKAGES_TO_SCAN|g"
sed "$PACKAGE_REGEX" automation-script.sh.in.1 > automation-script.sh
cat "$PACKAGES_TO_SCAN" >> automation-script.sh
sed "$PACKAGE_REGEX" automation-script.sh.in.2 >> automation-script.sh
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment