add system update warning
This commit is contained in:
parent
b8a30a25a7
commit
3d841c8360
3 changed files with 43 additions and 1 deletions
|
@ -3,5 +3,25 @@ alias rm="garbage put"
|
|||
alias cm="chezmoi"
|
||||
alias kill-gpg-agent="gpgconf --kill gpg-agent"
|
||||
|
||||
ced() { chezmoi edit $1 && chezmoi -v apply }
|
||||
function ced() {
|
||||
# if the file doesn't exist, prompt to make a new one
|
||||
if [ ! -f "$1" ]; then
|
||||
read "?$1 doesn't exist.. create file? [yN] " yn
|
||||
case $yn in
|
||||
[Yy]* )
|
||||
echo "creating new file"
|
||||
install -D /dev/null $1
|
||||
echo "\n" > $1
|
||||
chezmoi add $1;;
|
||||
* )
|
||||
echo "nah"
|
||||
return;;
|
||||
esac
|
||||
fi
|
||||
|
||||
chezmoi edit $1
|
||||
echo "applying changes..."
|
||||
chezmoi apply
|
||||
}
|
||||
|
||||
cpush() { chezmoi git add . -- -A && chezmoi git commit -- -m "update" && chezmoi git push }
|
||||
|
|
21
dot_local/scripts/zsh/executable_check-update.zsh
Normal file
21
dot_local/scripts/zsh/executable_check-update.zsh
Normal file
|
@ -0,0 +1,21 @@
|
|||
function checkUpdate() {
|
||||
lastUpdateFile=$HOME/.config/last-system-update
|
||||
|
||||
if [ ! -f "$lastUpdateFile" ]; then
|
||||
echo "this system hasn't ever been updated using system-upgrade.sh"
|
||||
echo "run system-upgrade.sh now"
|
||||
return
|
||||
fi
|
||||
|
||||
lastUpdate=$(cat $lastUpdateFile)
|
||||
now=$(date "+%s")
|
||||
|
||||
if [ $(( $now - $lastUpdate > 604800 )) ]; then
|
||||
echo "this system hasn't been updated for over a week"
|
||||
echo "run system-upgrade.sh asap"
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
checkUpdate
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
source $HOME/.local/scripts/zsh/zsh-prelude.zsh
|
||||
source $HOME/.local/scripts/zsh/check-update.zsh
|
||||
|
||||
export LANG=en_US.UTF-8
|
||||
export ZSH="/home/michael/.oh-my-zsh"
|
||||
|
|
Loading…
Reference in a new issue