scripts/src/commit-ebuild

78 lines
1.8 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# This file is part of scripts.
# scripts 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, version 3.
# scripts 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 scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
trap 'exit 128' INT
set -e
export PATH
FEATURES="sign"
export FEATURES
package_directory="$(git rev-parse --show-prefix)"
package="${package_directory%/}"
error_no_version() {
echo "[ERROR]: No version given"
echo " Ran with option: ${1}"
exit 1
}
git add .
case "${1}"
in
"" )
echo "[DEBUG]: no additional arguments/options given"
repoman commit
;;
-b | --bump )
echo "[DEBUG]: to be: ${package}: bump to ${2}"
if [ -n "${2}" ]
then
repoman commit -m "${package}: bump to ${2}"
else
error_no_version "${1}"
fi
;;
-d | --drop )
echo "[DEBUG]: to be: ${package}: drop old ${2}"
if [ -n "${2}" ]
then
repoman commit -m "${package}: drop old ${2}"
else
error_no_version "${1}"
fi
;;
-* )
echo "[ERROR]: Unknown option ${1}"
exit 1
;;
* )
echo "[DEBUG]: to be: ${package}: ${*}"
repoman commit -m "${package}: ${*}"
;;
esac