Add update check for update-profile and use new script if possible.

master
Icedream 2018-02-19 09:46:08 +01:00
parent c03ddaadd5
commit a51d0ecbc5
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
1 changed files with 36 additions and 22 deletions

View File

@ -1,5 +1,11 @@
#!/bin/sh -e #!/bin/sh -e
file_changed() {
oldfilehash="$(sha1sum "$1" | awk '{print $1}')"
newfilehash="$(sha1sum "$2" | awk '{print $1}')"
[ "${oldfilehash}" != "${newfilehash}" ]
}
if [ ! -d ~/.local/profile-git ]; then if [ ! -d ~/.local/profile-git ]; then
mkdir -p ~/.local/profile-git mkdir -p ~/.local/profile-git
git clone --recursive https://git.icedream.tech/icedream/profile.git ~/.local/profile-git git clone --recursive https://git.icedream.tech/icedream/profile.git ~/.local/profile-git
@ -8,6 +14,8 @@ fi
( (
cd ~/.local/profile-git cd ~/.local/profile-git
if [ "${_CHECKOUT_DONE:-0}" -lt 1 ]; then
echo "Fetching updates for profile..." echo "Fetching updates for profile..."
git fetch -p git fetch -p
@ -34,6 +42,12 @@ fi
echo "✔" echo "✔"
done done
if file_changed "${HOME}/bin/update-profile" "home/bin/update-profile"; then
# Use new profile update script instead
_CHECKOUT_DONE=1 home/bin/update-profile
fi
fi
echo "All commits passed, now applying updates..." echo "All commits passed, now applying updates..."
git rebase origin git rebase origin