infra/roles/common/templates/update_omzsh.sh.j2

26 lines
676 B
Django/Jinja

#!/bin/bash
weird_omzsh_epoch=$(( $(date +%s)/ 60 / 60 / 24 ))
if [ -d "/home/{{ myusername }}/.oh-my-zsh" ]; then
(
echo "updating oh-my-zsh for {{ myusername }}"
cd /home/{{ myusername }}/.oh-my-zsh/
/usr/bin/sudo -u {{ myusername }} /usr/bin/git pull -q
echo $weird_omzsh_epoch > /home/{{ myusername }}/.oh-my-zsh/cache/.zsh-update
)
fi
if [ -d "/root/.oh-my-zsh" ] && [[ $EUID -eq 0 ]]; then
(
echo "updating oh-my-zsh for root"
cd /root/.oh-my-zsh/
/usr/bin/mkdir -p /root/.oh-my-zsh/cache
/usr/bin/git pull -q
echo $weird_omzsh_epoch > /root/.oh-my-zsh/cache/.zsh-update
)
fi