summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-11-23 10:03:01 +0000
committerTed Trask <ttrask01@yahoo.com>2009-11-23 10:03:01 +0000
commit99cc262c63fe6a8761f6d497bffe971b99391e2e (patch)
treec27e746fb478e495d91fb85b2b8ade04395e6f56
parente06ed76d43f8beeaeb761186a14511b6ca71633a (diff)
downloadacf-alpine-conf-99cc262c63fe6a8761f6d497bffe971b99391e2e.tar.bz2
acf-alpine-conf-99cc262c63fe6a8761f6d497bffe971b99391e2e.tar.xz
Fixed available media list to include boot media not in fstab.v0.3.16
-rw-r--r--Makefile2
-rw-r--r--lbu-model.lua13
2 files changed, 14 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 46f2411..4811aa0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
APP_NAME=alpine-conf
PACKAGE=acf-$(APP_NAME)
-VERSION=0.3.15
+VERSION=0.3.16
APP_DIST=\
lbu* \
diff --git a/lbu-model.lua b/lbu-model.lua
index 204d958..873d73d 100644
--- a/lbu-model.lua
+++ b/lbu-model.lua
@@ -39,12 +39,25 @@ end
local function availablemedias()
local medias = {}
+ local found = {}
+ -- First, look in fstab
local fstab = fs.read_file("/etc/fstab") or ""
for media in string.gmatch(fstab, "/media/(%w+)%s") do
if not string.find(media, "^cdrom") and not string.find(media, "^dvd") then
medias[#medias+1] = media
+ found[media] = true
end
end
+ -- Then, look in result of 'mount'
+ local f = io.popen("mount")
+ local mount = f:read("*a")
+ f:close()
+ for media in string.gmatch(mount, "/media/(%w+)%s") do
+ if not string.find(media, "^cdrom") and not string.find(media, "^dvd") and not found[media] then
+ medias[#medias+1] = media
+ end
+ end
+ table.sort(medias)
return medias
end