vaeth / zram-init

A wrapper script for the zram linux kernel module with zsh and openrc support
http://www.mathematik.uni-wuerzburg.de/~vaeth/download/index.html#zram-init
79 stars 26 forks source link

Fix issue with X-mount.mkdir mount option #36

Closed fabianoengler closed 3 years ago

fabianoengler commented 3 years ago

This fixes #35

My solution was to simply check if X-mount.mkdir was used and if so don't trigger the "is not a directory" error.

This patch works for me and I think it's "good enough" for such a corner case but I could envision more elaborate options, like zram-init handling the directory creation itself or perhaps to be more accurate explicitly check if $dir exists and is not a directory to trigger the error and only check for X-mount.mkdir if $dir is really not existent.

Also, using grep this way may no be the best portable way but I figure zram-init will be only used on modern linux distros anyway.

Thoughts?

vaeth commented 3 years ago

Indeed, I would have suggested to use the POSIX compatible "case" instead of an external program, and the use of a subshell is also unnecessary.

However, I solved the issue now differently by only checking for an absolute path instead of the actual presence of a directory.