mount and unmount commands added.
parent
dfe0b2d8b0
commit
9e91e4f05b
24
src/main.cr
24
src/main.cr
|
@ -60,6 +60,12 @@ class RootFS::Context
|
||||||
"restore" => ->(args : Array(String)){
|
"restore" => ->(args : Array(String)){
|
||||||
RootFS.load(args[0]).restore(args[1])
|
RootFS.load(args[0]).restore(args[1])
|
||||||
},
|
},
|
||||||
|
"mount" => ->(args : Array(String)){
|
||||||
|
RootFS.load(args[0]).mount(args[1]?)
|
||||||
|
},
|
||||||
|
"unmount" => ->(args : Array(String)){
|
||||||
|
RootFS.load(args[0]).unmount(args[1]?)
|
||||||
|
},
|
||||||
# FIXME: This needs access to the list of commands.
|
# FIXME: This needs access to the list of commands.
|
||||||
"help" => ->(args : Array(String)){
|
"help" => ->(args : Array(String)){
|
||||||
STDOUT << options_parser << "\n"
|
STDOUT << options_parser << "\n"
|
||||||
|
@ -168,13 +174,23 @@ class RootFS::RootFS
|
||||||
end
|
end
|
||||||
|
|
||||||
def mount(directory = nil)
|
def mount(directory = nil)
|
||||||
show!
|
if directory
|
||||||
puts "UNIMPLEMENTED: binding file systems here"
|
execute "mount --bind '#{directory}' '#{@directory}/#{directory}'"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
mount "/proc"
|
||||||
|
mount "/sys"
|
||||||
end
|
end
|
||||||
|
|
||||||
def unmount(directory = nil)
|
def unmount(directory = nil)
|
||||||
show!
|
if directory
|
||||||
puts "UNIMPLEMENTED: unbinding file systems here"
|
execute "umount '#{@directory}/#{directory}'"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
unmount "/proc"
|
||||||
|
unmount "/sys"
|
||||||
end
|
end
|
||||||
|
|
||||||
def show!
|
def show!
|
||||||
|
|
Loading…
Reference in New Issue