Some checks failed
Build Packages / Build libostree Backport (push) Failing after 0s
Build Packages / Build bootc Package (push) Has been skipped
Test Build / Test bootc Build (with existing libostree) (push) Failing after 0s
Build Packages / Create Release (push) Has been skipped
Build Packages / Create Artifacts for README Update (push) Has been skipped
199 lines
No EOL
4.5 KiB
Bash
Executable file
199 lines
No EOL
4.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Bootc Debian Package Builder
|
|
# Clones bootc source, applies compatibility patch, and builds .deb package
|
|
|
|
set -e
|
|
|
|
# Configuration
|
|
BOOTC_VERSION="1.5.1"
|
|
PACKAGE_VERSION="${BOOTC_VERSION}-1~noble1"
|
|
BOOTC_REPO="https://github.com/containers/bootc.git"
|
|
BUILD_DIR="/tmp/bootc-deb-build"
|
|
PATCH_FILE="bootc-libostree-compatibility.patch"
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Logging functions
|
|
log_info() {
|
|
echo -e "${BLUE}[INFO]${NC} $1"
|
|
}
|
|
|
|
log_success() {
|
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
|
}
|
|
|
|
log_warning() {
|
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
}
|
|
|
|
log_error() {
|
|
echo -e "${RED}[ERROR]${NC} $1" >&2
|
|
exit 1
|
|
}
|
|
|
|
# Check prerequisites
|
|
check_prerequisites() {
|
|
log_info "Checking prerequisites..."
|
|
|
|
# Check if we're in the right directory
|
|
if [ ! -f "debian/control" ]; then
|
|
log_error "debian/control not found. Please run this script from the bootc-deb repository root."
|
|
fi
|
|
|
|
# Check if patch file exists
|
|
if [ ! -f "$PATCH_FILE" ]; then
|
|
log_error "Patch file not found: $PATCH_FILE"
|
|
fi
|
|
|
|
# Check for required tools
|
|
for tool in dpkg-buildpackage cargo rustc pkg-config git; do
|
|
if ! command -v $tool &> /dev/null; then
|
|
log_error "Required tool not found: $tool"
|
|
fi
|
|
done
|
|
|
|
log_success "Prerequisites check passed."
|
|
}
|
|
|
|
# Clean previous builds
|
|
clean_build() {
|
|
log_info "Cleaning previous builds..."
|
|
rm -rf "$BUILD_DIR"
|
|
mkdir -p "$BUILD_DIR"
|
|
log_success "Build directory cleaned."
|
|
}
|
|
|
|
# Clone bootc source
|
|
clone_source() {
|
|
log_info "Cloning bootc source from GitHub..."
|
|
|
|
cd "$BUILD_DIR"
|
|
git clone --depth 1 --branch "v${BOOTC_VERSION}" "$BOOTC_REPO" "bootc-${BOOTC_VERSION}"
|
|
|
|
if [ ! -d "bootc-${BOOTC_VERSION}" ]; then
|
|
log_error "Failed to clone bootc source"
|
|
fi
|
|
|
|
log_success "Bootc source cloned successfully."
|
|
}
|
|
|
|
# Apply patch and prepare packaging
|
|
prepare_package() {
|
|
log_info "Preparing package..."
|
|
|
|
cd "$BUILD_DIR/bootc-${BOOTC_VERSION}"
|
|
|
|
# Apply our compatibility patch
|
|
log_info "Applying compatibility patch..."
|
|
patch -p1 < "../../$PATCH_FILE"
|
|
|
|
# Copy packaging files
|
|
log_info "Copying packaging files..."
|
|
cp -r ../../debian .
|
|
|
|
log_success "Package preparation completed."
|
|
}
|
|
|
|
# Install build dependencies
|
|
install_build_deps() {
|
|
log_info "Installing build dependencies..."
|
|
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
debhelper \
|
|
dh-cargo \
|
|
cargo \
|
|
rustc \
|
|
pkg-config \
|
|
libostree-dev \
|
|
libglib2.0-dev \
|
|
libgpgme-dev \
|
|
libssl-dev \
|
|
libcurl4-gnutls-dev \
|
|
libarchive-dev \
|
|
libfuse3-dev \
|
|
libsystemd-dev \
|
|
libmount-dev \
|
|
libselinux1-dev \
|
|
libavahi-client-dev \
|
|
libavahi-glib-dev \
|
|
libsoup-3.0-dev \
|
|
gobject-introspection \
|
|
gtk-doc-tools \
|
|
docbook-xml \
|
|
docbook-xsl \
|
|
xsltproc \
|
|
gjs \
|
|
libglib2.0-doc
|
|
|
|
log_success "Build dependencies installed."
|
|
}
|
|
|
|
# Build the package
|
|
build_package() {
|
|
log_info "Building bootc package..."
|
|
|
|
cd "$BUILD_DIR/bootc-${BOOTC_VERSION}"
|
|
|
|
# Build the package
|
|
log_info "Running dpkg-buildpackage..."
|
|
dpkg-buildpackage -us -uc -b
|
|
|
|
log_success "Package build completed."
|
|
}
|
|
|
|
# Copy results
|
|
copy_results() {
|
|
log_info "Copying build results..."
|
|
|
|
cd "$BUILD_DIR"
|
|
|
|
# Copy .deb files to current directory
|
|
cp *.deb ../
|
|
cp *.buildinfo ../ 2>/dev/null || true
|
|
cp *.changes ../ 2>/dev/null || true
|
|
|
|
log_success "Build results copied to: $(pwd)/.."
|
|
}
|
|
|
|
# Show results
|
|
show_results() {
|
|
echo
|
|
log_success "Bootc Debian package build completed successfully!"
|
|
echo
|
|
log_info "Created files:"
|
|
ls -la *.deb 2>/dev/null || log_warning "No .deb files found"
|
|
echo
|
|
log_info "To install the package:"
|
|
echo "sudo dpkg -i bootc_${PACKAGE_VERSION}_*.deb"
|
|
echo "sudo apt-get install -f"
|
|
echo
|
|
log_info "Or use the install script:"
|
|
echo "./install.sh"
|
|
}
|
|
|
|
# Main execution
|
|
main() {
|
|
log_info "Starting bootc Debian package build..."
|
|
log_info "Version: $PACKAGE_VERSION"
|
|
log_info "Source: $BOOTC_REPO"
|
|
log_info "Build directory: $BUILD_DIR"
|
|
|
|
check_prerequisites
|
|
clean_build
|
|
clone_source
|
|
prepare_package
|
|
install_build_deps
|
|
build_package
|
|
copy_results
|
|
show_results
|
|
}
|
|
|
|
# Run main function
|
|
main "$@" |