POSIX fixes for #1464

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Ian Kaufman
2024-10-30 14:15:40 -07:00
committed by Jonathon Anderson
parent 795c44e650
commit f3a1b43360
5 changed files with 35 additions and 17 deletions

View File

@@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Replace `defaults.conf` with settings on the default profile. #917
- Switched from yaml.v2 to yaml.v3 #1462
- Make OCIBlobCache a seperate path and point it to `/var/cache` #1459
- Updated various shell scripts for POSIX compatibility. #1464
### Removed

View File

@@ -42,3 +42,4 @@
* Brandon Biggs <brandonsbiggs@gmail.com>
* Howard Van Der Wal <howard.a.vanderwal@protonmail.com> [@metalllinux](https://github.com/metalllinux)
* Nicholas Porter <nap23@unm.edu>
* Ian Kaufman [iankgt40](https://github.com/iankgt40)

View File

@@ -28,10 +28,10 @@ echo
chmod 755 /warewulf/wwinit
if [ -z "${WWROOT}" -o "${WWROOT}" == "initramfs" ]; then
if [ -z "${WWROOT}" -o "${WWROOT}" = "initramfs" ]; then
echo "Retaining initramfs and invoking /warewulf/wwinit..."
exec /warewulf/wwinit
elif [ "${WWROOT}" == "ramfs" -o "${WWROOT}" == "tmpfs" ]; then
elif [ "${WWROOT}" = "ramfs" -o "${WWROOT}" = "tmpfs" ]; then
echo "Setting up new ${WWROOT} rootfs..."
mkdir /newroot
mount wwroot /newroot -t ${WWROOT} -o mpol=interleave # mpol ignored for ramfs

18
overlays/wwinit/rootfs/warewulf/wwinit Normal file → Executable file
View File

@@ -4,14 +4,22 @@ echo "Hello from WWINIT"
. /warewulf/config
for i in /warewulf/init.d/*; do
NAME=`basename $i`
echo "Launching: $NAME"
sh "$i"
done
myPATH=/warewulf/init.d
while read -r NAME; do
# if [ -x $myPATH/$NAME ]
# then
echo "Launching: $NAME"
sh "$myPATH/$NAME"
# fi
done <<EOF
# `ls $myPATH/*.sh`
`ls $myPATH/`
EOF
echo "Calling $WWINIT..."
echo
sleep 2
exec $WWINIT

View File

@@ -3,13 +3,17 @@
set -e
TARGETS=${TARGETS:-"bin-x86_64-pcbios/undionly.kpxe bin-x86_64-efi/snponly.efi bin-arm64-efi/snponly.efi"}
TARGS="bin-x86_64-pcbios/undionly.kpxe
bin-x86_64-efi/snponly.efi
bin-arm64-efi/snponly.efi"
IPXE_BRANCH=${IPXE_BRANCH:-master}
DESTDIR=${DESTDIR:-/usr/local/share/ipxe}
CPUS=$(grep 'processor.*:' /proc/cpuinfo | wc -l)
function usage {
usage() {
echo "Usage: $(basename $0)
[-h] (help)
@@ -20,7 +24,7 @@ DESTDIR: ${DESTDIR}"
}
function main {
main() {
local DESTDIR=$(readlink -f ${DESTDIR})
while getopts 'h' c
@@ -39,8 +43,7 @@ function main {
cd ipxe/src
for target in ${TARGETS}
do
while read -r target; do
if $(echo "$target" | grep -q "\-arm64-")
then
if ! which aarch64-linux-gnu-gcc >/dev/null 2>&1
@@ -57,13 +60,17 @@ function main {
destname=$(echo $target | tr / -)
make -j $CPUS CROSS="${CROSS}" $target "$@" && cp -v $target ${DESTDIR}/${destname}
restore_config
done
done <<EOF
$TARGS
EOF
}
function configure_arm64 {
configure_arm64() {
# CONSOLE_SERIAL causes build failure for aarch64, so omitting here
# https://github.com/ipxe/ipxe/issues/658
ls -l config >> /root/args
sed -i.bak \
-e 's,//\(#define.*CONSOLE_FRAMEBUFFER.*\),\1,' \
config/console.h
@@ -76,7 +83,8 @@ function configure_arm64 {
}
function configure_x86_64 {
configure_x86_64() {
ls -l config >> /root/args
sed -i.bak \
-e 's,//\(#define.*CONSOLE_SERIAL.*\),\1,' \
-e 's,//\(#define.*CONSOLE_FRAMEBUFFER.*\),\1,' \
@@ -90,9 +98,9 @@ function configure_x86_64 {
}
function restore_config {
cp config/console.h{.bak,}
cp config/general.h{.bak,}
restore_config() {
cp config/console.h.bak config/console.h
cp config/general.h.bak config/general.h
}