diff --git a/home/dot_zim/modules/passwordstore/init.zsh b/home/dot_zim/modules/passwordstore/init.zsh new file mode 100644 index 0000000..d32d271 --- /dev/null +++ b/home/dot_zim/modules/passwordstore/init.zsh @@ -0,0 +1,27 @@ +# modules-local/passwordstore/init.zsh + +# === Passwordstore async pull === +PASS_PULL_LOG="/tmp/passstore-pull.log" +PASS_PULL_LOCK="/tmp/passstore-pull.lock" + +# Fonction pour lancer le pull async +_passwordstore_async_pull() { + # Si le répertoire existe et qu'aucun pull n'est en cours + [[ -d "$PASSWORD_STORE_DIR" ]] || return + if [[ ! -f "$PASS_PULL_LOCK" ]]; then + # Création d'un lock pour éviter les pulls simultanés + touch "$PASS_PULL_LOCK" + ( + cd "$PASSWORD_STORE_DIR" || exit + # Vérifie la connectivité avant pull + if git ls-remote &>/dev/null; then + git pull --ff-only &> "$PASS_PULL_LOG" + fi + rm -f "$PASS_PULL_LOCK" + ) & disown + fi +} + +# Lancer au démarrage +_passwordstore_async_pull + diff --git a/home/dot_zim/modules/passwordstore/readonly_init.zsh.zwc b/home/dot_zim/modules/passwordstore/readonly_init.zsh.zwc new file mode 100644 index 0000000..33b8659 Binary files /dev/null and b/home/dot_zim/modules/passwordstore/readonly_init.zsh.zwc differ