Files
dts-scripts/scripts/dts-boot
2024-09-17 10:09:14 +02:00

37 lines
1.1 KiB
Bash

#!/bin/bash
# SPDX-FileCopyrightText: 2024 3mdeb <contact@3mdeb.com>
#
# SPDX-License-Identifier: Apache-2.0
SBIN_DIR="/usr/sbin"
BIN_DIR="/usr/bin"
FUM_EFIVAR="/sys/firmware/efi/vars/FirmwareUpdateMode-d15b327e-ff2d-4fc1-abf6-c12bd08c1359"
log_filename="dts_$(dmidecode -s system-manufacturer)"
log_filename+=" $(dmidecode -s system-product-name)"
log_filename+=" $(dmidecode -s bios-version)"
uuid_string="$(cat /sys/class/net/$(ip route show default | head -1 | awk '/default/ {print $5}')/address)"
uuid_string+="_$(dmidecode -s system-product-name)"
uuid_string+="_$(dmidecode -s system-manufacturer)"
uuid=`uuidgen -n @x500 -N $uuid_string -s`
log_filename+="_$uuid"
log_filename+="_$(date +'%Y_%m_%d_%H_%M_%S_%N')"
log_filename="${log_filename// /_}"
log_filename="${log_filename//\//_}"
export DTS_FUNCS="$SBIN_DIR/dts-functions.sh"
export DTS_ENV="$SBIN_DIR/dts-environment.sh"
export DTS_SUBS="$SBIN_DIR/dts-subscription.sh"
export DTS_LOG_FILE="/tmp/${log_filename}"
if [ -d $FUM_EFIVAR ]; then
$SBIN_DIR/dasharo-deploy update fum
else
$BIN_DIR/script -c $SBIN_DIR/dts "$DTS_LOG_FILE"
fi