PepMiniiso/PepDeb32/BldHelper-release.sh

73 lines
2.8 KiB
Bash
Raw Normal View History

2023-03-28 12:48:46 +00:00
#!/bin/bash
# BldHelper-release.sh
# This script is meant to be run on the build server and expects to find and update itself from adjacent repos.
# From PepDistroConfigs, these repos are ../PepProPixMaps & ../PepProTools and are vital to having a working build.
### ## # Set build working variables HERE # ## ###
PREFIX=PepMini # Sets a unique final name of the ISO and checksum so <HouseKeeping> only removes 2 files .
SUFFIX=i386 # Also used by <HouseKeeping>. And to distinguish between amd64 and x86 or devuan and ubuntu .
2023-03-28 14:46:25 +00:00
BUILD=PepDeb32 # Sets which pepbld.sh to use and the location in /var/www/html/[release|rc|testing|nightly|unstable]
2023-03-28 12:48:46 +00:00
##################################################
### ## # Make NO Edits Below This Line !! # ## ###
##################################################
TODAY=$(date -u +"%Y-%m-%d") && export TODAY # If MasterBuilder.sh is used IT will set the date. If not used, we set it here.
FileName="${PREFIX}-${SUFFIX}" # This will give a uniquely named and dated ISO and checksum for <HouseKeeping>.
2023-03-28 14:46:25 +00:00
LOCATION=/var/www/html/nightly/PepMini/${BUILD} # Tells <HouseKeeping> and the script which 2 files to remove and where to put them.
2023-03-28 12:48:46 +00:00
LogDir=/var/log/Live-Build # This folder contains a log for the last $[PREFIX]-$[SUFFIX] build.
2023-03-28 14:30:31 +00:00
WorkingDir=/home/pepadmin/PepMini/PepDeb32 #* If we change servers or locations T*H*I*S line is the O*N*L*Y line to change. *
2023-03-28 12:48:46 +00:00
OutFile="/tmp/${PREFIX}${SUFFIX}.out"
LogFile="${LogDir}/${PREFIX}-${SUFFIX}-${BUILD}.log"
_cache="./cache"
_break=0 ; _wait=30 # Time (in seconds) to wait
2023-03-28 13:28:50 +00:00
cd ${WorkingDir}
2023-03-28 12:48:46 +00:00
# Run the build script.
2023-03-28 14:30:31 +00:00
./pepbld.sh 2>&1 | tee -a ${OutFile}
2023-03-28 12:48:46 +00:00
# Timing matters, don't destroy the old one without a replacement.
# Check for the ISO to appear and wait for things to settle.
until [ -e fusato/*.iso ]
do ((++_break))
[ $_break -gt $_wait ] && break || sleep 1
done
if [ ${_break} -lt ${_wait} ] ; then
mv fusato/*.iso fusato/${FileName}.iso
# Make the checksum file.
cd fusato
echo "# ${FileName} ${TODAY}" > ${FileName}-sha512.checksum
sha512sum ${FileName}.iso >> ${FileName}-sha512.checksum
### <HouseKeeping>
# Remove the previous files in ${LOCATION} .
rm -f ${LOCATION}/${FileName}*.iso
rm -f ${LOCATION}/${FileName}*-sha512.checksum
#rm -f ${LOCATION}/${FileName}*.torrent
#mv $(FileName}* ${LOCATION}/
mv ${FileName}.iso ${LOCATION}/${FileName}.iso
mv ${FileName}-sha512.checksum ${LOCATION}/${FileName}-sha512.checksum
# touch -t ${_stamp} ${LOCATION} ${LOCATION}/${FileName}*
touch ${LOCATION}/${FileName}*
# Clean the fusato folder
lb clean & rm -r *
2023-03-28 12:48:46 +00:00
# Move the log file to the log directory.
[ ! -e ${LogDir} ] && mkdir -p ${LogDir}
mv ${OutFile} ${LogFile}
### </HouseKeeping>
else echo -e "\n\tAfter $_break seconds, ISO never appeared.\n" | tee --append ${OutFile}
mv ${OutFile} ${LogFile}
fi