1
# Copyright 2008 Amazon.com, Inc. or its affiliates. All Rights
2
# Reserved. Licensed under the Amazon Software License (the
3
# "License"). You may not use this file except in compliance with the
4
# License. A copy of the License is located at
5
# http://aws.amazon.com/asl or in the "license" file accompanying this
6
# file. This file is distributed on an "AS IS" BASIS, WITHOUT
7
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
8
# the License for the specific language governing permissions and
9
# limitations under the License.
11
#------------------------------------------------------------------------------
12
# An abstraction of the File-System Table (fstab)
14
require 'ec2/amitools/version'
21
REGEX = /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*$/
22
attr_reader :device # mounted device.
23
attr_reader :mpoint # mount point.
24
attr_reader :fstype # file system type.
25
attr_reader :options # options
26
attr_reader :value # everything on line
28
def initialize(dev, mnt_point, fs_type, opts, line)
37
return nil if line[0,1] == '#'
38
if (m = REGEX.match(line))
40
return Entry.new(parts[0], parts[1], parts[2], parts[3], line.strip)
55
LOCATION = '/etc/fstab'
58
def initialize(filename = LOCATION)
60
f = File.new(filename, File::RDONLY)
61
rescue SystemCallError => e
62
raise FileError(filename, "could not open #{filename} to read file system table", e)
65
f.readlines.each do |line|
66
entry = Entry.parse(line)
67
@entries[entry.mpoint] = entry unless entry.nil?
77
# Supplied by: #{PKG_NAME}-#{PKG_VERSION}-#{PKG_RELEASE}
78
/dev/sda1 / ext3 defaults 1 1
79
/dev/sdb /mnt ext3 defaults 0 0
80
none /dev/pts devpts gid=5,mode=620 0 0
81
none /proc proc defaults 0 0
82
none /sys sysfs defaults 0 0
86
# Supplied by: #{PKG_NAME}-#{PKG_VERSION}-#{PKG_RELEASE}
87
/dev/sda1 / ext3 defaults 1 1
88
/dev/sda2 /mnt ext3 defaults 0 0
89
/dev/sda3 swap swap defaults 0 0
90
none /proc proc defaults 0 0
91
none /sys sysfs defaults 0 0