forked from colonelpanic/dotfiles
changes from ryzen-shine on Wed Jul 14 08:42:35 PM MDT 2021
This commit is contained in:
@@ -1,22 +1,30 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
echo "Syncing $1"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Syncing $2 at $1 with a default sync interval of $3"
|
||||
|
||||
# Initialize the directory
|
||||
if [ ! -d "$1" ]; then
|
||||
base="$(dirname $1)"
|
||||
mkdir -p "$base"
|
||||
cd "$base"
|
||||
git clone "$2" "$(basename $1)"
|
||||
fi
|
||||
|
||||
cd "$1"
|
||||
|
||||
counter=0
|
||||
while true; do
|
||||
changedFile=$(inotifywait ./ -r -e modify,move,create,delete --format "%w%f" --exclude '\.git' -t 60 2>/dev/null)
|
||||
changedFile=$(
|
||||
inotifywait ./ -r -e modify,move,create,delete \
|
||||
--format "%w%f" --exclude '\.git' -t $3 2>/dev/null
|
||||
)
|
||||
if [ -z "$changedFile" ]
|
||||
then
|
||||
counter=$((counter+1))
|
||||
if [ $counter -gt 4 ]; then
|
||||
git-sync
|
||||
counter=0
|
||||
else
|
||||
git-sync > /dev/null
|
||||
fi
|
||||
echo "Syncing due to timeout"
|
||||
git-sync -n -s
|
||||
else
|
||||
echo "Syncing for: $changedFile"
|
||||
{ git check-ignore "$changedFile" > /dev/null; } || git-sync
|
||||
{ git check-ignore "$changedFile" > /dev/null; } || git-sync -n -s
|
||||
fi
|
||||
done
|
||||
|
Reference in New Issue
Block a user