home.sh update.

This commit is contained in:
Johannes Findeisen 2025-09-10 00:54:07 +02:00
commit 5b7b4ff27c

View file

@ -1,3 +1,13 @@
function _home_date() {
os_name=$(uname)
if [ "$os_name" = "FreeBSD" ]; then
hdate=$(date -r $1)
else
hdate=$(date -d @$1)
fi
return $hdate
}
function _home_help() {
echo "Available commands:"
echo ""
@ -15,7 +25,7 @@ function home() {
cd $OLDPWD
;;
help)
_foo_help
_home_help
;;
pull)
cd ~
@ -38,9 +48,9 @@ function home() {
last_update=$(stat -c %Y .lastupdate)
echo "Last configuration update: $last_update"
current_date=$(date +%s)
echo "Current date: $current_date"
echo "Current date: _home_date $current_date"
time_diff=$(($current_date-$last_update))
echo "Time difference: $time_diff"
echo "Time difference: $time_diff seconds."
if (( time_diff > 86400 )) || [ "$2" = "f" ]; then
echo "Updating home configuration..."
if git pull; then