slitaz-tools view tinyutils/mountbox @ rev 708
Add: name[pt_BR] to desktop files
author | Claudinei Pereira <claudinei@slitaz.org> |
---|---|
date | Wed Mar 14 03:55:38 2012 -0300 (2012-03-14) |
parents | 8f5344170d2d |
children |
line source
1 #!/bin/sh
2 #
3 # Gtkdialog box for the mount/umount commands. Part of SliTaz tools.
4 # libmountbox: /usr/lib/slitaz/libmountbox
5 #
6 # (C) 2009 - SliTaz GNU/Linux project.
7 #
8 VERSION=20090802
9 # Mountbox is only for root.
10 if test $(id -u) != 0 ; then
11 exec subox mountbox
12 exit 0
13 fi
15 # Commom mount point in /mnt
16 mkdir -p /mnt/harddisk
18 # Just basic help.
19 export HELP='
20 <window title="Mountbox - Help" icon-name="help">
21 <vbox>
22 <text use-markup="true" width-chars="56">
23 <label>"
24 <b>SliTaz Mountbox - Help</b>"
25 </label>
26 </text>
28 <frame English>
29 <text wrap="true" use-markup="true">
30 <label>
31 "Mountbox lets you mount devices on mount points. A device
32 can be a cdrom, flash key, USB disk or local HD partition.
33 Mount points are generated from /media and /mnt. Simply
34 select an unmounted device. Then type or select a folder
35 to mount. Then press a button to mount a device.
36 "
37 </label>
38 </text>
39 </frame>
40 <frame Français>
41 <text wrap="true" use-markup="true">
42 <label>
43 "Mountbox permet de monter des périphériques (devices)
44 sur des points de montage. Un device peut être un cdrom,
45 une clé USB ou un disque dur local. La liste des points
46 de montage est généré depuis /media te /mnt.
47 "
48 </label>
49 </text>
50 </frame>
52 <hbox>
53 <button ok>
54 <action type="closewindow">HELP</action>
55 </button>
56 </hbox>
57 </vbox>
58 </window>'
60 # Mount and umount buttons with fields for device and mount points.
61 MAIN_DIALOG='
62 <window title="Mountbox" icon-name="media-flash">
63 <vbox>
64 <frame>
65 <tree>
66 <width>500</width><height>130</height>
67 <variable>DEVICE</variable>
68 <label>Umounted dev|Size|System|Type|Label|Boot|Start|End|Blocks|Id|UUID</label>
69 <input>/usr/lib/slitaz/libmountbox list-umounted</input>
70 <action>/usr/lib/slitaz/libmountbox umounted-fs-infos</action>
71 <action>refresh:MOUNTED</action>
72 <action>refresh:DEVICE</action>
73 </tree>
74 </frame>
75 <frame>
76 <tree>
77 <width>500</width><height>110</height>
78 <variable>MOUNTED</variable>
79 <label>Mounted fs|Size|Used|Available|Use%|Mounted on|Option</label>'
81 # /dev/root
82 RES=`df -h / | grep rootfs`
83 dev="/dev/root"
84 SIZE=`echo $RES | cut -d " " -f 2`
85 USED=`echo $RES | cut -d " " -f 3`
86 AVAILABLE=`echo $RES | cut -d " " -f 4`
87 PCT=`echo $RES | cut -d " " -f 5`
88 MOUNTED_ON=`echo $RES | cut -d " " -f 6`
89 if [ $SIZE != 0 ]; then
90 ROOT_ITEM="
91 <item icon=\"drive-harddisk\">$dev | $SIZE | $USED | $AVAILABLE | $PCT | $MOUNTED_ON</item>"
92 fi
93 MAIN_DIALOG=${MAIN_DIALOG}${ROOT_ITEM}
95 # Now we have rootfs and icons, list all mounted fs.
96 DEVICE='<input>/usr/lib/slitaz/libmountbox list-mounted</input>
97 <action>/usr/lib/slitaz/libmountbox mounted-fs-infos</action>
98 <action>refresh:MOUNTED</action>
99 <action>refresh:DEVICE</action>
100 </tree>
102 </frame>
104 <hbox>
105 <text use-markup="true" >
106 <label>"<b>Mount selected device on:</b>"</label>
107 </text>
108 <entry accept="directory">
109 <default>/media/cdrom</default>
110 <variable>MOUNT_POINT</variable>
111 </entry>
112 <button>
113 <label>Browse</label>
114 <input file icon="folder-open"></input>
115 <action type="fileselect">MOUNT_POINT</action>
116 </button>
117 </hbox>
118 '
120 # Get the mount points list.
121 MAIN_DIALOG=${MAIN_DIALOG}${DEVICE}
123 # Actions buttons (mount, umount, eject, etc).
124 ACTIONS='
126 <hbox>
127 <button>
128 <label>Mount</label>
129 <input file icon="edit-redo"></input>
130 <action>mkdir -p $MOUNT_POINT</action>
131 <action>mount $DEVICE $MOUNT_POINT</action>
132 <action>refresh:MOUNTED</action>
133 <action>refresh:DEVICE</action>
134 </button>
135 <button>
136 <label>Umount</label>
137 <input file icon="undo"></input>
138 <action>umount $MOUNT_POINT; sleep 1</action>
139 <action>refresh:MOUNTED</action>
140 <action>refresh:DEVICE</action>
141 </button>
142 <button>
143 <label>Device list</label>
144 <input file icon="reload"></input>
145 <action>refresh:DEVICE</action>
146 </button>
147 <button>
148 <label>Eject</label>
149 <input file icon="media-cdrom"></input>
150 <action>eject</action>
151 </button>
152 <button>
153 <label>Loop</label>
154 <input file icon="go-jump"></input>
155 <action>/usr/lib/slitaz/libmountbox loopmgr</action>
156 <action>refresh:MOUNTED</action>
157 <action>refresh:DEVICE</action>
158 </button>
159 <button>
160 <label>Crypto</label>
161 <input file icon="passwd"></input>
162 <action>/usr/lib/slitaz/libmountbox cryptomgr</action>
163 <action>refresh:DEVICE</action>
164 </button>
165 <button help>
166 <input file icon="help"></input>
167 <action type="launch">HELP</action>
168 </button>
169 <button>
170 <label>Quit</label>
171 <input file icon="exit"></input>
172 <action type="exit">Exit</action>
173 </button>
175 </hbox>
177 </vbox>
178 </window>'
180 export MAIN_DIALOG=${MAIN_DIALOG}${ACTIONS}
181 gtkdialog --center --program=MAIN_DIALOG >/dev/null
183 exit 0