-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.func
298 lines (275 loc) · 8.75 KB
/
setup.func
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
#!/usr/bin/env bash
#------------------------------------------------------------------------------
# burnCDDA is a shell script for burning Audio-CDs with
# cdrdao and cdrecord.
#
# (C) 2001 by Thorsten Muehlfelder <~thenktor~at~gmail~dot~com~>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License (version 2)
# as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#------------------------------------------------------------------------------
# Edit path function
bc_setup_expert_path()
{
MENULEVEL=3
while [ $MENULEVEL -ge 3 ]; do
$DIALOG --backtitle "$BACKTITLE" --title "Setup - Expert - Pathes" \
--menu "THIS DOES NOT WORK YET" 20 60 13 \
"S Save settings to" "/etc/burncdda.conf" \
"------------------" "------------------" \
"1 cdrecord" "$CDRECORD" \
"2 cdrdao" "$CDRDAO" \
"----------" "----------" \
"3 mplayer" "$MPLAYER" \
"4 normalize" "$NORMALIZE" \
"5 mp3_check" "$MP3_CHECK" \
"6 ogginfo" "$OGGINFO" \
"7 flac (for filecheck)" "$FLACCHK" \
"8 mpg321" "$MPG321" \
"9 oggdec" "$OGGDEC" \
"10 flac (for decoding)" "$FLACDEC" \
"11 mppdec" "$MPPDEC" \
"12 sox" "$SOX" \
"----------" "----------" \
"13 gawk" "$GAWK" \
"14 dialog" "$DIALOG" \
"15 find" "$FIND" \
"16 grep" "$GREP" \
"17 head" "$HEAD" \
"18 mktemp" "$MKTEMP" \
"19 nice" "$NICE" \
"20 sed" "$SED" \
"21 sort" "$SORT" \
"22 tail" "$TAIL" \
"23 tr" "$TR" \
"24 wc" "$WC" \
"25 Back" "Setup menu" 2> $TEMPFILE
# if cancel exit menu
if [ $? = "1" ]; then
MENULEVEL=1
continue
fi
CHOICE=`$CAT $TEMPFILE`
case $CHOICE in
*)
MENULEVEL=2
continue
;;
esac
done
}
# Expert menu function
bc_setup_expert()
{
MENULEVEL=2
while [ $MENULEVEL -ge 2 ]; do
$DIALOG --backtitle "$BACKTITLE" --title "Setup - Expert" --menu "THIS DOES NOT WORK YET" 18 60 11 \
"S Save settings to" "/etc/burncdda.conf" \
"----------------------" "------------------" \
"1 Nice level" "$NICELEVEL" \
"2 Normalize amplitude" "$NORMAMP" \
"3 cdrecord driver opts" "$DRIVEROPTS" \
"4 cdrecord other opts" "$OTHERREC" \
"5 cdrdao read driver" "$DRVRDAO" \
"6 cdrdao write driver" "$DRVWDAO" \
"7 cdrdao paranioa mode" "$PARANOIAMODE" \
"----------------------" "------------------" \
"P Edit program pathes" "path sub menu" 2> $TEMPFILE
# if cancel exit menu
if [ $? = "1" ]; then
MENULEVEL=1
continue
fi
CHOICE=`$CAT $TEMPFILE`
case $CHOICE in
"P Edit program pathes")
bc_setup_expert_path
;;
*)
MENULEVEL=1
continue
;;
esac
done
}
# save settings to /etc/burncdda.conf
function savesettings()
{
clear
echo "Saving /etc/burncdda.conf"
echo "Please enter your root password..."
$SU -c "$SED -i \
-e "s°^COLORS=.*°COLORS=\"$COLORS\"°" \
-e "s°^WRITESPEED=.*°WRITESPEED=\"$WRITESPEED\"°" \
-e "s°^DEVICE=.*°DEVICE=\"$DEVICE\"°" \
-e "s°^NORMAMP=.*°NORMAMP=\"$NORMAMP\"°" \
-e "s°^CDRECORD=.*°CDRECORD=\"$CDRECORD\"°" \
/etc/burncdda.conf"
if [ $? != "0" ]; then
echo -e "\n${RED}Error:${NOCOLOR} Failed to save '/etc/burncdda.conf'!\n"
else
CONFCHANGED="0"
readconfig
consolecolors
echo -e "\n${GREEN}Saved${NOCOLOR}\n"
fi
echo -e "${BLUE}Press any key${NOCOLOR}"
read -n1
}
#
# Setup menu function
#
bc_setup_menu()
{
CONFCHANGED="0"
while [ $MENULEVEL -ge 1 ]; do
$DIALOG --backtitle "$BACKTITLE" --title "Setup" --menu "What do you want to edit?" 16 60 9 \
"S Save settings to" "/etc/burncdda.conf" \
"----------------------" "----------------------" \
"1 Console colors" "$COLORS" \
"2 CD writing speed" "$WRITESPEED" \
"3 CD writer device" "$DEVICE" \
"4 Normalize amplitude" "$NORMAMP" \
"5 cdrecord executable" "$CDRECORD" \
"----------------------" "----------------------" \
"V View" "/etc/burncdda.conf" 2> $TEMPFILE
# if cancel exit menu
if [ $? = "1" ]; then
MENULEVEL=0
# if config has changed ask if it should be saved
if [ "$CONFCHANGED" = "1" ]; then
$DIALOG --backtitle "$BACKTITLE" --title "Setup" \
--yesno "Do you want to save your settings?" 6 60
# yes: save settings
if [ $? = "0" ]; then
savesettings
# no: reload config to restore old settings
else
readconfig
fi
fi
continue
fi
CHOICE=`$CAT $TEMPFILE`
case $CHOICE in
"S Save settings to")
savesettings
;;
"1 Console colors")
RADIOLISTOPTS=""
for TEMPVAR in BRIGHT DARK NO; do
if [ "$TEMPVAR" = "$COLORS" ]; then
RADIOLISTOPTS="$RADIOLISTOPTS $TEMPVAR colors on"
else
RADIOLISTOPTS="$RADIOLISTOPTS $TEMPVAR colors off"
fi
done
$DIALOG --backtitle "$BACKTITLE" --title "Setup -> Console colors" \
--radiolist "Some output is colored. Choose if these colors should be 'BRIGHT' (if you have a dark terminal background), 'DARK' (if you have a bright terminal background) or if 'NO' colors should be used. Default: 'BRIGHT'" 14 60 3 $RADIOLISTOPTS 2> $TEMPFILE
if [ $? = "1" ]; then
continue
fi
# get new value and test if it has changed
TEMPVAR=`$CAT $TEMPFILE`
if [ "$TEMPVAR" != "$COLORS" ]; then
COLORS="$TEMPVAR"
CONFCHANGED="1"
fi
;;
"2 CD writing speed")
# write speed -1 should be showed as Max, the x is added in the next step
if [ "$WRITESPEED" = "-1" ]; then
WRITESPEED="Ma"
fi
RADIOLISTOPTS=""
for TEMPVAR in 2 4 8 16 32 Ma; do
if [ "$TEMPVAR" = "$WRITESPEED" ]; then
RADIOLISTOPTS="$RADIOLISTOPTS ${TEMPVAR}x speed on"
else
RADIOLISTOPTS="$RADIOLISTOPTS ${TEMPVAR}x speed off"
fi
done
$DIALOG --backtitle "$BACKTITLE" --title "Setup -> CD writing speed" \
--radiolist "This defaults to '16x' at the moment because most drives (except very old ones) can write at this speed and it should provide a good writing quality. Even old car CD players should play the CDs. Otherwise you can use 'Max' (-1) and let cdrecord use its internal drive specific maximum speed defaults." 18 60 6 $RADIOLISTOPTS 2> $TEMPFILE
if [ $? = "1" ]; then
continue
fi
# # get new value and remove the x from 2x, 4x, ..., Max
TEMPVAR=`$CAT $TEMPFILE | $SED -e 's°x$°°'`
# if write speed is Ma(x) set it to -1 again
if [ "$TEMPVAR" = "Ma" ]; then
TEMPVAR="-1"
fi
# test if it has changed
if [ "$TEMPVAR" != "$WRITESPEED" ]; then
WRITESPEED="$TEMPVAR"
CONFCHANGED="1"
fi
;;
"3 CD writer device")
$DIALOG --backtitle "$BACKTITLE" --title "Setup -> CD writer device" \
--inputbox "CD writer device. Examples: '/dev/cdrom', '/dev/sr0', '0,0,0' or 'ATAPI:0,0,0'. The right setting depends on your kernel version and configuration. On modern systems the default setting should work. Default: '/dev/cdrom'" 11 60 $DEVICE 2> $TEMPFILE
if [ $? = "1" ]; then
continue
fi
# get new value and test if it has changed
TEMPVAR=`$CAT $TEMPFILE | $SED -e 's°^ *°°' -e 's° *$°°'`
if [ "$TEMPVAR" != "$DEVICE" ]; then
DEVICE="$TEMPVAR"
CONFCHANGED="1"
fi
;;
"4 Normalize amplitude")
RADIOLISTOPTS=""
for TEMPVAR in -12dbfs -10dbfs -8dbfs; do
if [ "$TEMPVAR" = "$NORMAMP" ]; then
RADIOLISTOPTS="$RADIOLISTOPTS $TEMPVAR amplitude on"
else
RADIOLISTOPTS="$RADIOLISTOPTS $TEMPVAR amplitude off"
fi
done
$DIALOG --backtitle "$BACKTITLE" --title "Setup -> Normalize amplitude" \
--radiolist "Quick help: '-12dbfs': very low volume, recommended for classical music; '-10dbfs': burnCDDA default, medium output volume, recommended for pop/rock; '-8dbfs': high output volume, will surely result in clipping. You can search the web for 'volume race' to get more information about output volumes and why you should not set it too high. Default: '-10dbfs'" 15 60 4 $RADIOLISTOPTS 2> $TEMPFILE
if [ $? = "1" ]; then
continue
fi
# get new value and test if it has changed
TEMPVAR=`$CAT $TEMPFILE`
if [ "$TEMPVAR" != "$NORMAMP" ]; then
NORMAMP="$TEMPVAR"
CONFCHANGED="1"
fi
;;
"5 cdrecord executable")
$DIALOG --backtitle "$BACKTITLE" --title "Setup -> cdrecord executable" \
--inputbox "If you want to use cdrkit instead of cdrtools try 'wodim' (untested). It is also possible to specify the full path, e.g. '/opt/cdrtools/bin/cdrecord'" 11 60 $CDRECORD 2> $TEMPFILE
if [ $? = "1" ]; then
continue
fi
# get new value and test if it has changed
TEMPVAR=`$CAT $TEMPFILE | $SED -e 's°^ *°°' -e 's° *$°°'`
if [ "$TEMPVAR" != "$CDRECORD" ]; then
CDRECORD="$TEMPVAR"
CONFCHANGED="1"
fi
;;
"V View")
$DIALOG --backtitle "$BACKTITLE" --title "Setup -> View /etc/burncdda.conf" \
--textbox /etc/burncdda.conf 20 75
;;
*)
continue
;;
esac
done
}