test new script

This commit is contained in:
Manuel 2023-05-23 10:45:50 +00:00
parent 2882d892eb
commit 48aa89c2b1
3 changed files with 115 additions and 66 deletions

View File

@ -8,79 +8,42 @@
# License: GPL-3.0-or-later # License: GPL-3.0-or-later
################################################################################ ################################################################################
### ## # Set build working variables HERE # ## ### # Set environment variables
PREFIX=PepMini
SUFFIX=dev-i386
BUILD=PepDev32
TODAY=$(date -u +"%Y-%m-%d")
FileName="${PREFIX}-${SUFFIX}"
LOCATION=/var/www/html/nightly/PepMini/${BUILD}
LogDir=/var/log/Live-Build
WorkingDir=/home/pepadmin/PepMini/PepDev32
PREFIX=PepMini # Sets a unique final name of the ISO and checksum so <HouseKeeping> only removes 2 files . # Execute the ISO building script
SUFFIX=i386 # Also used by <HouseKeeping>. And to distinguish between amd64 and x86 or devuan and ubuntu .
BUILD=PepDeb32 # Sets which pepbld.sh to use and the location in /var/www/html/[release|rc|testing|nightly|unstable]
##################################################
### ## # 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>.
LOCATION=/var/www/html/nightly/PepMini/${BUILD} # Tells <HouseKeeping> and the script which 2 files to remove and where to put them.
LogDir=/var/log/Live-Build # This folder contains a log for the last $[PREFIX]-$[SUFFIX] build.
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. *
OutFile="/tmp/${PREFIX}${SUFFIX}.out"
LogFile="${LogDir}/${PREFIX}-${SUFFIX}-${BUILD}.log"
_cache="./cache"
_break=0 ; _wait=30 # Time (in seconds) to wait
cd ${WorkingDir} cd ${WorkingDir}
./pepbld.sh
# Run the build script - expect 50 minutes, allow 60. # Move and rename the ISO file
./pepbld.sh 2>&1 | tee -a ${OutFile}
# 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 cd fusato
echo "# ${FileName} ${TODAY}" > ${FileName}-sha512.checksum mv *.iso ${FileName}-${TODAY}.iso
sha512sum ${FileName}.iso >> ${FileName}-sha512.checksum
### <HouseKeeping> # Create the checksum file for the ISO
# Remove the previous files in ${LOCATION} . sha512sum ${FileName}-${TODAY}.iso > ${FileName}-${TODAY}-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}
# Remove old ISO and checksum files from the desired location
rm -f ${LOCATION}/${FileName}*.iso rm -f ${LOCATION}/${FileName}*.iso
rm -f ${LOCATION}/${FileName}*-sha512.checksum rm -f ${LOCATION}/${FileName}*-sha512.checksum
#mv $(FileName}* ${LOCATION}/ # Move the log file to the log directory
mv ${FileName}.iso ${LOCATION}/${FileName}.iso
mv ${FileName}-sha512.checksum ${LOCATION}/${FileName}-sha512.checksum
touch ${LOCATION}/${FileName}*
lb clean &
# Move the log file to the log directory.
[ ! -e ${LogDir} ] && mkdir -p ${LogDir} [ ! -e ${LogDir} ] && mkdir -p ${LogDir}
mv ${OutFile} ${LogFile} mv /tmp/${PREFIX}${SUFFIX}.out ${LogDir}/${PREFIX}-${SUFFIX}-${BUILD}.log
# 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
### </HouseKeeping>
else echo -e "\n\tAfter $_break seconds, ISO never appeared.\n" | tee --append ${OutFile}
mv ${OutFile} ${LogFile}
fi
# Remove fusato folder content
rm -r cache
rm -r config
exit 0
# Remove old files from the cache
grep "Del " ${LogDir}/${PREFIX}-${SUFFIX}-${BUILD}.log | sort -u | cut -f2,3 -d" " | tr " " "_" | tr ":" "*" | tr "+" "*" | xargs -I {} find ./cache/packages.* -name "{}*.deb" -delete
# Remove the "fusato" directory and its contents
rm -rf fusato

View File

@ -0,0 +1,86 @@
#!/bin/bash
################################################################################
# Title: Bldhelper.sh
# Description: Script to build PeppermintOS ISO image
# Author: PeppermintOS Team <peppermintosteam@proton.me>
# Date: May 10, 2023
# License: GPL-3.0-or-later
################################################################################
### ## # 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 .
BUILD=PepDeb32 # Sets which pepbld.sh to use and the location in /var/www/html/[release|rc|testing|nightly|unstable]
##################################################
### ## # 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>.
LOCATION=/var/www/html/nightly/PepMini/${BUILD} # Tells <HouseKeeping> and the script which 2 files to remove and where to put them.
LogDir=/var/log/Live-Build # This folder contains a log for the last $[PREFIX]-$[SUFFIX] build.
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. *
OutFile="/tmp/${PREFIX}${SUFFIX}.out"
LogFile="${LogDir}/${PREFIX}-${SUFFIX}-${BUILD}.log"
_cache="./cache"
_break=0 ; _wait=30 # Time (in seconds) to wait
cd ${WorkingDir}
# Run the build script - expect 50 minutes, allow 60.
./pepbld.sh 2>&1 | tee -a ${OutFile}
# 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
#mv $(FileName}* ${LOCATION}/
mv ${FileName}.iso ${LOCATION}/${FileName}.iso
mv ${FileName}-sha512.checksum ${LOCATION}/${FileName}-sha512.checksum
touch ${LOCATION}/${FileName}*
lb clean &
# Move the log file to the log directory.
[ ! -e ${LogDir} ] && mkdir -p ${LogDir}
mv ${OutFile} ${LogFile}
# 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
### </HouseKeeping>
else echo -e "\n\tAfter $_break seconds, ISO never appeared.\n" | tee --append ${OutFile}
mv ${OutFile} ${LogFile}
fi
# Remove fusato folder content
rm -r cache
rm -r config
exit 0

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# #
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me) # SPDX-FileCopyrightText: 2023 PeppermintOS Team (peppermintosteam@proton.me)
PATH="/sbin:/usr/sbin:/usr/local/sbin:$PATH" PATH="/sbin:/usr/sbin:/usr/local/sbin:$PATH"