diff --git a/pihole-cloudsync.sh b/pihole-cloudsync.sh index 82e4b7e..8195233 100755 --- a/pihole-cloudsync.sh +++ b/pihole-cloudsync.sh @@ -41,23 +41,45 @@ do cd $pihole_dir || exit cp $ad_list $black_list $blacklist_list $whitelist_list $regex_list $personal_git_dir cd $personal_git_dir || exit - + CHANGED=$(git --work-tree=$personal_git_dir status --porcelain) if [ -n "${CHANGED}" ]; then echo 'changed'; else - echo 'not changed'; + echo 'Remote repo matches local Pi-hole lists. No further action required.'; + exit 0 fi # Pull / Download elif [ "$arg" == "--pull" ] || [ "$arg" == "--download" ] || [ "$arg" == "-d" ] then echo "Pull (Download) argument detected." + cd $personal_git_dir || exit + CHANGED=$(git --work-tree=$personal_git_dir status --porcelain) + if [ -n "${CHANGED}" ]; then + echo 'changed'; + else + echo 'Local Pi-hole lists match remote repo. No further action required.'; + exit 0 + fi # Help elif [ "$arg" == "--help" ] || [ "$arg" == "-h" ] then - echo "Help argument detected." + cat << EOF +Usage: pihole-cloudsync