ExnixOS-BY-MR/eznixOS12X-calamares+debian.../eznixOS12X/BldHelper.sh

52 lines
1.4 KiB
Bash
Raw Normal View History

2023-11-19 18:09:38 -01:00
#!/bin/bash
################################################################################
# BldHelper.sh -- Revision: 12X -1 -- by Manuel rosa
# (GNU/General Public License version 3.0)
################################################################################
# Set environment variables
PREFIX=eznixOS12X
SUFFIX=amd64
BUILD=eznixOS12X
TODAY=$(date -u +"%Y-%m-%d")
FileName="${PREFIX}-${SUFFIX}"
LOCATION="/home/$SUDO_USER/out/${BUILD}"
LogDir="/home/$SUDO_USER/logs"
WorkingDir="/home/$SUDO_USER/eznixOS12X"
# Execute the ISO building script
cd ${WorkingDir}
./bldeznix12X.sh 2>&1 | tee /tmp/build_log.txt
# Move and rename the ISO file
cd eznixOS
mv *.iso ${FileName}-${TODAY}.iso
# Create the checksum file for the ISO
sha512sum ${FileName}-${TODAY}.iso > ${FileName}-${TODAY}-sha512.checksum
# Remove old ISO and checksum files from the desired location
rm -f ${LOCATION}/${FileName}*.iso
rm -f ${LOCATION}/${FileName}*-sha512.checksum
# Move the ISO and checksum files to the desired location
mkdir -p ${LOCATION}
mv ${FileName}-${TODAY}.iso ${LOCATION}
mv ${FileName}-${TODAY}-sha512.checksum ${LOCATION}
# Move the log file to the log directory (if it exists)
if [ -f /tmp/build_log.txt ]; then
LogFileName="${PREFIX}-${SUFFIX}-${BUILD}.log"
mv /tmp/build_log.txt ${LogDir}/${LogFileName}
fi
# Clean the build folder
lb clean
# Remove the "build" directory and its contents
cd ..
rm -rf eznixOS