Class: Haconiwa::MountPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/haconiwa/mount_point.rb

Instance Method Summary collapse

Constructor Details

#initialize(point, options) ⇒ MountPoint

Returns a new instance of MountPoint.



3
4
5
6
7
8
9
# File 'lib/haconiwa/mount_point.rb', line 3

def initialize(point, options)
  @src = point
  @dest = options.delete(:to)
  @readonly = options.delete(:readonly)
  @fs = options.delete(:fs)
  @options = options
end

Instance Method Details

#apply!Object



19
20
21
22
23
24
25
26
# File 'lib/haconiwa/mount_point.rb', line 19

def apply!
  STDERR.puts to_command
  system to_command
  if @readonly
    STDERR.puts "mount --bind -o remount,ro #{@dest}"
    system "mount --bind -o remount,ro #{@dest}"
  end
end

#to_commandObject



11
12
13
14
15
16
17
# File 'lib/haconiwa/mount_point.rb', line 11

def to_command
  if @fs
    "mount -t #{@fs} #{@src} #{@dest}"
  else
    "mount --bind #{@src} #{@dest}"
  end
end