snipe-it: Add options to the updater script
This adds an option to commit the changes including a link to the changelog and another option to disable building the package
This commit is contained in:
parent
78cb8e54f3
commit
5919729f46
1 changed files with 51 additions and 2 deletions
|
@ -1,5 +1,43 @@
|
||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#! nix-shell -I nixpkgs=../../../.. -i bash -p nix curl jq nix-update
|
#! nix-shell -I nixpkgs=../../../.. -i bash -p nix curl jq nix-update
|
||||||
|
# shellcheck shell=bash
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
usage () {
|
||||||
|
cat <<EOF
|
||||||
|
# Snipe-IT Updater
|
||||||
|
|
||||||
|
A small script to update Snipe-IT to the latest release
|
||||||
|
|
||||||
|
Usage: $(basename "$0") [options]
|
||||||
|
|
||||||
|
-h, --help Display this message and quit
|
||||||
|
-c, --commit Create a commit after updating
|
||||||
|
-n, --no-build Just update, don't build the package
|
||||||
|
|
||||||
|
This script needs composer2nix in your PATH.
|
||||||
|
https://github.com/svanderburg/composer2nix
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Parse command line arguments
|
||||||
|
while [ $# -ge 1 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-c|--commit)
|
||||||
|
COMMIT_CHANGES=true
|
||||||
|
;;
|
||||||
|
-d|--dont-build)
|
||||||
|
DONT_BUILD=true
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
# check if composer2nix is installed
|
# check if composer2nix is installed
|
||||||
if ! command -v composer2nix &> /dev/null; then
|
if ! command -v composer2nix &> /dev/null; then
|
||||||
|
@ -44,7 +82,18 @@ sed -e '7s/stdenv writeTextFile/stdenv lib writeTextFile/' \
|
||||||
echo "" >> composition.nix
|
echo "" >> composition.nix
|
||||||
echo "" >> php-packages.nix
|
echo "" >> php-packages.nix
|
||||||
|
|
||||||
cd ../../../..
|
if [ -z ${DONT_BUILD+x} ]; then
|
||||||
nix-build -A snipe-it
|
(
|
||||||
|
cd ../../../..
|
||||||
|
nix-build -A snipe-it
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$COMMIT_CHANGES" ]; then
|
||||||
|
git add .
|
||||||
|
git commit -m "snipe-it: $CURRENT_VERSION -> $TARGET_VERSION
|
||||||
|
|
||||||
|
https://github.com/snipe/snipe-it/releases/tag/v$TARGET_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
|
|
Loading…
Reference in a new issue