new commit

This commit is contained in:
Manuel 2023-05-25 02:58:48 +00:00
parent a41ef2a3a5
commit 48ea8d5ed5
3 changed files with 119 additions and 87 deletions

View File

@ -1,87 +0,0 @@
#!/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=Pepserver # Sets a unique final name of the ISO and checksum so <HouseKeeping> only removes 2 files .
SUFFIX=amd64 # Also used by <HouseKeeping>. And to distinguish between amd64 and x86 or devuan and ubuntu .
BUILD=Deb # 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/PepOSServer/${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/PepOSServer/bookworm #* 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 --append ${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}" > ${FileName}-sha512.checksum
sha512sum ${FileName}.iso >> ${FileName}-sha512.checksum
### <HouseKeeping>
# Remove the previous files in ${LOCATION} .
rm -f ${LOCATION}/${PREFIX}-${SUFFIX}*.iso
rm -f ${LOCATION}/${PREFIX}-${SUFFIX}*-sha512.checksum
#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}*
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

67
bookworm/BldHelper.py Executable file
View File

@ -0,0 +1,67 @@
#!/usr/bin/env python3
################################################################################
# Title: Bldhelper.py
# Description: Script to build PeppermintOS ISO image
# Author: PeppermintOS Team <peppermintosteam@proton.me>
# Date: May 10, 2023
# License: GPL-3.0-or-later
################################################################################
import os
import shutil
import datetime
# Set environment variables
PREFIX = "Pepserver"
SUFFIX = "amd64"
BUILD = "Deb"
TODAY = datetime.datetime.utcnow().strftime("%Y-%m-%d")
FileName = f"{PREFIX}-{SUFFIX}"
LOCATION = "/var/www/html/nightly/PepMini/" + BUILD
LogDir = "/var/log/Live-Build"
WorkingDir = "/home/pepadmin/PepOSServer/bookworm"
# Execute the ISO building script
os.chdir(WorkingDir)
os.system("./pepbld.sh")
# Move and rename the ISO file
os.chdir("fusato")
iso_files = [f for f in os.listdir() if f.endswith(".iso")]
if len(iso_files) > 0:
shutil.move(iso_files[0], f"{FileName}-{TODAY}.iso")
# Create the checksum file for the ISO
iso_files = [f for f in os.listdir() if f.endswith(".iso")]
if len(iso_files) > 0:
iso_file = iso_files[0]
checksum_file = f"{FileName}-{TODAY}-sha512.checksum"
os.system(f"sha512sum {iso_file} > {checksum_file}")
# Remove old ISO and checksum files from the desired location
os.chdir(LOCATION)
old_files = [f for f in os.listdir() if f.startswith(FileName)]
for old_file in old_files:
os.remove(old_file)
# Move the ISO and checksum files to the desired location
os.chdir(os.path.join(WorkingDir, "fusato"))
if os.path.exists(LOCATION):
shutil.move(f"{FileName}-{TODAY}.iso", LOCATION)
shutil.move(f"{FileName}-{TODAY}-sha512.checksum", LOCATION)
else:
print(f"Location {LOCATION} does not exist")
# Move the log file to the log directory (if it exists)
log_file = f"/tmp/{PREFIX}{SUFFIX}.out"
if os.path.exists(log_file):
shutil.move(log_file, f"{LogDir}/{PREFIX}-{SUFFIX}-{BUILD}.log")
# Clean the build folder
os.system("lb clean")
# Remove the "fusato" directory and its contents
os.chdir(WorkingDir)
shutil.rmtree("fusato")

52
bookworm/BldHelper.sh Executable file
View File

@ -0,0 +1,52 @@
#!/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 environment variables
PREFIX=Pepserver
SUFFIX=amd64
BUILD=Deb
TODAY=$(date -u +"%Y-%m-%d")
FileName="${PREFIX}-${SUFFIX}"
LOCATION=/var/www/html/nightly/PepOSServer/${BUILD}
LogDir=/var/log/Live-Build
WorkingDir=/home/pepadmin/PepOSServer/bookworm
# Execute the ISO building script
cd ${WorkingDir}
./pepbld.sh
# Move and rename the ISO file
cd fusato
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)
if [ -f /tmp/${PREFIX}${SUFFIX}.out ]; then
mv /tmp/${PREFIX}${SUFFIX}.out ${LogDir}/${PREFIX}-${SUFFIX}-${BUILD}.log
fi
# Clean the build folder
lb clean
# Remove the "fusato" directory and its contents
cd ..
rm -rf fusato