stuff
This commit is contained in:
42
update.sh
Executable file
42
update.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
source shellvaculib.bash
|
||||
|
||||
function v() {
|
||||
declare -a cmd=("$@")
|
||||
declare -p cmd >&2
|
||||
"${cmd[@]}"
|
||||
}
|
||||
|
||||
function nix_common() {
|
||||
v nix --show-trace -L -v "$@"
|
||||
}
|
||||
|
||||
what="${1-}"
|
||||
|
||||
if ! git diff --quiet --exit-code HEAD; then
|
||||
svl_die "there must be no changes in working tree to run this"
|
||||
fi
|
||||
|
||||
if [[ $what == 'flake' ]] || [[ -z $what ]]; then
|
||||
v nix flake update
|
||||
if ! git diff --quiet --exit-code HEAD -- flake.lock; then
|
||||
v git commit -m 'nix flake update' -- flake.lock
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $what == 'bandcamp-collection-downloader' ]] || [[ $what == 'bcd' ]] || [[ -z $what ]]; then
|
||||
tmpdir="$(mktemp -d)"
|
||||
trap '[[ -d $tmpdir ]] && rm -rf "$tmpdir"' EXIT
|
||||
commit_message_path="$tmpdir/commit_message.txt"
|
||||
nix_common run '.#stable.nix-update' -- bandcamp-collection-downloader --version=branch --flake --write-commit-message "$commit_message_path"
|
||||
# v cat "$commit_message_path"
|
||||
# exit 0
|
||||
if ! git diff --quiet --exit-code HEAD -- packages/bandcamp-collection-downloader; then
|
||||
mitmUpdate="$(nix_common build '.#bandcamp-collection-downloader.mitmCache.updateScript' --no-link --print-out-paths)"
|
||||
v "$mitmUpdate"
|
||||
nix_common build '.#bandcamp-collection-downloader' --no-link
|
||||
v git commit --file="$commit_message_path" packages/bandcamp-collection-downloader
|
||||
fi
|
||||
|
||||
rm -rf "$tmpdir"
|
||||
fi
|
Reference in New Issue
Block a user