slitaz-tools rev 6
A mountbox example (GTK box dialog for mount)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun Dec 02 20:56:31 2007 +0100 (2007-12-02) |
parents | 841f4dd95ea2 |
children | 23bfed5fc2de |
files | tinyutils/mountbox |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tinyutils/mountbox Sun Dec 02 20:56:31 2007 +0100 1.3 @@ -0,0 +1,88 @@ 1.4 +#! /bin/sh 1.5 +# 1.6 +# Gtkdialog box for the mount command. Part of SliTaz tools. 1.7 +# 1.8 +VERSION=20071105 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 + fi 1.18 +} 1.19 + 1.20 +# Mount and umount buttons with fiel for devive and mount point. 1.21 +# 1.22 +export MOUNT_DIALOG=' 1.23 + <vbox> 1.24 + 1.25 + <text use-markup="true"> 1.26 + <label> 1.27 +" 1.28 +<b>SliTaz - Mountbox</b>" 1.29 + </label> 1.30 + </text> 1.31 + <text wrap="true" width-chars="44" use-markup="true"> 1.32 + <label> 1.33 +" 1.34 +Mount a device on a mount point. Device can be cdrom, 1.35 +flash key, USB disk or local HD partitions. Please use the 1.36 +<small>fdisk -l</small> to get a list of avalaible devices to mount 1.37 +" 1.38 + </label> 1.39 + </text> 1.40 + 1.41 + <hbox> 1.42 + <text use-markup="true"> 1.43 + <label>"<b>Device : </b>"</label> 1.44 + </text> 1.45 + <entry> 1.46 + <default>/dev/sda1</default> 1.47 + <variable>DEVICE</variable> 1.48 + </entry> 1.49 + </hbox> 1.50 + 1.51 + <hbox> 1.52 + <text use-markup="true"> 1.53 + <label>"<b>Mount point : </b>"</label> 1.54 + </text> 1.55 + <entry> 1.56 + <default>/media/flash</default> 1.57 + <variable>MOUNT_POINT</variable> 1.58 + </entry> 1.59 + </hbox> 1.60 + 1.61 + <hbox> 1.62 + <button> 1.63 + <label>Mount</label> 1.64 + <input file icon="forward"></input> 1.65 + <action>echo -e "Mounting $DEVICE...\n"</action> 1.66 + <action>mkdir -p $MOUNT_POINT; mount $DEVICE $MOUNT_POINT; sleep 1</action> 1.67 + <action>echo; mount | grep $DEVICE; echo</action> 1.68 + </button> 1.69 + 1.70 + <button> 1.71 + <label>Umount</label> 1.72 + <input file icon="undo"></input> 1.73 + <action>echo -e "Unmounting $MOUNT_POINT...\n"</action> 1.74 + <action>umount $MOUNT_POINT; sleep 1</action> 1.75 + <action>echo; mount | grep $DEVICE; echo</action> 1.76 + </button> 1.77 + 1.78 + <button> 1.79 + <input file icon="exit"></input> 1.80 + <action type="exit">Exit</action> 1.81 + </button> 1.82 + </hbox> 1.83 + 1.84 + </vbox> 1.85 +' 1.86 + 1.87 +# Only root can mount. 1.88 +check_root 1.89 +gtkdialog --program=MOUNT_DIALOG 1.90 + 1.91 +exit 0