2023-05-13 17:24:13 -04:00
|
|
|
#!/usr/bin/env bash
|
2023-05-15 07:52:58 -04:00
|
|
|
set -exou pipefail
|
2023-05-13 17:24:13 -04:00
|
|
|
|
2023-05-21 15:09:52 -04:00
|
|
|
# Make sure our tmp directory exists
|
|
|
|
mkdir -p /tmp/strangerbot
|
|
|
|
|
2023-05-13 17:24:13 -04:00
|
|
|
TEMP_DIR=$(mktemp -d "repo-updater.XXXX" -p $XDG_RUNTIME_DIR)
|
|
|
|
pushd $TEMP_DIR
|
|
|
|
|
2023-05-15 22:36:03 -04:00
|
|
|
if git clone "$1" repo && pushd repo && git switch $2 && ./update.sh; then
|
|
|
|
git add -A
|
|
|
|
if git commit -S -m "Update flake/dependencies"; then
|
|
|
|
git push -u origin $2
|
|
|
|
else
|
|
|
|
echo "No changes made"
|
|
|
|
fi
|
2023-05-13 17:24:13 -04:00
|
|
|
else
|
2023-05-15 22:36:03 -04:00
|
|
|
echo "Update failed"
|
2023-05-13 17:24:13 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
popd
|
|
|
|
popd
|
|
|
|
rm -rf $TEMP_DIR
|