diff --git a/system_setup/mount_ecrypt_home.sh b/system_setup/mount_ecrypt_home.sh index 0367822..537023a 100755 --- a/system_setup/mount_ecrypt_home.sh +++ b/system_setup/mount_ecrypt_home.sh @@ -99,7 +99,14 @@ systemd-run --user --unit=gocryptfs-home \ --property=TimeoutStopSec=30 \ gocryptfs -noprealloc -allow_other -passfile ${XDG_RUNTIME_DIR}/IPAVAULTKEY -config ${HOME}/.config/gocryptfs/gocryptfs.conf ${ENCRYPTEDDATADIR} ${DECRYPTEDDATADIR} >/dev/null RETVAL=$? -rm ${XDG_RUNTIME_DIR}/IPAVAULTKEY +# Service starts asynchronously - wait for the FUSE mount to appear before removing +# the passfile, otherwise gocryptfs may not have read it yet +_t=0 +while [ "${_t}" -lt 10 ] && ! grep -q "${DECRYPTEDDATADIR}" /proc/mounts 2>/dev/null; do + sleep 1 + _t=$((_t + 1)) +done +rm -f ${XDG_RUNTIME_DIR}/IPAVAULTKEY cd ${EXECDIR} if [ ${RETVAL} -eq 0 ]; then echo "Sucessfully mounted encrypted private Directory ${DECRYPTEDDATADIR}"