Skip to content

Instantly share code, notes, and snippets.

@seanrclayton
Created March 31, 2014 18:35
Show Gist options
  • Save seanrclayton/9899097 to your computer and use it in GitHub Desktop.
Save seanrclayton/9899097 to your computer and use it in GitHub Desktop.
require 'pp'
def mtab_look
mtab_filepaths = []
mtab = File.open("/etc/mtab", 'r').read
mtab.split("\n").each do |x|
unless x.match(/.\z/).to_s.include?("0")
mtab_filepaths << x.match(/\/\S*/).to_s
end
end
mtab_filepaths
end
def fstab_look
fstab_filepaths = []
fstab = File.open("/etc/fstab", 'r').read
fstab.split("\n").each do |x|
unless x.match(/\/\S*/).to_s.length < 2
fstab_filepaths << x.match(/\/\S*/).to_s
end
end
end
pp mtab_look
pp mtab_look.class
pp fstab_look.class
mtab_look.each do |x|
if fstab_look.include? x
puts "WARNING - #{x} will not be mounted at reboot!"
exit 1
else
puts "OK - All mounted entries will survice reboot"
exit 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment