23 lines
719 B
Crystal
23 lines
719 B
Crystal
# 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>
|
|
|
|
module GX::Models::Concerns
|
|
module Umount
|
|
def umount() : Nil
|
|
mount_point_safe = @mount_point
|
|
raise InvalidMountpointError.new("Invalid mountpoint value") if mount_point_safe.nil?
|
|
|
|
system("fusermount -u #{mount_point_safe.shellescape}")
|
|
fusermount_status = $?
|
|
|
|
if fusermount_status.success?
|
|
puts "Models #{name} is now closed.".colorize(:green)
|
|
else
|
|
puts "Error: Unable to unmount filesystem #{name} (exit code: #{fusermount_status.exit_code}).".colorize(:red)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|