home.sh update.
This commit is contained in:
parent
08cffcb17f
commit
04e4d59435
1 changed files with 21 additions and 13 deletions
|
|
@ -34,20 +34,28 @@ function home() {
|
|||
;;
|
||||
up)
|
||||
cd ~
|
||||
last_update=$(stat -c %Y .lastupdate)
|
||||
echo "Last configuration update: $last_update"
|
||||
current_date=$(date +%s)
|
||||
echo "Current date: $current_date"
|
||||
time_diff=$(($current_date-$last_update))
|
||||
echo "Time difference: $time_diff"
|
||||
if (( time_diff > 86400 )) || [ "$2" = "f" ]; then
|
||||
echo "Doing home up..."
|
||||
git pull
|
||||
git submodule update --init --recursive
|
||||
touch .lastupdate
|
||||
if test -f .lastupdate; then
|
||||
last_update=$(stat -c %Y .lastupdate)
|
||||
echo "Last configuration update: $last_update"
|
||||
current_date=$(date +%s)
|
||||
echo "Current date: $current_date"
|
||||
time_diff=$(($current_date-$last_update))
|
||||
echo "Time difference: $time_diff"
|
||||
if (( time_diff > 86400 )) || [ "$2" = "f" ]; then
|
||||
echo "Updating home configuration..."
|
||||
if git pull; then
|
||||
if git submodule update --init --recursive; then
|
||||
touch .lastupdate
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "/home/hanez was already updated in the last 24 hours."
|
||||
echo "Run this to force updating: home up f"
|
||||
fi
|
||||
else
|
||||
echo "/home/hanez was already updated in the last 24 hours."
|
||||
echo "Run this to force updating: home up f"
|
||||
echo "~/.lastupdate does not exist!"
|
||||
echo "Running: home up f now..."
|
||||
touch .lastupdate
|
||||
fi
|
||||
cd $OLDPWD
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue