Module: OSwitch::Linux
- Defined in:
- lib/oswitch.rb
Overview
Linux specific code.
Instance Method Summary collapse
- #gid ⇒ Object
-
#mountpoints ⇒ Object
Parse /proc/mounts for mountpoints.
- #uid ⇒ Object
Instance Method Details
#gid ⇒ Object
76 77 78 |
# File 'lib/oswitch.rb', line 76 def gid Process.gid end |
#mountpoints ⇒ Object
Parse /proc/mounts for mountpoints.
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/oswitch.rb', line 81 def mountpoints mtab = IO.readlines '/proc/mounts' mountpoints = mtab.map{ |line| line.split(/\s+/)[1]} mountpoints.map!{ |mount| unescape(mount) } # Ignore common system mountpoints. mountpoints.reject!{ |mount| mount =~ /^\/$/ } mountpoints.reject!{ |mount| mount =~ /^\/(proc|sys|usr|boot|tmp|dev|var|bin|etc|lib).*/ } # Mount /run/media/* but ignore other /run/ mountpoints. mountpoints.reject!{ |mount| mount =~ /^\/run.*/ unless mount =~ /^\/run\/(media.*)/ } # Add home dir. mountpoints << home end |
#uid ⇒ Object
72 73 74 |
# File 'lib/oswitch.rb', line 72 def uid Process.uid end |