slitaz-tools view tinyutils/mountbox @ rev 58

Slitaz-installer: really remove .moved subdir
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Feb 20 14:06:37 2008 +0100 (2008-02-20)
parents d9ce64aa6d2e
children 8ea52c365e03
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 <window title="Fdisk -l" icon-name="media-flash">
20 <vbox>
21 <text use-markup="true">
22 <label>"
23 <b>Harddisk devices list</b>"
24 </label>
25 </text>
26 <frame Partitions table>
27 <text wrap="false" width-chars="58">
28 <input>fdisk -l | grep ^/dev</input>
29 </text>
30 </frame>
31 <hbox>
32 <button>
33 <input file icon="exit"></input>
34 <action type="closewindow">FDISK_LIST</action>
35 </button>
36 </hbox>
37 </vbox>
38 </window>
39 '
41 # Mount and umount buttons with fiel for devive and mount point.
42 #
43 export MOUNT_DIALOG='
44 <window title="Mountbox" icon-name="media-flash">
45 <vbox>
47 <text use-markup="true">
48 <label>
49 "
50 <b>SliTaz - Mountbox</b>"
51 </label>
52 </text>
53 <text wrap="true" width-chars="44" use-markup="true">
54 <label>
55 "
56 Mount device on a mount point. Device can be cdrom,
57 flash key, USB disk or local HD partitions.
58 "
59 </label>
60 </text>
62 <frame Configuration>
63 <hbox>
64 <text use-markup="true">
65 <label>"<b>Device : </b>"</label>
66 </text>
67 <entry>
68 <default>/dev/sda1</default>
69 <variable>DEVICE</variable>
70 </entry>
71 <button>
72 <label>List</label>
73 <input file icon="drive-harddisk"></input>
74 <action type="launch">FDISK_LIST</action>
75 </button>
76 </hbox>
78 <hbox>
79 <text use-markup="true">
80 <label>"<b>Mount point : </b>"</label>
81 </text>
82 <entry>
83 <default>/media/flash</default>
84 <variable>MOUNT_POINT</variable>
85 </entry>
86 </hbox>
87 </frame>
89 <hbox>
90 <button>
91 <label>Mount</label>
92 <input file icon="forward"></input>
93 <action>echo "Mounting $DEVICE..."</action>
94 <action>mkdir -p $MOUNT_POINT; mount $DEVICE $MOUNT_POINT; sleep 1</action>
95 <action>mount | grep $DEVICE; echo "Done."</action>
96 </button>
97 <button>
98 <label>Umount</label>
99 <input file icon="undo"></input>
100 <action>echo "Unmounting $MOUNT_POINT..."</action>
101 <action>umount $MOUNT_POINT; sleep 1</action>
102 <action>mount | grep $DEVICE; echo "Done."</action>
103 </button>
104 <button>
105 <input file icon="exit"></input>
106 <action type="exit">Exit</action>
107 </button>
108 </hbox>
110 </vbox>
111 </window>
112 '
114 # Only root can mount.
115 check_root
116 gtkdialog --program=MOUNT_DIALOG
118 exit 0