#!/bin/bash # # Purpose : Keep coredesktop-dev current (run by CoreDesktop's `update`). # Never asks anything. set -e SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" COREDESKTOP="$HOME/.local/share/coredesktop" source "$COREDESKTOP/utils.sh" source "$SELF/lib/common.sh" PACKAGES=( shellcheck # make lint bats # make test tea # Gitea's CLI, for pull requests qemu-base # the smoketest's virtual machines libisoburn # xorriso, for the smoketest VM's cloud-init disk ) echo "Checking coredesktop-dev's packages..." install_packages "${PACKAGES[@]}" # A symlink, so each pull updates the command mkdir -p "$HOME/.local/bin" if [ "$(readlink "$HOME/.local/bin/coredesktop-dev")" != "$SELF/bin/coredesktop-dev" ]; then ln -sfn "$SELF/bin/coredesktop-dev" "$HOME/.local/bin/coredesktop-dev" echo "Linked ~/.local/bin/coredesktop-dev" fi # Refresh the working copy's pre-push hook, if it's ours and has changed load_config if [ -n "$WORKING_COPY" ] && is_coredesktop_clone "$WORKING_COPY"; then source "$SELF/lib/hooks.sh" hook="$(hook_path)" if hook_is_ours "$hook" && ! cmp -s "$SELF/hooks/pre-push" "$hook"; then install -m 755 "$SELF/hooks/pre-push" "$hook" echo "Updated the pre-push hook in $WORKING_COPY" fi fi