mikshaw
Group: Members
Posts: 4856
Joined: July 2004 |
|
Posted: Dec. 08 2005,06:16 |
|
So the subject came up on #dsl-chat a while ago about how to make it convenient to umount UCI applications, instead of having to browse to the file or remember where it's located. This little flua script will grab a list of .uci files from /etc/mtab and display them for you. Select a file and press umount to uninstall the program.
Code Sample | #!/bin/flua ww = 400 wh = 120 Fl_Widget.initializers = {textfont=15,labelfont=15,labelcolor=0,scrollbar_width=15} Fl_Window.initializers = {box=Boxtype.thin_down,color=15} Fl_Button.initializers = {box = Boxtype.thin_up, down_box = Boxtype.thin_down} tempfile = "/tmp/lsuci.tempfile"
w_main = Window{ww,wh,"UCI files mounted"}
file_list = Hold_Browser{10,10,ww-20,wh-50} refresh = Button{40,wh-30,80,20,"refresh"} function refresh.callback() execute("grep \".uci \" /etc/mtab|awk '{print $1}' >"..tempfile) file_list:load(tempfile) remove(tempfile) end umount = Button{ww-120,wh-30,80,20,"umount"} function umount.callback() if file_list.value > 0 then execute("mydsl-load "..file_list:text(file_list.value)) refresh.callback() end end
w_main.size_range(w_main,ww,wh) w_main.resizable = file_list refresh.callback() w_main:show()
|
EDIT: awk '{print $1}' /etc/mtab | grep .uci$ would probably be less likely to grab an inappropriate line.
-------------- http://www.tldp.org/LDP/intro-linux/html/index.html
|