#!/usr/bin/lua
local s6 = require("s6lua")

local skip_file = { ["/"] = true, ["none"] = true }
local skip_type = { proc = true, sysfs = true, devtmpfs = true, tmpfs = true, swap = true }

for _, entry in ipairs(s6.parse_fstab("/etc/fstab")) do
	if not skip_file[entry.file] and not skip_type[entry.vfstype] and entry.mntops ~= "noauto" then
		local ok = s6.run(string.format("mount %q", entry.file))
		if not ok then
			s6.log("mount-filesystems", "failed to mount %s", entry.file)
		end
	end
end
