slitaz-tools diff oldstuff/gtkdialog/mountbox @ rev 738
Moved all mountbox, burnbox, bootfloppybox to oldstuff/gtkdialog
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Apr 28 20:16:24 2012 +0200 (2012-04-28) |
parents | tinyutils/mountbox@0f5e3af5a51d |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/oldstuff/gtkdialog/mountbox Sat Apr 28 20:16:24 2012 +0200 1.3 @@ -0,0 +1,183 @@ 1.4 +#!/bin/sh 1.5 +# 1.6 +# Gtkdialog box for the mount/umount commands. Part of SliTaz tools. 1.7 +# libmountbox: /usr/lib/slitaz/libmountbox 1.8 +# 1.9 +# (C) 2009 - SliTaz GNU/Linux project. 1.10 +# 1.11 +VERSION=20090802 1.12 +# Mountbox is only for root. 1.13 +if test $(id -u) != 0 ; then 1.14 + exec subox mountbox 1.15 + exit 0 1.16 +fi 1.17 + 1.18 +# Commom mount point in /mnt 1.19 +mkdir -p /mnt/harddisk 1.20 + 1.21 +# Just basic help. 1.22 +export HELP=' 1.23 +<window title="Mountbox - Help" icon-name="help"> 1.24 +<vbox> 1.25 + <text use-markup="true" width-chars="56"> 1.26 + <label>" 1.27 +<b>SliTaz Mountbox - Help</b>" 1.28 + </label> 1.29 + </text> 1.30 + 1.31 + <frame English> 1.32 + <text wrap="true" use-markup="true"> 1.33 + <label> 1.34 +"Mountbox lets you mount devices on mount points. A device 1.35 +can be a cdrom, flash key, USB disk or local HD partition. 1.36 +Mount points are generated from /media and /mnt. Simply 1.37 +select an unmounted device. Then type or select a folder 1.38 +to mount. Then press a button to mount a device. 1.39 +" 1.40 + </label> 1.41 + </text> 1.42 + </frame> 1.43 + <frame Français> 1.44 + <text wrap="true" use-markup="true"> 1.45 + <label> 1.46 +"Mountbox permet de monter des périphériques (devices) 1.47 +sur des points de montage. Un device peut être un cdrom, 1.48 +une clé USB ou un disque dur local. La liste des points 1.49 +de montage est généré depuis /media te /mnt. 1.50 +" 1.51 + </label> 1.52 + </text> 1.53 + </frame> 1.54 + 1.55 + <hbox> 1.56 + <button ok> 1.57 + <action type="closewindow">HELP</action> 1.58 + </button> 1.59 + </hbox> 1.60 +</vbox> 1.61 +</window>' 1.62 + 1.63 +# Mount and umount buttons with fields for device and mount points. 1.64 +MAIN_DIALOG=' 1.65 +<window title="Mountbox" icon-name="media-flash"> 1.66 +<vbox> 1.67 + <frame> 1.68 + <tree> 1.69 + <width>500</width><height>130</height> 1.70 + <variable>DEVICE</variable> 1.71 + <label>Umounted dev|Size|System|Type|Label|Boot|Start|End|Blocks|Id|UUID</label> 1.72 + <input>/usr/lib/slitaz/libmountbox list-umounted</input> 1.73 + <action>/usr/lib/slitaz/libmountbox umounted-fs-infos</action> 1.74 + <action>refresh:MOUNTED</action> 1.75 + <action>refresh:DEVICE</action> 1.76 + </tree> 1.77 + </frame> 1.78 + <frame> 1.79 + <tree> 1.80 + <width>500</width><height>110</height> 1.81 + <variable>MOUNTED</variable> 1.82 + <label>Mounted fs|Size|Used|Available|Use%|Mounted on|Option</label>' 1.83 + 1.84 +# /dev/root 1.85 +RES=`df -h / | grep rootfs` 1.86 +dev="/dev/root" 1.87 +SIZE=`echo $RES | cut -d " " -f 2` 1.88 +USED=`echo $RES | cut -d " " -f 3` 1.89 +AVAILABLE=`echo $RES | cut -d " " -f 4` 1.90 +PCT=`echo $RES | cut -d " " -f 5` 1.91 +MOUNTED_ON=`echo $RES | cut -d " " -f 6` 1.92 +if [ $SIZE != 0 ]; then 1.93 + ROOT_ITEM=" 1.94 + <item icon=\"drive-harddisk\">$dev | $SIZE | $USED | $AVAILABLE | $PCT | $MOUNTED_ON</item>" 1.95 +fi 1.96 +MAIN_DIALOG=${MAIN_DIALOG}${ROOT_ITEM} 1.97 + 1.98 +# Now we have rootfs and icons, list all mounted fs. 1.99 +DEVICE='<input>/usr/lib/slitaz/libmountbox list-mounted</input> 1.100 + <action>/usr/lib/slitaz/libmountbox mounted-fs-infos</action> 1.101 + <action>refresh:MOUNTED</action> 1.102 + <action>refresh:DEVICE</action> 1.103 + </tree> 1.104 + 1.105 + </frame> 1.106 + 1.107 + <hbox> 1.108 + <text use-markup="true" > 1.109 + <label>"<b>Mount selected device on:</b>"</label> 1.110 + </text> 1.111 + <entry accept="directory"> 1.112 + <default>/media/cdrom</default> 1.113 + <variable>MOUNT_POINT</variable> 1.114 + </entry> 1.115 + <button> 1.116 + <label>Browse</label> 1.117 + <input file icon="folder-open"></input> 1.118 + <action type="fileselect">MOUNT_POINT</action> 1.119 + </button> 1.120 + </hbox> 1.121 + ' 1.122 + 1.123 +# Get the mount points list. 1.124 +MAIN_DIALOG=${MAIN_DIALOG}${DEVICE} 1.125 + 1.126 +# Actions buttons (mount, umount, eject, etc). 1.127 +ACTIONS=' 1.128 + 1.129 + <hbox> 1.130 + <button> 1.131 + <label>Mount</label> 1.132 + <input file icon="edit-redo"></input> 1.133 + <action>mkdir -p $MOUNT_POINT</action> 1.134 + <action>mount $DEVICE $MOUNT_POINT</action> 1.135 + <action>refresh:MOUNTED</action> 1.136 + <action>refresh:DEVICE</action> 1.137 + </button> 1.138 + <button> 1.139 + <label>Umount</label> 1.140 + <input file icon="undo"></input> 1.141 + <action>umount $MOUNT_POINT; sleep 1</action> 1.142 + <action>refresh:MOUNTED</action> 1.143 + <action>refresh:DEVICE</action> 1.144 + </button> 1.145 + <button> 1.146 + <label>Device list</label> 1.147 + <input file icon="reload"></input> 1.148 + <action>refresh:DEVICE</action> 1.149 + </button> 1.150 + <button> 1.151 + <label>Eject</label> 1.152 + <input file icon="media-cdrom"></input> 1.153 + <action>eject</action> 1.154 + </button> 1.155 + <button> 1.156 + <label>Loop</label> 1.157 + <input file icon="go-jump"></input> 1.158 + <action>/usr/lib/slitaz/libmountbox loopmgr</action> 1.159 + <action>refresh:MOUNTED</action> 1.160 + <action>refresh:DEVICE</action> 1.161 + </button> 1.162 + <button> 1.163 + <label>Crypto</label> 1.164 + <input file icon="passwd"></input> 1.165 + <action>/usr/lib/slitaz/libmountbox cryptomgr</action> 1.166 + <action>refresh:DEVICE</action> 1.167 + </button> 1.168 + <button help> 1.169 + <input file icon="help"></input> 1.170 + <action type="launch">HELP</action> 1.171 + </button> 1.172 + <button> 1.173 + <label>Quit</label> 1.174 + <input file icon="exit"></input> 1.175 + <action type="exit">Exit</action> 1.176 + </button> 1.177 + 1.178 + </hbox> 1.179 + 1.180 +</vbox> 1.181 +</window>' 1.182 + 1.183 +export MAIN_DIALOG=${MAIN_DIALOG}${ACTIONS} 1.184 +gtkdialog --center --program=MAIN_DIALOG >/dev/null 1.185 + 1.186 +exit 0