1
0

2 Incheckningar 6f38313345 ... 40a46e676d

Upphovsman SHA1 Meddelande Datum
  clanker 40a46e676d feat(installer): add Alpine Linux support and fix missing dependencies 4 dagar sedan
  clanker 0f84d2c3cb fix(installer): set XDG_DATA_DIRS for vala builds and add missing deps 5 dagar sedan

+ 17 - 0
containers/alpine/Dockerfile

@@ -0,0 +1,17 @@
+FROM alpine:latest
+
+# Install bash first (Alpine uses ash by default)
+RUN apk add --no-cache bash
+
+# Copy the installer
+COPY install-builddir/install-usm.sh /tmp/install-usm.sh
+RUN chmod +x /tmp/install-usm.sh
+
+# Run the installer non-interactively
+RUN /tmp/install-usm.sh -y
+
+# Clean up installer
+RUN rm /tmp/install-usm.sh
+
+# Default command
+CMD ["/usr/bin/usm"]

+ 14 - 0
containers/debian/Dockerfile

@@ -0,0 +1,14 @@
+FROM debian:latest
+
+# Copy the installer
+COPY install-builddir/install-usm.sh /tmp/install-usm.sh
+RUN chmod +x /tmp/install-usm.sh
+
+# Run the installer non-interactively
+RUN /tmp/install-usm.sh -y
+
+# Clean up installer
+RUN rm /tmp/install-usm.sh
+
+# Default command
+CMD ["/usr/bin/usm"]

+ 14 - 0
containers/fedora/Dockerfile

@@ -0,0 +1,14 @@
+FROM fedora:latest
+
+# Copy the installer
+COPY install-builddir/install-usm.sh /tmp/install-usm.sh
+RUN chmod +x /tmp/install-usm.sh
+
+# Run the installer non-interactively
+RUN /tmp/install-usm.sh -y
+
+# Clean up installer
+RUN rm /tmp/install-usm.sh
+
+# Default command
+CMD ["/usr/bin/usm"]

+ 14 - 0
containers/ubuntu/Dockerfile

@@ -0,0 +1,14 @@
+FROM ubuntu:latest
+
+# Copy the installer
+COPY install-builddir/install-usm.sh /tmp/install-usm.sh
+RUN chmod +x /tmp/install-usm.sh
+
+# Run the installer non-interactively
+RUN /tmp/install-usm.sh -y
+
+# Clean up installer
+RUN rm /tmp/install-usm.sh
+
+# Default command
+CMD ["/usr/bin/usm"]

+ 11 - 0
installer/build_config.sh

@@ -81,6 +81,13 @@ build_invercargill_json() {
     
     pushd "$src_dir" >/dev/null || return 1
     
+    # Set PKG_CONFIG_PATH to find bundled Invercargill library
+    export PKG_CONFIG_PATH="$prefix/lib/pkgconfig:$prefix/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
+    
+    # Set XDG_DATA_DIRS for GObject Introspection and Vala to find .gir and .vapi files
+    # Include default system paths to ensure system vapi files are found
+    export XDG_DATA_DIRS="$prefix/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}:/usr/local/share:/usr/share"
+    
     # Configure with meson (force libdir=lib for consistency across platforms)
     if ! meson setup src builddir --prefix="$prefix" --libdir=lib -Ddefault_library=static >"$output_redirect" 2>&1; then
         log_error "Failed to configure Invercargill-Json"
@@ -121,6 +128,10 @@ build_usm() {
     # Set PKG_CONFIG_PATH to find bundled Invercargill libraries
     export PKG_CONFIG_PATH="$prefix/lib/pkgconfig:$prefix/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
     
+    # Set XDG_DATA_DIRS for GObject Introspection and Vala to find .gir and .vapi files
+    # Include default system paths to ensure system vapi files are found
+    export XDG_DATA_DIRS="$prefix/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}:/usr/local/share:/usr/share"
+    
     # Configure with meson (USM's meson.build is at root, force libdir=lib for consistency)
     if ! meson setup builddir --prefix="$prefix" --libdir=lib >"$output_redirect" 2>&1; then
         log_error "Failed to configure USM"

+ 6 - 6
installer/main.sh

@@ -115,6 +115,12 @@ check_existing_installation() {
 
 # Main installation function
 run_installation() {
+    # Install system dependencies first (before extracting sources)
+    log_step "Checking system dependencies..."
+    if ! pm_install_missing_deps; then
+        show_error_and_exit "Failed to install system dependencies. Installation halted."
+    fi
+    
     # Set up temporary directory
     setup_temp_dir
     local extract_dir="$TEMP_DIR/sources"
@@ -126,12 +132,6 @@ run_installation() {
         show_error_and_exit "Failed to extract bundled sources"
     fi
     
-    # Install system dependencies
-    log_step "Checking system dependencies..."
-    if ! pm_install_missing_deps; then
-        show_error_and_exit "Failed to install system dependencies. Installation halted."
-    fi
-    
     # Build and install all components
     log_step "Building and installing components..."
     if ! build_all "$extract_dir" "$TARGET_DIR"; then

+ 58 - 0
installer/pm_apk.sh

@@ -0,0 +1,58 @@
+#!/bin/bash
+# pm_apk.sh - APK package manager implementation for Alpine Linux systems
+# 
+# To add a new package manager, create a file named pm_<name>.sh with:
+#   - pm_<name>_detect: Returns 0 if this PM is available, 1 otherwise
+#   - pm_<name>_get_missing_deps: Prints space-separated list of missing packages
+#   - pm_<name>_install_missing_deps: Installs the missing packages
+
+# Package names required by USM
+APK_DEPS="vala meson ninja pkgconf gcc musl-dev glib-dev libsodium-dev json-glib-dev libarchive-dev libgee-dev xz gobject-introspection gobject-introspection-dev"
+
+# Check if this package manager is available
+pm_apk_detect() {
+    command -v apk &>/dev/null
+}
+
+# Get list of missing dependencies
+pm_apk_get_missing_deps() {
+    local -a missing=()
+    
+    for pkg in $APK_DEPS; do
+        if ! apk info -e "$pkg" &>/dev/null; then
+            missing+=("$pkg")
+        fi
+    done
+    
+    echo "${missing[*]}"
+}
+
+# Install missing dependencies
+pm_apk_install_missing_deps() {
+    local missing=$(pm_apk_get_missing_deps)
+    
+    if [[ -z "$missing" ]]; then
+        log_info "All dependencies are already installed"
+        return 0
+    fi
+    
+    log_step "Installing packages via apk: ${missing}"
+    
+    local sudo=""
+    if ! is_root; then
+        sudo=$(get_sudo)
+    fi
+    
+    local apk_opts="--quiet"
+    if [[ "$ASSUME_YES" == "true" ]]; then
+        apk_opts="--quiet --force"
+    fi
+    
+    if [[ -n "$sudo" ]]; then
+        $sudo apk update
+        $sudo apk add $apk_opts $missing
+    else
+        apk update
+        apk add $apk_opts $missing
+    fi
+}

+ 1 - 1
installer/pm_apt.sh

@@ -7,7 +7,7 @@
 #   - pm_<name>_install_missing_deps: Installs the missing packages
 
 # Package names required by USM
-APT_DEPS="valac meson ninja-build git pkg-config gcc libglib2.0-dev libsodium-dev"
+APT_DEPS="valac meson ninja-build pkg-config gcc libglib2.0-dev libsodium-dev libjson-glib-dev libarchive-dev libgee-0.8-dev xz-utils gobject-introspection"
 
 # Check if this package manager is available
 pm_apt_detect() {

+ 2 - 0
installer/pm_base.sh

@@ -29,6 +29,7 @@ detect_package_manager() {
 # Get missing dependencies using the detected package manager
 pm_get_missing_deps() {
     case "$PM_TYPE" in
+        apk) pm_apk_get_missing_deps "$@" ;;
         apt) pm_apt_get_missing_deps "$@" ;;
         dnf) pm_dnf_get_missing_deps "$@" ;;
         *)
@@ -41,6 +42,7 @@ pm_get_missing_deps() {
 # Install missing dependencies using the detected package manager
 pm_install_missing_deps() {
     case "$PM_TYPE" in
+        apk) pm_apk_install_missing_deps "$@" ;;
         apt) pm_apt_install_missing_deps "$@" ;;
         dnf) pm_dnf_install_missing_deps "$@" ;;
         *)

+ 1 - 1
installer/pm_dnf.sh

@@ -7,7 +7,7 @@
 #   - pm_<name>_install_missing_deps: Installs the missing packages
 
 # Package names required by USM
-DNF_DEPS="vala meson ninja-build git pkgconf-pkg-config gcc glib2-devel libsodium-devel"
+DNF_DEPS="vala meson ninja-build pkgconf-pkg-config gcc glib2-devel libsodium-devel json-glib-devel libarchive-devel libgee-devel xz gobject-introspection"
 
 # Check if this package manager is available
 pm_dnf_detect() {