From 48aa89c2b1121d0f88a26cc23d464ff2be03a9cd Mon Sep 17 00:00:00 2001 From: Manuel Date: Tue, 23 May 2023 10:45:50 +0000 Subject: [PATCH] test new script --- PepDeb32/BldHelper-release.sh | 93 +++++++++------------------- PepDeb32/BldHelper-release.sh-backup | 86 +++++++++++++++++++++++++ PepDeb32/pepbld.sh | 2 +- 3 files changed, 115 insertions(+), 66 deletions(-) create mode 100755 PepDeb32/BldHelper-release.sh-backup diff --git a/PepDeb32/BldHelper-release.sh b/PepDeb32/BldHelper-release.sh index b60a884..83469d8 100755 --- a/PepDeb32/BldHelper-release.sh +++ b/PepDeb32/BldHelper-release.sh @@ -8,79 +8,42 @@ # 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 only removes 2 files . -SUFFIX=i386 # Also used by . 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 . -LOCATION=/var/www/html/nightly/PepMini/${BUILD} # Tells 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 +# Execute the ISO building script cd ${WorkingDir} +./pepbld.sh -# 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. +# Move and rename the ISO file cd fusato -echo "# ${FileName} ${TODAY}" > ${FileName}-sha512.checksum -sha512sum ${FileName}.iso >> ${FileName}-sha512.checksum +mv *.iso ${FileName}-${TODAY}.iso -### -# Remove the previous files in ${LOCATION} . +# Create the checksum file for the ISO +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}*-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. +# 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 - -### - -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 +mv /tmp/${PREFIX}${SUFFIX}.out ${LogDir}/${PREFIX}-${SUFFIX}-${BUILD}.log +# 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 diff --git a/PepDeb32/BldHelper-release.sh-backup b/PepDeb32/BldHelper-release.sh-backup new file mode 100755 index 0000000..b60a884 --- /dev/null +++ b/PepDeb32/BldHelper-release.sh-backup @@ -0,0 +1,86 @@ + #!/bin/bash + +################################################################################ +# Title: Bldhelper.sh +# Description: Script to build PeppermintOS ISO image +# Author: PeppermintOS Team +# 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 only removes 2 files . +SUFFIX=i386 # Also used by . 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 . +LOCATION=/var/www/html/nightly/PepMini/${BUILD} # Tells 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 + +### +# 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 + +### + +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 + + diff --git a/PepDeb32/pepbld.sh b/PepDeb32/pepbld.sh index 983ad47..62af7bc 100755 --- a/PepDeb32/pepbld.sh +++ b/PepDeb32/pepbld.sh @@ -1,7 +1,7 @@ #!/bin/bash # 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"