2023-10-29 08:58:26 -01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Title: Bldhelper.sh
|
|
|
|
# Description: Script to build My-distro ISO image
|
|
|
|
# Author: manuel rosa <manuelsilvarosa@gmail.com>
|
|
|
|
# Date: Outubro 29, 2023
|
|
|
|
# License: GPL-3.0-or-later
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Set environment variables
|
|
|
|
PREFIX=My-distro-devuan
|
|
|
|
SUFFIX=i386-pae
|
|
|
|
BUILD=dev-32-pae
|
2023-11-14 12:33:08 -01:00
|
|
|
TODAY=$(date -u +"%Y-%m-%d")
|
2023-10-29 08:58:26 -01:00
|
|
|
FileName="${PREFIX}-${SUFFIX}"
|
2023-11-01 11:51:16 -01:00
|
|
|
LOCATION="/home/$SUDO_USER/out/${BUILD}"
|
|
|
|
LogDir="/home/$SUDO_USER/logs"
|
|
|
|
WorkingDir="/home/$SUDO_USER/My-distro-configs/my-distro-devuan-32-pae"
|
2023-10-29 08:58:26 -01:00
|
|
|
|
|
|
|
# Execute the ISO building script
|
|
|
|
cd ${WorkingDir}
|
2023-11-10 21:19:30 -01:00
|
|
|
./build.sh 2>&1 | tee /tmp/build_log.txt
|
2023-10-29 08:58:26 -01:00
|
|
|
|
|
|
|
# Move and rename the ISO file
|
2023-10-29 09:41:33 -01:00
|
|
|
cd build
|
2023-10-29 08:58:26 -01:00
|
|
|
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)
|
2023-11-10 21:19:30 -01:00
|
|
|
if [ -f /tmp/build_log.txt ]; then
|
|
|
|
LogFileName="${PREFIX}-${SUFFIX}-${BUILD}.log"
|
|
|
|
mv /tmp/build_log.txt ${LogDir}/${LogFileName}
|
2023-10-29 08:58:26 -01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Clean the build folder
|
|
|
|
lb clean
|
|
|
|
|
2023-10-31 12:19:45 -01:00
|
|
|
# Remove the "build" directory and its contents
|
2023-10-29 08:58:26 -01:00
|
|
|
cd ..
|
2023-10-29 09:41:33 -01:00
|
|
|
rm -rf build
|