slitaz-tools view tinyutils/mountbox @ rev 37

Rewrite tazx and add more screen size and colors choice
author Christophe Lincoln <pankso@slitaz.org>
date Mon Jan 14 13:25:50 2008 +0100 (2008-01-14)
parents ed8c647fa325
children adb072794713
line source
1 #! /bin/sh
2 #
3 # Gtkdialog box for the mount command. Part of SliTaz tools.
4 #
5 VERSION=20080113
7 # Check if user is root.
8 check_root()
9 {
10 if test $(id -u) != 0 ; then
11 echo -e "
12 You must be root to run `basename $0`. Please type 'su' and
13 root password to become super-user.\n"
14 exit 0
15 fi
16 }
18 export FDISK_LIST='
19 <vbox>
20 <text use-markup="true">
21 <label>"
22 <b>Harddisk devices list</b>"
23 </label>
24 </text>
25 <frame Partitions table>
26 <text wrap="false" width-chars="58">
27 <input>fdisk -l | grep ^/dev</input>
28 </text>
29 </frame>
30 <hbox>
31 <button>
32 <input file icon="exit"></input>
33 <action type="closewindow">FDISK_LIST</action>
34 </button>
35 </hbox>
36 </vbox>
37 '
39 # Mount and umount buttons with fiel for devive and mount point.
40 #
41 export MOUNT_DIALOG='
42 <vbox>
44 <text use-markup="true">
45 <label>
46 "
47 <b>SliTaz - Mountbox</b>"
48 </label>
49 </text>
50 <text wrap="true" width-chars="44" use-markup="true">
51 <label>
52 "
53 Mount device on a mount point. Device can be cdrom,
54 flash key, USB disk or local HD partitions.
55 "
56 </label>
57 </text>
59 <frame Configuration>
60 <hbox>
61 <text use-markup="true">
62 <label>"<b>Device : </b>"</label>
63 </text>
64 <entry>
65 <default>/dev/sda1</default>
66 <variable>DEVICE</variable>
67 </entry>
68 <button>
69 <label>List</label>
70 <input file icon="drive-harddisk"></input>
71 <action type="launch">FDISK_LIST</action>
72 </button>
73 </hbox>
75 <hbox>
76 <text use-markup="true">
77 <label>"<b>Mount point : </b>"</label>
78 </text>
79 <entry>
80 <default>/media/flash</default>
81 <variable>MOUNT_POINT</variable>
82 </entry>
83 </hbox>
85 </frame>
87 <hbox>
88 <button>
89 <label>Mount</label>
90 <input file icon="forward"></input>
91 <action>echo "Mounting $DEVICE..."</action>
92 <action>mkdir -p $MOUNT_POINT; mount $DEVICE $MOUNT_POINT; sleep 1</action>
93 <action>mount | grep $DEVICE; echo "Done."</action>
94 </button>
95 <button>
96 <label>Umount</label>
97 <input file icon="undo"></input>
98 <action>echo "Unmounting $MOUNT_POINT..."</action>
99 <action>umount $MOUNT_POINT; sleep 1</action>
100 <action>mount | grep $DEVICE; echo "Done."</action>
101 </button>
102 <button>
103 <input file icon="exit"></input>
104 <action type="exit">Exit</action>
105 </button>
106 </hbox>
108 </vbox>
109 '
111 # Only root can mount.
112 check_root
113 gtkdialog --program=MOUNT_DIALOG
115 exit 0