update build scripts

This commit is contained in:
Manuel 2023-05-10 02:57:47 +00:00
parent a60fb3bc2e
commit f8afae92a0
2 changed files with 145 additions and 136 deletions

View File

@ -1,77 +1,87 @@
#!/bin/bash
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me)
################################################################################
# Title: BldHelper-release.sh
# Description: 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.
# Author: PeppermintOS Team <peppermintosteam@proton.me>
# Date: May 10, 2023
# License: GPL-3.0-or-later
################################################################################
# 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
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="Dev" # Sets which pepbld.sh to use and the location in /var/www/html/[release|rc|testing|nightly|unstable]
### ## # 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.
./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
#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}*
# 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}
# Make sure the script is running as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
rm -r *
# Change to the working directory
cd /home/pepadmin/PepOSServer/daedalus
# Run the build script and redirect output to a log file
LogFile="/var/log/Live-Build/${PREFIX}-${SUFFIX}-${BUILD}.log"
./pepbld.sh &> $LogFile
# Set variables for file naming and location
TODAY=$(date -u +"%Y-%m-%d")
FileName="${PREFIX}-${SUFFIX}-${TODAY}"
LOCATION="/var/www/html/nightly/PepOSServer/${BUILD}"
OutFile="/tmp/${PREFIX}${SUFFIX}.out"
_cache="./cache"
_break=0 ; _wait=30
# Wait for the ISO to appear and move it to the correct location
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 previous files and move the new files to the correct location
rm -f ${LOCATION}/${PREFIX}-${SUFFIX}*.iso
rm -f ${LOCATION}/${PREFIX}-${SUFFIX}*sha512.checksum
mv ${FileName}.iso ${LOCATION}/${FileName}.iso
mv ${FileName}-sha512.checksum ${LOCATION}/${FileName}-sha512.checksum
touch ${LOCATION}/${FileName}*
# Clean up 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
# Clean up build artifacts
lb clean &>/dev/null
# Move the log file to the log directory
[ ! -e /var/log/Live-Build ] && mkdir -p /var/log/Live-Build
mv ${OutFile} ${LogFile}
else
echo -e "\n\tAfter $_break seconds, ISO never appeared.\n" | tee --append ${OutFile}
mv ${OutFile} ${LogFile}
fi
# Remove the fusato directory and its contents if it exists.
if [ -d "fusato" ]; then
rm -r fusato
fi
exit 0

View File

@ -1,64 +1,64 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me)
################################################################################
# Title: build_pepos.sh
# Description: Script to build the PeppermintOS Server ISO image
# Author: PeppermintOS Team <peppermintosteam@proton.me>
# Date: May 10, 2023
# License: GPL-3.0-or-later
################################################################################
PATH="/sbin:/usr/sbin:/usr/local/sbin:$PATH"
set -euo pipefail
# Set the working folder variable
uchinanchu="$(pwd)"
# Set the working folder variables
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
readonly WORK_DIR="$SCRIPT_DIR/fusato"
readonly CACHE_DIR="$WORK_DIR/cache"
readonly CHROOT_DIR="$WORK_DIR/chroot"
# This cleanup might be better served in the BldHelper*.sh script.
# Create the build folder, move into it removing stale mountpoints and files there.
[ -e fusato ] && [ ! -d fusato ] && rm -f fusato || [ ! -e fusato ] && mkdir fusato
cd fusato
umount $(mount | grep "${PWD}/chroot" | tac | cut -f3 -d" ") 2>/dev/null
for i in ./* ./.build ; do [ $i = ./cache ] && continue || rm -rf $i ; done
#Define as configurações do Live Build
lb config noauto \
--binary-images iso-hybrid \
--architectures amd64 \
--linux-flavours amd64 \
--distribution bookworm \
--archive-areas "main contrib non-free non-free-firmware" \
--apt-recommends true \
--security true \
--updates true \
--backports true \
--debian-installer live \
--debian-installer-distribution bookworm \
--debian-installer-gui true \
--parent-mirror-debian-installer http://repo.peppermintos.com/packages \
--iso-preparer "PeppermintOS-https://peppermintos.com/" \
--iso-publisher "Peppermint OS Team" \
--iso-volume "PepOS-server" \
--image-name "PepOS-Server" \
--debian-installer-preseedfile preseed.cfg \
--checksums sha512 \
--zsync false \
--win32-loader false \
"${@}"
# Creates the working directory and cleans any old files
mkdir -p "$WORK_DIR"
rm -rf "$CHROOT_DIR" "$CACHE_DIR"
# Define the Live Build settings
lb config \
--architectures amd64 \
--linux-flavours amd64 \
--distribution bookworm \
--archive-areas "main contrib non-free non-free-firmware" \
--apt-recommends true \
--security true \
--updates true \
--backports true \
--debian-installer live \
--debian-installer-distribution bookworm \
--debian-installer-gui true \
--parent-mirror-debian-installer http://repo.peppermintos.com/packages \
--win32-loader false \
--image-name "PepOS-Server" \
--iso-volume "PepOS-server" \
--iso-publisher "Peppermint OS Team" \
--iso-preparer "PeppermintOS-https://peppermintos.com/" \
--debian-installer-preseedfile "$SCRIPT_DIR/preseed.cfg" \
--binary-images iso-hybrid \
--checksums sha512 \
--no-auto \
"${@}"
# Setup the chroot structure
mkdir -p $uchinanchu/fusato/config/includes.installer
mkdir -p $uchinanchu/fusato/config/config/package-lists
mkdir -p $uchinanchu/fusato/config/includes.chroot
mkdir -p $uchinanchu/fusato/config/hooks/normal
mkdir -p $uchinanchu/fusato/config/archives
mkdir -p $uchinanchu/fusato/config/includes.binary
mkdir -p $uchinanchu/fusato/config/includes.chroot/boot/grub
mkdir -p $uchinanchu/fusato/config/includes.chroot/etc/default
mkdir -p $uchinanchu/fusato/config/includes.installer/usr/share
mkdir -p $uchinanchu/fusato/config/includes.chroot/etc
mkdir -p $uchinanchu/fusato/config/includes.chroot/etc/firewalld/zones
mkdir -p "$CHROOT_DIR/etc/default"
mkdir -p "$CHROOT_DIR/etc/firewalld/zones"
mkdir -p "$CHROOT_DIR/boot/grub"
mkdir -p "$CHROOT_DIR/usr/share"
mkdir -p "$WORK_DIR/config/includes.binary"
mkdir -p "$WORK_DIR/config/includes.chroot"
mkdir -p "$WORK_DIR/config/includes.installer"
mkdir -p "$WORK_DIR/config/hooks/normal"
mkdir -p "$WORK_DIR/config/archives"
mkdir -p "$WORK_DIR/config/config/package-lists"
# Install software
echo "#Install system packages.
cat << EOF > "$WORK_DIR/config/config/package-lists/package.list.chroot"
zonefstoolspep
dmzonedtoolspep
libzbdpep1
@ -84,23 +84,22 @@ cups
gvfs-backends
git
wget
EOF
" >> $uchinanchu/fusato/config/package-lists/package.list.chroot
# Copy single files and folder to the chroot
cp $uchinanchu/pepgrub/grub $uchinanchu/fusato/config/includes.chroot/etc/default
cp $uchinanchu/pephooks/normal/* $uchinanchu/fusato/config/hooks/normal
cp $uchinanchu/peprepo/* $uchinanchu/fusato/config/archives
cp $uchinanchu/pepfirewall/* $uchinanchu/fusato/config/includes.chroot/etc/firewalld/zones
cp $uchinanchu/pepinstaller/preseed/preseed.cfg $uchinanchu/fusato/config/includes.installer
cp "$SCRIPT_DIR/pepgrub/grub" "$WORK_DIR/config/includes.chroot/etc/default"
cp "$SCRIPT_DIR/pephooks/normal/*" "$WORK_DIR/config/hooks/normal"
cp "$SCRIPT_DIR/peprepo/*" "$WORK_DIR/config/config/archives"
cp "$SCRIPT_DIR/pepfirewall/*" "$WORK_DIR/config/includes.chroot/etc/firewalld/zones"
cp "$SCRIPT_DIR/pepinstaller/preseed/preseed.cfg" "$WORK_DIR/config/includes.installer"
# Copy recursive files and sub-directories, containing symlinks.
cp -r $uchinanchu/peploadersplash/boot $uchinanchu/fusato/config/includes.binary
cp -r $uchinanchu/peploadersplash/isolinux $uchinanchu/fusato/config/includes.binary
cp -r $uchinanchu/pepgrub/themes $uchinanchu/fusato/config/includes.chroot/boot/grub
cp -r $uchinanchu/pepinstaller/graphics $uchinanchu/fusato/config/includes.installer/usr/share
cp -r $uchinanchu/pepinstaller/themes $uchinanchu/fusato/config/includes.installer/usr/share
cp -r "$SCRIPT_DIR/peploadersplash/boot" "$WORK_DIR/config/includes.binary"
cp -r "$SCRIPT_DIR/peploadersplash/isolinux" "$WORK_DIR/config/includes.binary"
cp -r "$SCRIPT_DIR/pepgrub/themes" "$WORK_DIR/config/includes.chroot/boot/grub"
cp -r "$SCRIPT_DIR/pepinstaller/graphics" "$WORK_DIRconfig/includes.installer/usr/share"
cp -r "$SCRIPT_DIR/pepinstaller/themes" "$WORK_DIR/config/includes.installer/usr/share"
lb build
# Build the iso
lb build