Advertisement
shadowkat1010

Smart Automount

Jan 3rd, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. local address = ...
  2. local countFile = "/tmp/hddCount"
  3. local mountName = "/hdd"
  4.  
  5. if fs.exists(countFile) then
  6.  local fileHandle = io.open(countFile,"r")
  7.  local currentCount = tonumber(fileHandle:read("*a"))
  8.  fileHandle:close()
  9.  fs.mount(address,mountName..currentCount+1)
  10.  local fileHandle = io.open(countFile,"w")
  11.  fileHandle:write(tostring(currentCount+1))
  12.  fileHandle:close()
  13. else
  14.  local fileHandle = io.open(countFile,"w")
  15.  fileHandle:write("0")
  16.  fileHandle:close()
  17.  fs.mount(address,mountName.."0")
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement