]> git.rmz.io Git - dotfiles.git/commitdiff
mbsync: update youtube hook
authorSamir Benmendil <me@rmz.io>
Sun, 25 Feb 2018 22:19:25 +0000 (22:19 +0000)
committerSamir Benmendil <me@rmz.io>
Sun, 25 Feb 2018 22:19:25 +0000 (22:19 +0000)
isync/post-sync.d/10-youtube
isync/sync-mail

index b6b0aba718cf06ca8fb842ba8f6f8d5ed76e3a90..0b0363c25f0e514fcf2b72635f146d52e4212816 100755 (executable)
@@ -1,13 +1,12 @@
 #!/usr/bin/env bash
 
-errno=$1
-mbsync_args=$*
-
-if [[ $errno -ne 0 ]]; then
+if [[ $mbsync_errno -ne 0 ]]; then
     echo "mbsync failed, ignoring post-sync commands." >&2
     exit
 fi
 
+mbsync_args=$*
+
 if [[ "$mbsync_args" != "gmail" ]]; then
     # only run for gmail account
     exit
@@ -29,7 +28,7 @@ for maildir in "${maildirs[@]}"; do
     # expand tilde
     maildir=${maildir/#~/$HOME}
 
-    if [[ -d "$maildir/$yt_src_mb" ]]; then
+    if [[ -d "$maildir/$yt_src_mb" ]]; then
         echo "No mailbox at '$maildir/$yt_src_mb'"
         continue
     fi
index 1bd0f521bb2cad34f0ea9be35f6682cffff76810..ef2ef45903bb9fdb9e9b8f29810c6f4e377efb73 100755 (executable)
@@ -2,18 +2,18 @@
 
 mbsync_args="$*"
 
-dir="$(dirname "${BASH_SOURCE[0]}")"
-config=$dir/config
+export dir="$(dirname "${BASH_SOURCE[0]}")"
+export config=$dir/config
 
 for hook in $(find $dir/pre-sync.d -type f -executable); do
-    "$hook" $errno $mbsync_args
+    "$hook" $mbsync_args
 done
 
 mbsync -c "$config" $mbsync_args
-errno=$?
+export mbsync_errno=$?
 
 for hook in $(find $dir/post-sync.d -type f -executable); do
-    "$hook" $errno $mbsync_args
+    "$hook" $mbsync_args
 done
 
-exit $errno
+exit $mbsync_errno