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