slitaz-tools view tinyutils/mountbox @ rev 17

Fixe 'soundconf' screen output
author Christophe Lincoln <pankso@slitaz.org>
date Tue Dec 04 13:08:52 2007 +0100 (2007-12-04)
parents
children ed8c647fa325
line source
1 #! /bin/sh
2 #
3 # Gtkdialog box for the mount command. Part of SliTaz tools.
4 #
5 VERSION=20071105
7 # Check if user is root.
8 check_root()
9 {
10 if test $(id -u) != 0 ; then
11 echo -e "\nYou must be root to run `basename $0` with this command."
12 echo -e "Please type 'su' and root password to become super-user.\n"
13 exit 0
14 fi
15 }
17 # Mount and umount buttons with fiel for devive and mount point.
18 #
19 export MOUNT_DIALOG='
20 <vbox>
22 <text use-markup="true">
23 <label>
24 "
25 <b>SliTaz - Mountbox</b>"
26 </label>
27 </text>
28 <text wrap="true" width-chars="44" use-markup="true">
29 <label>
30 "
31 Mount a device on a mount point. Device can be cdrom,
32 flash key, USB disk or local HD partitions. Please use the
33 <small>fdisk -l</small> to get a list of avalaible devices to mount
34 "
35 </label>
36 </text>
38 <hbox>
39 <text use-markup="true">
40 <label>"<b>Device : </b>"</label>
41 </text>
42 <entry>
43 <default>/dev/sda1</default>
44 <variable>DEVICE</variable>
45 </entry>
46 </hbox>
48 <hbox>
49 <text use-markup="true">
50 <label>"<b>Mount point : </b>"</label>
51 </text>
52 <entry>
53 <default>/media/flash</default>
54 <variable>MOUNT_POINT</variable>
55 </entry>
56 </hbox>
58 <hbox>
59 <button>
60 <label>Mount</label>
61 <input file icon="forward"></input>
62 <action>echo -e "Mounting $DEVICE...\n"</action>
63 <action>mkdir -p $MOUNT_POINT; mount $DEVICE $MOUNT_POINT; sleep 1</action>
64 <action>echo; mount | grep $DEVICE; echo</action>
65 </button>
67 <button>
68 <label>Umount</label>
69 <input file icon="undo"></input>
70 <action>echo -e "Unmounting $MOUNT_POINT...\n"</action>
71 <action>umount $MOUNT_POINT; sleep 1</action>
72 <action>echo; mount | grep $DEVICE; echo</action>
73 </button>
75 <button>
76 <input file icon="exit"></input>
77 <action type="exit">Exit</action>
78 </button>
79 </hbox>
81 </vbox>
82 '
84 # Only root can mount.
85 check_root
86 gtkdialog --program=MOUNT_DIALOG
88 exit 0