Rev 15 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
15 | PointedEar | 1 | #!/bin/bash |
2 | |||
3 | APPNAME="EazyTranslator" |
||
4 | APPVER="0.96a Setup" |
||
5 | APPFILEDIR=`pwd` |
||
6 | APPFILENAME="translate" |
||
7 | |||
8 | function title { |
||
9 | clear |
||
10 | echo $APPNAME" "$APPVER" - (C) 2001 Thomas Lahn (webmaster@PointedEars.de)" |
||
11 | } |
||
12 | |||
13 | function Error { |
||
14 | echo |
||
15 | pause "c" |
||
16 | } |
||
17 | |||
18 | function EFailed { |
||
19 | echo -e "$rc_failed" |
||
20 | Error |
||
21 | } |
||
22 | |||
23 | X="" |
||
24 | function val2x { |
||
25 | case $1 in |
||
26 | -1) X="-";; |
||
27 | 0) X=" ";; |
||
28 | 1) X="x";; |
||
29 | esac |
||
30 | } |
||
31 | |||
32 | |||
33 | # Acquire default text values for process success/failure messages |
||
34 | . /etc/rc.config |
||
35 | |||
36 | if [ -n "$1" ]; then CPDEST=$1 ; else CPDEST="/opt/EazyTrans" ; fi |
||
37 | CREATELNK=1 |
||
38 | MODI_USERS=1 |
||
39 | MODI_ROOT=1 |
||
40 | MODI_SKEL=1 |
||
41 | YES="Yes!" |
||
42 | NO="No." |
||
43 | DEF="Default" |
||
44 | YESNO="$YES $NO" |
||
45 | YESNODEF="$YES $NO $DEF" |
||
46 | |||
47 | CONTINUE=0 |
||
48 | while [ $CONTINUE -eq 0 ]; do |
||
49 | title |
||
50 | echo |
||
51 | # if [ `whoami` != "root" ]; then echo "Sorry, only 'root' can do this!" ; echo ; exit 1 ; fi |
||
52 | echo "This program will do the following:" |
||
53 | echo |
||
54 | echo "1) Copy the program files to: '"$CPDEST"'" |
||
55 | val2x $CREATELNK |
||
56 | echo "2) ["$X"] Create a symbolic link to /usr/bin" |
||
57 | val2x $MODI_USERS |
||
58 | echo "3) ["$X"] Modify the ~/.bashrc file of existing users (default)" |
||
59 | val2x $MODI_ROOT |
||
60 | echo "4) ["$X"] Modify the /root/.bashrc file (default)" |
||
61 | val2x $MODI_SKEL |
||
62 | echo "5) ["$X"] Modify the /etc/skel/.bashrc file (default)" |
||
63 | echo |
||
64 | echo "Select the value to be changed, proceed with these values or cancel:" |
||
65 | OPT_PROCEED="Proceed!" |
||
66 | OPT_CANCEL="Cancel." |
||
67 | OPTIONS="1 2 3 4 5 $OPT_PROCEED $OPT_CANCEL" |
||
68 | select SELOPT in $OPTIONS; do |
||
69 | case $SELOPT in |
||
70 | "1") |
||
71 | echo |
||
72 | echo "Where should the program files be copied to? (RETURN cancels):" |
||
73 | echo -n "> " |
||
74 | read S |
||
75 | if [ -n "$S" ]; then CPDEST=$S ; fi |
||
76 | break;; |
||
77 | "2") |
||
78 | echo |
||
79 | echo "Should a symbolic link '/usr/bin/"$APPFILENAME"' be created" |
||
80 | echo "so that the program becomes available to all users?" |
||
81 | select SELOPT in $YESNODEF; do |
||
82 | case $SELOPT in |
||
83 | $YES) |
||
84 | CREATELNK=1 |
||
85 | break;; |
||
86 | $NO) |
||
87 | CREATELNK=0 |
||
88 | break;; |
||
89 | $DEF) |
||
90 | CREATELNK=1 |
||
91 | break;; |
||
92 | *) |
||
93 | echo "Bad option" |
||
94 | echo;; |
||
95 | esac |
||
96 | done |
||
97 | break;; |
||
98 | "3") |
||
99 | echo |
||
100 | echo "Should the ~/.bashrc file of existing users be modified" |
||
101 | echo "so that they can use the global dictionary files without typing a path?" |
||
102 | select SELOPT in $YESNODEF; do |
||
103 | case $SELOPT in |
||
104 | $YES) |
||
105 | MODI_USERS=1 |
||
106 | break;; |
||
107 | $NO) |
||
108 | MODI_USERS=0 |
||
109 | break;; |
||
110 | $DEF) |
||
111 | MODI_USERS=1 |
||
112 | break;; |
||
113 | *) |
||
114 | echo "Bad option" |
||
115 | echo;; |
||
116 | esac |
||
117 | done |
||
118 | break;; |
||
119 | "4") |
||
120 | echo |
||
121 | echo "Should /root/.bashrc be modified so that 'root' can use" |
||
122 | echo "the global dictionary files without typing a path?" |
||
123 | select SELOPT in $YESNODEF; do |
||
124 | case $SELOPT in |
||
125 | $YES) |
||
126 | MODI_ROOT=1 |
||
127 | break;; |
||
128 | $NO) |
||
129 | MODI_ROOT=0 |
||
130 | break;; |
||
131 | $DEF) |
||
132 | MODI_ROOT=1 |
||
133 | break;; |
||
134 | *) |
||
135 | echo "Bad option" |
||
136 | echo |
||
137 | esac |
||
138 | done |
||
139 | break;; |
||
140 | "5") |
||
141 | echo |
||
142 | echo "Should /etc/skel/.bashrc be modified so that new users" |
||
143 | echo "can use the global dictionary files without typing a path?" |
||
144 | select SELOPT in $YESNODEF; do |
||
145 | case $SELOPT in |
||
146 | $YES) |
||
147 | MODI_SKEL=1 |
||
148 | break;; |
||
149 | $NO) |
||
150 | MODI_SKEL=0 |
||
151 | break;; |
||
152 | $DEF) |
||
153 | MODI_SKEL=1 |
||
154 | break;; |
||
155 | *) |
||
156 | echo "Bad option" |
||
157 | echo |
||
158 | esac |
||
159 | done |
||
160 | break;; |
||
161 | $OPT_PROCEED) |
||
162 | title |
||
163 | echo |
||
164 | echo "Creating program directory '"$CPDEST"'" |
||
165 | if [ -d |
||
166 | if [ -x "$APPFILENAME" ]; then |
||
167 | ln -s -v $APPFILEDIR/$APPFILENAME /usr/bin/$APPFILENAME |
||
168 | else |
||
169 | echo $0": Unable to find the file "$APPFILEDIR/$APPFILENAME"' in current directory." |
||
170 | fi |
||
171 | echo |
||
172 | echo |
||
173 | exit 0;; |
||
174 | $OPT_CANCEL) |
||
175 | title |
||
176 | echo |
||
177 | echo "Canceled." |
||
178 | echo |
||
179 | exit 0;; |
||
180 | *) |
||
181 | break;; |
||
182 | esac |
||
183 | done |
||
184 | done |
||
185 | |||
186 | exit 0 |