lib/linux_admin/partition.rb in linux_admin-0.5.4 vs lib/linux_admin/partition.rb in linux_admin-0.5.5
- old
+ new
@@ -5,18 +5,18 @@
require 'fileutils'
class LinuxAdmin
class Partition < LinuxAdmin
+ include Mountable
+
attr_accessor :id
attr_accessor :partition_type
- attr_accessor :fs_type
attr_accessor :start_sector
attr_accessor :end_sector
attr_accessor :size
attr_accessor :disk
- attr_accessor :mount_point
def initialize(args={})
@id = args[:id]
@size = args[:size]
@disk = args[:disk]
@@ -28,27 +28,11 @@
def path
"#{disk.path}#{id}"
end
- def format_to(filesystem)
- run!(cmd(:mke2fs),
- :params => { '-t' => filesystem, nil => self.path})
- @fs_type = filesystem
- end
-
def mount(mount_point=nil)
- @mount_point = mount_point
- @mount_point =
- "/mnt/#{disk.path.split(File::SEPARATOR).last}#{id}" if mount_point.nil?
- FileUtils.mkdir(@mount_point) unless File.directory?(@mount_point)
-
- run!(cmd(:mount),
- :params => { nil => [self.path, @mount_point] })
- end
-
- def umount
- run!(cmd(:umount),
- :params => { nil => [@mount_point] })
+ mount_point ||= "/mnt/#{disk.path.split(File::SEPARATOR).last}#{id}"
+ super(mount_point)
end
end
end