slitaz-tools rev 32

Added frame and button List to mountbox
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jan 13 18:04:51 2008 +0100 (2008-01-13)
parents 691a4bd4fcf9
children 70fd876d3a6f
files tinyutils/mountbox
line diff
     1.1 --- a/tinyutils/mountbox	Sun Jan 06 22:51:00 2008 +0100
     1.2 +++ b/tinyutils/mountbox	Sun Jan 13 18:04:51 2008 +0100
     1.3 @@ -2,83 +2,110 @@
     1.4  # 
     1.5  # Gtkdialog box for the mount command. Part of SliTaz tools.
     1.6  #
     1.7 -VERSION=20071105
     1.8 +VERSION=20080113
     1.9  
    1.10  # Check if user is root.
    1.11  check_root()
    1.12  {
    1.13  	if test $(id -u) != 0 ; then
    1.14 -	   echo -e "\nYou must be root to run `basename $0` with this command."
    1.15 -	   echo -e "Please type 'su' and root password to become super-user.\n"
    1.16 -	   exit 0
    1.17 +		echo -e "
    1.18 +You must be root to run `basename $0`. Please type 'su' and 
    1.19 +root password to become super-user.\n"
    1.20 +		exit 0
    1.21  	fi
    1.22  }
    1.23  
    1.24 +export FDISK_LIST='
    1.25 +  <vbox>
    1.26 +    <text use-markup="true">
    1.27 +      <label>"
    1.28 +<b>Harddisk devices list</b>"
    1.29 +      </label>
    1.30 +    </text>
    1.31 +    <frame Partitions table>
    1.32 +      <text wrap="false" width-chars="58">
    1.33 +        <input>fdisk -l | grep ^/dev</input>
    1.34 +      </text>
    1.35 +    </frame>
    1.36 +    <hbox>
    1.37 +      <button>
    1.38 +        <input file icon="exit"></input>
    1.39 +        <action type="closewindow">FDISK_LIST</action>
    1.40 +      </button>
    1.41 +    </hbox>
    1.42 +  </vbox>
    1.43 +'
    1.44 +
    1.45  # Mount and umount buttons with fiel for devive and mount point.
    1.46  #
    1.47  export MOUNT_DIALOG='
    1.48 - <vbox>
    1.49 -
    1.50 -  <text use-markup="true">
    1.51 -    <label>
    1.52 +  <vbox>
    1.53 + 
    1.54 +    <text use-markup="true">
    1.55 +      <label>
    1.56  "
    1.57  <b>SliTaz - Mountbox</b>"
    1.58 -    </label>
    1.59 -  </text>
    1.60 -  <text wrap="true" width-chars="44" use-markup="true">
    1.61 -    <label>
    1.62 +      </label>
    1.63 +    </text>
    1.64 +    <text wrap="true" width-chars="44" use-markup="true">
    1.65 +      <label>
    1.66  "
    1.67 -Mount a device on a mount point. Device can be cdrom,
    1.68 -flash key, USB disk or local HD partitions. Please use the
    1.69 -<small>fdisk -l</small> to get a list of avalaible devices to mount
    1.70 +Mount device on a mount point. Device can be cdrom, 
    1.71 +flash key, USB disk or local HD partitions.
    1.72  "
    1.73 -    </label>
    1.74 -  </text>
    1.75 +      </label>
    1.76 +    </text>
    1.77    
    1.78 -  <hbox>
    1.79 -    <text use-markup="true">
    1.80 -      <label>"<b>Device             : </b>"</label>
    1.81 -    </text>
    1.82 -    <entry>
    1.83 -      <default>/dev/sda1</default>
    1.84 -      <variable>DEVICE</variable>
    1.85 -    </entry>
    1.86 -  </hbox>
    1.87 +    <frame Configuration>
    1.88 +      <hbox>
    1.89 +        <text use-markup="true">
    1.90 +          <label>"<b>Device             : </b>"</label>
    1.91 +        </text>
    1.92 +        <entry>
    1.93 +          <default>/dev/sda1</default>
    1.94 +          <variable>DEVICE</variable>
    1.95 +        </entry>
    1.96 +        <button>
    1.97 +          <label>List</label>
    1.98 +          <input file icon="drive-harddisk"></input>
    1.99 +	      <action type="launch">FDISK_LIST</action>
   1.100 +        </button>
   1.101 +      </hbox>
   1.102    
   1.103 -  <hbox>
   1.104 -    <text use-markup="true">
   1.105 -      <label>"<b>Mount point   : </b>"</label>
   1.106 -    </text>
   1.107 -    <entry>
   1.108 -      <default>/media/flash</default>
   1.109 -      <variable>MOUNT_POINT</variable>
   1.110 -    </entry>
   1.111 -  </hbox>
   1.112 -
   1.113 -  <hbox>
   1.114 -    <button>
   1.115 -      <label>Mount</label>
   1.116 -      <input file icon="forward"></input>
   1.117 -      <action>echo "Mounting $DEVICE..."</action>
   1.118 -      <action>mkdir -p $MOUNT_POINT; mount $DEVICE $MOUNT_POINT; sleep 1</action>
   1.119 -      <action>mount | grep $DEVICE; echo "Done."</action>
   1.120 -    </button>
   1.121 +      <hbox>
   1.122 +        <text use-markup="true">
   1.123 +          <label>"<b>Mount point   : </b>"</label>
   1.124 +        </text>
   1.125 +        <entry>
   1.126 +          <default>/media/flash</default>
   1.127 +          <variable>MOUNT_POINT</variable>
   1.128 +        </entry>
   1.129 +      </hbox>
   1.130      
   1.131 -    <button>
   1.132 -      <label>Umount</label>
   1.133 -      <input file icon="undo"></input>
   1.134 -      <action>echo "Unmounting $MOUNT_POINT..."</action>
   1.135 -      <action>umount $MOUNT_POINT; sleep 1</action>
   1.136 -      <action>mount | grep $DEVICE; echo "Done."</action>
   1.137 -    </button>
   1.138 +    </frame>
   1.139      
   1.140 -    <button>
   1.141 -      <input file icon="exit"></input>
   1.142 -      <action type="exit">Exit</action>
   1.143 -    </button>
   1.144 -  </hbox>
   1.145 +    <hbox>
   1.146 +      <button>
   1.147 +        <label>Mount</label>
   1.148 +        <input file icon="forward"></input>
   1.149 +        <action>echo "Mounting $DEVICE..."</action>
   1.150 +        <action>mkdir -p $MOUNT_POINT; mount $DEVICE $MOUNT_POINT; sleep 1</action>
   1.151 +        <action>mount | grep $DEVICE; echo "Done."</action>
   1.152 +      </button>
   1.153 +      <button>
   1.154 +        <label>Umount</label>
   1.155 +        <input file icon="undo"></input>
   1.156 +        <action>echo "Unmounting $MOUNT_POINT..."</action>
   1.157 +        <action>umount $MOUNT_POINT; sleep 1</action>
   1.158 +        <action>mount | grep $DEVICE; echo "Done."</action>
   1.159 +      </button>
   1.160 +      <button>
   1.161 +        <input file icon="exit"></input>
   1.162 +        <action type="exit">Exit</action>
   1.163 +      </button>
   1.164 +    </hbox>
   1.165    
   1.166 - </vbox>
   1.167 +  </vbox>
   1.168  '
   1.169  
   1.170  # Only root can mount.