#!/bin/bash -euE . pbs-plumb-shlib cmd=${0##*/} usage() { echo "Usage: $cmd [OPTIONS] REPO/PACKAGE" echo 'Creates a new package.' echo echo 'Options:' echo ' -h Show this message' } main() { while getopts 'h' arg; do case $arg in h) usage; return 0;; *) usage; return 1;; esac done shift $(($OPTIND - 1)) if [[ $# != 1 ]]; then usage return 1 fi local dest=$1 local package="${dest##*/}" cdto_pbs-root git submodule add ./ "${dest}" cd "${dest}" git checkout --orphan "packages/${package}" git remote set-branches origin "packages/${package}" git branch -D master git rm -rf . touch .pbs-package git add .pbs-package } main "$@"