forked from obel1x/fedora-OEMDRV
mount_ecrypt_home: wait for FUSE mount before removing passfile
systemd-run service mode returns as soon as the start request is accepted, before gocryptfs has read the passfile. Poll /proc/mounts for up to 10 seconds so the passfile is only removed after the mount is confirmed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user