# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-set -ef
+set -e
FSLIST="@sysconfdir@/zfs/zfs-list.cache"
process_line() {
- # -o name
+ # zfs list -H -o name,...
+ # fields are tab separated
+ IFS="$(printf '\t')"
+ # protect against special characters in, e.g., mountpoints
+ set -f
+ set -- $1
dataset="${1}"
p_mountpoint="${2}"
p_canmount="${3}"
# Automatically generated by zfs-mount-generator
[Unit]
-SourcePath=${FSLIST}/${cachefile}
+SourcePath=${cachefile}
Documentation=man:zfs-mount-generator(8)
Before=local-fs.target zfs-mount.service
After=zfs-import.target
}
# Feed each line into process_line
-for cachefile in $(ls "${FSLIST}") ; do
+for cachefile in "${FSLIST}/"* ; do
while read -r fs ; do
- process_line $fs
- done < "${FSLIST}/${cachefile}"
+ process_line "${fs}"
+ done < "${cachefile}"
done