Module: Bandshell::LiveImage

Defined in:
lib/bandshell/live_image.rb

Class Method Summary collapse

Class Method Details

.mountpointObject



7
8
9
10
11
12
13
14
15
# File 'lib/bandshell/live_image.rb', line 7

def self.mountpoint
  if File.exist? '/etc/concerto/medium_path'
    IO.read('/etc/concerto/medium_path').chomp
  else
    # sane default for Debian Live-based systems
    # (as of 2013-04-24)
    '/lib/live/mount/medium'
  end
end

.readonly?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bandshell/live_image.rb', line 17

def self.readonly?
  # on a readonly file system this will fail
  if not File.exist? self.mountpoint
    true
  else
    begin
      f = Tempfile.new('test', self.mountpoint)
      f.close!
      false
    rescue 
      # if the tempfile creation bombs we assume readonly
      true
    end
  end
end