mfm/src/models/filesystems/gocryptfs_config.cr

47 lines
1.1 KiB
Crystal
Raw Normal View History

# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
require "shellwords"
2023-11-26 16:05:01 +01:00
require "./abstract_config"
require "./concerns/mount_wrapper"
require "./concerns/mounted"
require "./concerns/mount"
require "./concerns/umount"
require "./concerns/mount_point"
2023-11-26 16:05:01 +01:00
module GX::Models::Filesystems
class GoCryptFSConfig < AbstractConfig
getter encrypted_path : String = ""
2023-11-26 16:05:01 +01:00
include Concerns::Mount
include Concerns::Mounted
include Concerns::MountPoint
include Concerns::MountWrapper
include Concerns::Umount
def _mounted_prefix()
"#{encrypted_path}"
end
def mounted_name()
"#{@name}.Open"
end
def _mount_action()
mount_point_safe = @mount_point
raise InvalidMountpointError.new("Invalid mount point") if mount_point_safe.nil?
process = Process.new(
"gocryptfs",
["-idle", "15m", @encrypted_path, mount_point_safe],
input: STDIN,
output: STDOUT,
error: STDERR
)
return process.wait
end
end
end