Module: Synco::LinuxDisk
- Defined in:
- lib/synco/disk.rb
Overview
Depending on how you have things set up, you’ll probably want to add %wheel ALL=(root) NOPASSWD: /bin/mount %wheel ALL=(root) NOPASSWD: /bin/umount to /etc/sudoers.d/synco
Class Method Summary collapse
Class Method Details
.available?(disk_name) ⇒ Boolean
27 28 29 |
# File 'lib/synco/disk.rb', line 27 def self.available?(disk_name) File.exist?("/dev/disk/by-label/#{disk_name}") end |
.mount(path, disk_name = nil) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/synco/disk.rb', line 31 def self.mount(path, disk_name = nil) if disk_name system("sudo", "mount", "-L", disk_name, path) else system("sudo", "mount", path) end end |
.unmount(path) ⇒ Object
39 40 41 |
# File 'lib/synco/disk.rb', line 39 def self.unmount(path) system("sudo", "umount", path) end |