Diffstat (limited to 'noncore/tools/opie-sh/scripts/filesystem_mounter.sh') (more/less context) (show whitespace changes)
-rwxr-xr-x | noncore/tools/opie-sh/scripts/filesystem_mounter.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/tools/opie-sh/scripts/filesystem_mounter.sh b/noncore/tools/opie-sh/scripts/filesystem_mounter.sh index faaf37c..ba461a1 100755 --- a/noncore/tools/opie-sh/scripts/filesystem_mounter.sh +++ b/noncore/tools/opie-sh/scripts/filesystem_mounter.sh | |||
@@ -1,66 +1,66 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # filesystem_mounter.sh - a demonstration of opie-sh | 3 | # filesystem_mounter.sh - a demonstration of opie-sh |
4 | # | 4 | # |
5 | # Copyright (C) 2002 gonz@directbox.com | 5 | # Copyright (C) 2002 gonz@directbox.com |
6 | # | 6 | # |
7 | # This program is free software; you can redistribute it and/or modify | 7 | # This program is free software; you can redistribute it and/or modify |
8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
9 | # the Free Software Foundation; either version 2, or (at your option) | 9 | # the Free Software Foundation; either version 2, or (at your option) |
10 | # any later version. | 10 | # any later version. |
11 | # | 11 | # |
12 | # This program is distributed in the hope that it will be useful, | 12 | # This program is distributed in the hope that it will be useful, |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | # GNU General Public License for more details. | 15 | # GNU General Public License for more details. |
16 | # | 16 | # |
17 | # 20020524-2 - using df from diskfree now | 17 | # 20020524-2 - using df from diskfree now |
18 | # 20020524-1 - just code optix | 18 | # 20020524-1 - just code optix |
19 | # 20020519-1 - added information screen with manpage excerpt, added | 19 | # 20020519-1 - added information screen with manpage excerpt, added |
20 | # better returncode-checking | 20 | # better returncode-checking |
21 | # 20020517-2 - fixed output bug | 21 | # 20020517-2 - fixed output bug |
22 | # 20020517-1 - nicer fullscreen, added about, tried icon | 22 | # 20020517-1 - nicer fullscreen, added about, tried icon |
23 | # | 23 | # |
24 | 24 | ||
25 | OPIE_SH=/opt/QtPalmtop/bin/opie-sh | 25 | OPIE_SH=$OPIEDIR/bin/opie-sh |
26 | 26 | ||
27 | ###################################################################### | 27 | ###################################################################### |
28 | # subroutines | 28 | # subroutines |
29 | 29 | ||
30 | about() { | 30 | about() { |
31 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/fsmounter.png>" | 31 | ( echo "<img src=$OPIEDIR/pics/opie-sh-scripts/fsmounter.png>" |
32 | echo "<h3>About</h3>" | 32 | echo "<h3>About</h3>" |
33 | echo "This little App should make it possible for you to " | 33 | echo "This little App should make it possible for you to " |
34 | echo "easily mount and unmount filesystems from /etc/fstab" | 34 | echo "easily mount and unmount filesystems from /etc/fstab" |
35 | echo "<p>" | 35 | echo "<p>" |
36 | ) | $OPIE_SH -t fsmounter -f & | 36 | ) | $OPIE_SH -t fsmounter -f & |
37 | SCREENCLEAN=$! | 37 | SCREENCLEAN=$! |
38 | sleep 1 | 38 | sleep 1 |
39 | } | 39 | } |
40 | 40 | ||
41 | beforemount() { | 41 | beforemount() { |
42 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/fsmounter.png>" | 42 | ( echo "<img src=$OPIEDIR/pics/opie-sh-scripts/fsmounter.png>" |
43 | echo "<h3>mount or unmount $MOUNTPOINT ?</h3>" | 43 | echo "<h3>mount or unmount $MOUNTPOINT ?</h3>" |
44 | echo "<b>excerpt from MOUNT(8) manpage:</b><p>" | 44 | echo "<b>excerpt from MOUNT(8) manpage:</b><p>" |
45 | echo "All files accessible in a Unix system are arranged in one | 45 | echo "All files accessible in a Unix system are arranged in one |
46 | big tree, the file hierarchy, rooted at <b>/</b>. These files | 46 | big tree, the file hierarchy, rooted at <b>/</b>. These files |
47 | can be spread out over several devices. The <b>mount</b> command | 47 | can be spread out over several devices. The <b>mount</b> command |
48 | serves to attach the file system found on some device to | 48 | serves to attach the file system found on some device to |
49 | the big file tree. Conversely, the <b>umount(8)</b> command will | 49 | the big file tree. Conversely, the <b>umount(8)</b> command will |
50 | detach it again." | 50 | detach it again." |
51 | echo "<p>" | 51 | echo "<p>" |
52 | ) | $OPIE_SH -t fsmounter -f & | 52 | ) | $OPIE_SH -t fsmounter -f & |
53 | SCREENCLEAN2=$! | 53 | SCREENCLEAN2=$! |
54 | sleep 1 | 54 | sleep 1 |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | cleanup() { | 58 | cleanup() { |
59 | kill $SCREENCLEAN $SCREENCLEAN2 | 59 | kill $SCREENCLEAN $SCREENCLEAN2 |
60 | rm -f /tmp/qcop-msg-filesystem_mounter.sh | 60 | rm -f /tmp/qcop-msg-filesystem_mounter.sh |
61 | } | 61 | } |
62 | 62 | ||
63 | get_action() { | 63 | get_action() { |
64 | # ask what to do (start/stop/status) | 64 | # ask what to do (start/stop/status) |
65 | # | 65 | # |
66 | $OPIE_SH -m -t "Select Action" \ | 66 | $OPIE_SH -m -t "Select Action" \ |
@@ -79,48 +79,48 @@ kill $SCREENCLEAN2 | |||
79 | 79 | ||
80 | select_mountpoint() { | 80 | select_mountpoint() { |
81 | # present service list and choose | 81 | # present service list and choose |
82 | # | 82 | # |
83 | MOUNTPOINT=` cat /etc/fstab | cut -f1 \ | 83 | MOUNTPOINT=` cat /etc/fstab | cut -f1 \ |
84 | | cut -d " " -f1 \ | 84 | | cut -d " " -f1 \ |
85 | | egrep -v "(tmpfs|proc|devpts|^#)" \ | 85 | | egrep -v "(tmpfs|proc|devpts|^#)" \ |
86 | | $OPIE_SH -i -l \ | 86 | | $OPIE_SH -i -l \ |
87 | -g -t "SELECT MOUNTPOINT" \ | 87 | -g -t "SELECT MOUNTPOINT" \ |
88 | -L "select fs: " ` | 88 | -L "select fs: " ` |
89 | } | 89 | } |
90 | 90 | ||
91 | ###################################################################### | 91 | ###################################################################### |
92 | # main | 92 | # main |
93 | 93 | ||
94 | about | 94 | about |
95 | select_mountpoint | 95 | select_mountpoint |
96 | beforemount | 96 | beforemount |
97 | get_action | 97 | get_action |
98 | 98 | ||
99 | if [ "$MOUNTPOINT" = "" ] | 99 | if [ "$MOUNTPOINT" = "" ] |
100 | then echo "ugly error...." | $OPIE_SH -f ; cleanup | 100 | then echo "ugly error...." | $OPIE_SH -f ; cleanup |
101 | fi | 101 | fi |
102 | 102 | ||
103 | ( echo "<img src=/opt/QtPalmtop/pics/opie-sh-scripts/fsmounter.png>" | 103 | ( echo "<img src=$OPIEDIR/pics/opie-sh-scripts/fsmounter.png>" |
104 | echo "<h3>Output of $ACTION $MOUNTPOINT :</h3>" | 104 | echo "<h3>Output of $ACTION $MOUNTPOINT :</h3>" |
105 | echo "<pre>" | 105 | echo "<pre>" |
106 | $ACTION $MOUNTPOINT 2>&1 | 106 | $ACTION $MOUNTPOINT 2>&1 |
107 | echo "</pre><p>" | 107 | echo "</pre><p>" |
108 | echo "<h3>diskfree</h3> how much space is left ?<br>" | 108 | echo "<h3>diskfree</h3> how much space is left ?<br>" |
109 | echo "<p><table>" | 109 | echo "<p><table>" |
110 | 110 | ||
111 | df -Ph \ | 111 | df -Ph \ |
112 | | grep -v "Mounted on" \ | 112 | | grep -v "Mounted on" \ |
113 | | sed 's/ / /g' \ | 113 | | sed 's/ / /g' \ |
114 | | sed 's/ / /g' \ | 114 | | sed 's/ / /g' \ |
115 | | sed 's/ / /g' \ | 115 | | sed 's/ / /g' \ |
116 | | sed 's/ / /g' \ | 116 | | sed 's/ / /g' \ |
117 | | sed 's/ / /g' \ | 117 | | sed 's/ / /g' \ |
118 | | sed 's/ / /g' \ | 118 | | sed 's/ / /g' \ |
119 | | sed "s/ / /g" \ | 119 | | sed "s/ / /g" \ |
120 | | cut -d " " -f4- \ | 120 | | cut -d " " -f4- \ |
121 | | sed 's/ /<\/td><td>/g' \ | 121 | | sed 's/ /<\/td><td>/g' \ |
122 | | sed 's/$/<\/td><\/tr>/' \ | 122 | | sed 's/$/<\/td><\/tr>/' \ |
123 | | sed 's/^/<tr><td>/' ; echo "</table>" \ | 123 | | sed 's/^/<tr><td>/' ; echo "</table>" \ |
124 | ) | $OPIE_SH -f | 124 | ) | $OPIE_SH -f |
125 | 125 | ||
126 | cleanup | 126 | cleanup |