Compare commits

...

5 Commits

1 changed files with 25 additions and 7 deletions

View File

@ -1,6 +1,16 @@
#!/bin/sh -e
file_changed() {
if [ ! -f "$1" ]; then
if [ ! -f "$2" ]; then
return 0
else
return 1
fi
fi
if [ ! -f "$2" ]; then
return 1
fi
oldfilehash="$(sha1sum "$1" | awk '{print $1}')"
newfilehash="$(sha1sum "$2" | awk '{print $1}')"
[ "${oldfilehash}" != "${newfilehash}" ]
@ -30,16 +40,20 @@ fi
chmod 700 "${GNUPGHOME}"
for key in \
B5108C5A158A6608AD3361DA1573F6D8EFE4D0CF \
04ADEF85EA6AEC6F75941E84468BBEEBB9EC6AEA \
; do
if ! gpg --list-keys "${key}" >/dev/null 2>&1; then
# key does not exist yet
gpg --recv-keys "${key}"
gpg --keyserver pgp.mit.edu --recv-keys "${key}"
fi
done
echo "Verifying updates..."
git rev-list --format=oneline HEAD..origin | while IFS= read -r line; do
ref="origin/master"
diffref="${ref}"
if git rev-parse HEAD >/dev/null 2>&1; then
diffref="HEAD..${diffref}"
fi
git rev-list --format=oneline "${diffref}" | while IFS= read -r line; do
sha="$(echo "$line" | awk '{print $1}')"
title="$(echo "$line" | cut -f 1 -d ' ' --complement)"
printf " … $title\r "
@ -50,6 +64,14 @@ fi
fi
echo "✔"
done
echo "All commits passed, now applying updates..."
if git rev-parse HEAD >/dev/null 2>&1; then
git rebase "${ref}"
else
git checkout -f "${ref}"
fi
git submodule update --init
if file_changed "${HOME}/bin/update-profile" "home/bin/update-profile"; then
# Use new profile update script instead
@ -61,10 +83,6 @@ fi
fi
fi
echo "All commits passed, now applying updates..."
git rebase origin
git submodule update --init
echo "Running package installation..."
cd packages
./packages.sh