Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook into SDDM close-down routine to ensure ZFS homedirs are unmount without hardcoded homedirs #102

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -8,16 +8,15 @@
# CAVEATS: Assumes that the user homedir is always /usr/home/[username]
# This will need to be fixed later
# ===============================
ulist=$(users)
for dir in $(ls /usr/home)
do
echo "${ulist}" | grep -q "${dir}"
if [ $? -ne 0 ] ; then
#User not logged in any more
mount | grep -q "on /usr/home/${dir} type zfs"
if [ $? -eq 0 ] ; then
#Homedir is a still-mounted ZFS dataset
zfs unmount -f /usr/home/${dir}
fi
fi
done

# Use last to get the last user logged in and grep for that users homedir pipe to text.
ulist=$(last | awk 'NR==1 {print $1}' | grep -f - /etc/passwd | cut -d":" -f6 | tee)

if [ $? -ne '0' ] ; then
# Safety
exit
else
# No errors good. Finally unmount the dataset
umount -R ${ulist}
zfs unmount -f ${ulist}
fi