profile/home/bin/update-profile

49 lines
1.2 KiB
Plaintext
Raw Normal View History

2018-02-18 22:03:58 +00:00
#!/bin/sh -e
2018-02-17 20:04:57 +00:00
if [ ! -d ~/.local/profile-git ]; then
mkdir -p ~/.local/profile-git
2018-02-17 20:04:57 +00:00
git clone --recursive https://git.icedream.tech/icedream/profile.git ~/.local/profile-git
fi
(
cd ~/.local/profile-git
echo "Fetching updates for profile..."
2018-02-18 22:41:14 +00:00
git fetch -p
# Synchronizing valid GPG keys
2018-02-18 22:41:24 +00:00
echo "Preparing for update verification..."
export GNUPGHOME="$HOME/.local/profile-data/gnupg"
mkdir -p "${GNUPGHOME}"
2018-02-18 22:41:07 +00:00
chmod 700 "${GNUPGHOME}"
gpg --fingerprint
gpg --recv-keys \
B5108C5A158A6608AD3361DA1573F6D8EFE4D0CF \
04ADEF85EA6AEC6F75941E84468BBEEBB9EC6AEA
2018-02-18 22:41:24 +00:00
echo "Verifying updates..."
2018-02-18 22:43:06 +00:00
git rev-list --format=oneline HEAD..origin | while IFS= read -r line; do
sha="$(echo "$line" | awk '{print $1}')"
title="$(echo "$line" | cut -f 1 -d ' ' --complement)"
printf " … $title\r "
if ! git verify-commit "$sha" >/dev/null 2>&1; then
echo "✘"
echo "Found incorrectly signed commit, NOT applying. Contact the maintainer on the issue tracker."
exit 1
fi
echo "✔"
done
echo "All commits passed, now applying updates..."
git rebase master
echo "Running package installation..."
cd packages
./packages.sh
echo "Running profile installation..."
cd ..
./install.sh
2018-02-17 20:04:57 +00:00
)