forked from tfgrid/zosbuilder
fix: Switch to space-separated sources.conf format
- Change from colon to space separation to avoid URL parsing issues - Update sources.conf format: TYPE NAME URL VERSION BUILD_FUNCTION [EXTRA] - Implement awk-based parsing for reliable field extraction - Fix firmware package list (remove unavailable linux-firmware-marvell)
This commit is contained in:
@@ -345,8 +345,13 @@ export TERM=xterm
|
||||
umask 022
|
||||
EOF
|
||||
|
||||
# Set root shell
|
||||
safe_execute chroot "$initramfs_dir" chsh -s /bin/sh root
|
||||
# Set root shell (if chsh is available)
|
||||
if chroot "$initramfs_dir" which chsh >/dev/null 2>&1; then
|
||||
safe_execute chroot "$initramfs_dir" chsh -s /bin/sh root
|
||||
else
|
||||
log_info "chsh not available in minimal Alpine, skipping shell change"
|
||||
log_info "Root shell defaults to /bin/sh in Alpine"
|
||||
fi
|
||||
|
||||
log_info "Alpine system configuration complete"
|
||||
}
|
||||
|
||||
@@ -34,28 +34,22 @@ function components_parse_sources_conf() {
|
||||
|
||||
local component_count=0
|
||||
|
||||
# Process each line in sources.conf
|
||||
while IFS=: read -r type name url version build_func extra; do
|
||||
# Skip comments and empty lines
|
||||
if [[ "$type" =~ ^[[:space:]]*# ]] || [[ -z "${type// }" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Trim whitespace
|
||||
type=$(echo "$type" | xargs)
|
||||
name=$(echo "$name" | xargs)
|
||||
url=$(echo "$url" | xargs)
|
||||
version=$(echo "$version" | xargs)
|
||||
build_func=$(echo "$build_func" | xargs)
|
||||
extra=$(echo "$extra" | xargs)
|
||||
# Process each line using awk for reliable parsing
|
||||
awk '!/^#/ && NF >= 5 {print $1, $2, $3, $4, $5, $6}' "$sources_file" | while read -r type name url version build_func extra; do
|
||||
|
||||
if [[ -z "$type" || -z "$name" || -z "$url" || -z "$version" || -z "$build_func" ]]; then
|
||||
log_warn "Skipping invalid line: ${type}:${name}:${url}:${version}:${build_func}:${extra}"
|
||||
log_warn "Skipping invalid line: ${type} ${name} ${url} ${version} ${build_func} ${extra}"
|
||||
continue
|
||||
fi
|
||||
|
||||
((component_count++))
|
||||
log_info "Processing component ${component_count}: ${name} (${type})"
|
||||
log_info " URL: ${url}"
|
||||
log_info " Version: ${version}"
|
||||
log_info " Build function: ${build_func}"
|
||||
if [[ -n "$extra" ]]; then
|
||||
log_info " Extra options: ${extra}"
|
||||
fi
|
||||
|
||||
# Download component
|
||||
case "$type" in
|
||||
@@ -74,7 +68,7 @@ function components_parse_sources_conf() {
|
||||
# Build and install component
|
||||
components_build_component "$name" "$build_func" "$components_dir"
|
||||
|
||||
done < "$sources_file"
|
||||
done
|
||||
|
||||
if [[ $component_count -eq 0 ]]; then
|
||||
log_warn "No components found in sources configuration"
|
||||
|
||||
@@ -163,34 +163,15 @@ function docker_run_build() {
|
||||
# Ensure build script is executable
|
||||
safe_execute chmod +x "${PROJECT_ROOT}/${script_path}"
|
||||
|
||||
# Setup container arguments with writable build directory
|
||||
local volume_args="-v ${PROJECT_ROOT}:/source:ro -v ${PROJECT_ROOT}/dist:/workspace/dist"
|
||||
local work_args="-w /workspace"
|
||||
|
||||
# Create dist directory on host if it doesn't exist
|
||||
safe_mkdir "${PROJECT_ROOT}/dist"
|
||||
|
||||
log_info "Executing build command in container: ${build_command}"
|
||||
log_info "Source (read-only): /source"
|
||||
log_info "Output (writable): /workspace/dist"
|
||||
|
||||
# Run container with script that copies source and builds
|
||||
# Run with privileged access for chroot mounts and system operations
|
||||
safe_execute ${CONTAINER_RUNTIME} run --rm \
|
||||
${volume_args} \
|
||||
${work_args} \
|
||||
--privileged \
|
||||
-v "${PROJECT_ROOT}:/workspace" \
|
||||
-w /workspace \
|
||||
"${image}" \
|
||||
/bin/bash -c "
|
||||
# Copy source to writable location
|
||||
cp -r /source/* /workspace/ 2>/dev/null || true
|
||||
chmod +x /workspace/scripts/build.sh
|
||||
|
||||
# Run build with proper paths
|
||||
cd /workspace
|
||||
${build_command}
|
||||
|
||||
# Copy results back
|
||||
cp -r /workspace/dist/* /workspace/dist/ 2>/dev/null || true
|
||||
"
|
||||
${build_command}
|
||||
}
|
||||
|
||||
# Commit container state for reuse
|
||||
|
||||
Reference in New Issue
Block a user