PepMiniiso/PepDev32/BldHelper-release.sh

85 lines
3.1 KiB
Bash
Raw Normal View History

2023-03-28 12:48:46 +00:00
#!/bin/bash
2023-05-12 11:17:22 +00:00
################################################################################
# Title: Bldhelper.sh
2023-05-23 09:35:48 +00:00
# Description: Script to build PeppermintOS ISO image
2023-05-12 11:17:22 +00:00
# Author: PeppermintOS Team <peppermintosteam@proton.me>
# Date: May 10, 2023
# License: GPL-3.0-or-later
################################################################################
2023-03-28 12:48:46 +00:00
### ## # Set build working variables HERE # ## ###
2023-04-03 20:09:34 +00:00
PREFIX=PepMini # Sets a unique final name of the ISO and checksum so <HouseKeeping> only removes 2 files .
2023-04-03 21:07:07 +00:00
SUFFIX=dev-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=PepDev32 # 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-04-03 20:23:28 +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-04-03 20:23:28 +00:00
WorkingDir=/home/pepadmin/PepMini/PepDev32 #* 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-05-12 11:17:22 +00:00
# Run the build script - expect 50 minutes, allow 60.
2023-05-15 11:21:09 +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 ]
2023-05-23 10:29:23 +00:00
do ((break))
2023-05-12 11:17:22 +00:00
[ $_break -gt $_wait ] && break || sleep 1
2023-03-28 12:48:46 +00:00
done
if [ ${_break} -lt ${_wait} ] ; then
2023-05-12 11:17:22 +00:00
mv fusato/*.iso fusato/${FileName}.iso
2023-03-28 12:48:46 +00:00
2023-05-12 11:17:22 +00:00
# Make the checksum file.
cd fusato
2023-05-15 11:21:09 +00:00
echo "# ${FileName} ${TODAY}" > ${FileName}-sha512.checksum
2023-05-12 11:17:22 +00:00
sha512sum ${FileName}.iso >> ${FileName}-sha512.checksum
2023-03-28 12:48:46 +00:00
2023-05-12 11:17:22 +00:00
### <HouseKeeping>
# Remove the previous files in ${LOCATION} .
2023-05-15 11:21:09 +00:00
rm -f ${LOCATION}/${FileName}*.iso
rm -f ${LOCATION}/${FileName}*-sha512.checksum
2023-03-28 12:48:46 +00:00
2023-05-12 11:17:22 +00:00
#mv $(FileName}* ${LOCATION}/
mv ${FileName}.iso ${LOCATION}/${FileName}.iso
mv ${FileName}-sha512.checksum ${LOCATION}/${FileName}-sha512.checksum
touch ${LOCATION}/${FileName}*
2023-03-28 12:48:46 +00:00
2023-05-12 11:17:22 +00:00
lb clean &
2023-05-12 11:17:22 +00:00
# Move the log file to the log directory.
[ ! -e ${LogDir} ] && mkdir -p ${LogDir}
mv ${OutFile} ${LogFile}
2023-03-28 12:48:46 +00:00
2023-05-12 11:17:22 +00:00
# Remove old packages from the cache directory
for i in $(grep "Del " ${LogFile} | sort -u | cut -f2,3 -d" " | tr " " "_" | tr ":" "*" | tr "+" "*" )
do for j in $_cache/packages.*/${i}*.deb
do [ -e $j ] && rm $j
done
done
2023-05-11 11:10:34 +00:00
2023-05-12 11:17:22 +00:00
### </HouseKeeping>
2023-05-11 11:10:34 +00:00
2023-05-12 11:17:22 +00:00
else echo -e "\n\tAfter $_break seconds, ISO never appeared.\n" | tee --append ${OutFile}
mv ${OutFile} ${LogFile}
2023-05-23 09:08:34 +00:00
fi
# Remove fusato folder content
2023-05-23 09:35:48 +00:00
rm -r cache
rm -r config
2023-05-23 09:08:34 +00:00
exit 0
2023-05-23 09:35:48 +00:00