#!/usr/bin/env bash # Tool for converting between MXE patch files and git repos # Imports and exports patch files in "git format-patch" format. cmd=$1 pkg=$2 patch_name=${3:-1-fixes} setupEnv() { # MXE directory export mxedir=$(cd $(dirname $0) && cd .. && pwd) } function init_git { setupEnv make -C $mxedir init-git-$pkg } function export_patch { setupEnv make -C $mxedir export-patch-$pkg PATCH_NAME=${patch_name} } function import_patch { setupEnv make -C $mxedir import-patch-$pkg PATCH_NAME=${patch_name} } function import_all_patches { setupEnv make -C $mxedir import-all-patches-$pkg } case "$cmd" in init) init_git $pkg ;; import) import_patch $pkg ;; import-all) import_all_patches $pkg ;; export) export_patch $pkg ;; *) echo "Unrecognized command '${cmd}'" >&2 cat <