update: ask to install new scripts

This commit is contained in:
crater2150 2024-06-19 12:46:30 +02:00
parent f29fb956fd
commit 40e434d6b9

View file

@ -32,9 +32,24 @@ gitupdate() {
if [[ ! $skip ]] then if [[ ! $skip ]] then
# update scripts # update scripts
check "Updating scripts..." check "Updating scripts..."
local pre_update=$(git -C "$SCRIPTS_DIR" show-ref -s HEAD)
local result=$(gitupdate "$SCRIPTS_DIR" 2>&1) local result=$(gitupdate "$SCRIPTS_DIR" 2>&1)
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
succeed succeed
new_scripts=( $(git log --diff-filter=A --name-only --pretty= $pre_update..HEAD) )
if [[ -n $new_scripts ]]; then
echo "New scripts:"
for script in $new_scripts; do
echo " $script"
done
echo -n "Install new scripts? [y/n]"
if read -q; then
pushd $SCRIPTS_DIR
./install.sh $new_scripts
popd
fi
fi
exec "$0" "${ALL_ARGS[@]}" --skip-scripts exec "$0" "${ALL_ARGS[@]}" --skip-scripts
else else
fail "error during script updates" fail "error during script updates"