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
12 13 14 |
# File 'lib/synco/disk.rb', line 12 def self.available?(disk_name) File.exist?("/dev/disk/by-label/#{disk_name}") end |
.mount(path, disk_name = nil) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/synco/disk.rb', line 16 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
24 25 26 |
# File 'lib/synco/disk.rb', line 24 def self.unmount(path) system("sudo", "umount", path) end |