data: Crear carpetas parientes a los archivos

This commit is contained in:
Cat /dev/Nulo 2022-06-18 21:27:20 -03:00
parent 24a1dd98a8
commit c660c192a0

View file

@ -1,3 +1,4 @@
local utils = require "../utils"
local t = require "../utils/templater"
local dirs = {}
@ -8,10 +9,12 @@ local function generate_mount_data()
if dir.type == "file" then
touch(dir.mountpoint)
string = string .. t([[
mkdir -p '{{dirname}}' || exit 1
touch -a '{{path}}' || exit 1
mount '{{path}}' '{{mountpoint}}' -o bind,umask=100,uid={{uid}},gid={{gid}} || exit 1
]],
dir
{ dirname = utils.dirname(dir.path),
path = dir.path, mountpoint = dir.mountpoint, uid = dir.uid, gid = dir.gid }
)
elseif dir.type == "dir" then
mkdir(dir.mountpoint)