#!/bin/bash # mp-wrap | MatterLinux package build function wrapper # MatterLinux 2023-2024 (https://matterlinux.xyz) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . ############################# ## import common functions ## ############################# location="$(dirname "${0}")" location="$(realpath "${location}")" commonsh="$(echo "${location}" | sed 's/\/bin/\/lib/g')/mtsc-common.sh" source "${commonsh}" if [ "${?}" != "0" ]; then echo "Failed to import mtsc-common" exit 1 fi ################# ## main script ## ################# if [ -z "${1}" ]; then error "Package script not specified" exit 1 fi ninja(){ echo "[ninja wrapper] adding MAKEFLAGS" /usr/bin/ninja $MAKEFLAGS $@ } echo "running the PACKAGE() function" set -e source "${1}" PACKAGE ret="$?" set +e echo "PACKAGE() returned with code $ret" exit $ret