1#!/bin/sh
2
3##################--------C o l o r  -------------##########################
4# <colors>
5	coloroff="\033[1;0m"	# standart color
6	green="\033[1;32m"	# green
7	white="\033[1;37m"	# white
8	blue="\033[1;36m"	# blue
9	red="\033[1;31m"	# red
10	lilas="\033[1;35m"	# lilac
11# </colors>
12
13
14############################################################################
15
16clear
17echo "Homepage of this project:"
18echo -e "http://gnormalize.sourceforge.net\n"
19echo -e "This script will install ${blue}gnormalize${coloroff}, \
20${green}Audio-CD${coloroff}, ${green}CDDB_get${coloroff}, ${green}MP3::Info${coloroff}, \
21${green}mac${coloroff}, ${green}mppenc${coloroff}, ${green}mppdec${coloroff}, \
22and ${green}wavegain${coloroff} in your system:"
23
24ID=$(id)
25
26case $ID in *\(root\)*)
27     IDROOT=1
28     ;;
29esac
30
31if [ "$IDROOT" != 1 ] ;
32then echo -e "\nYou must have permission access (superuser privilege) to install this programs.
33Please, become root.\n"
34     exit;
35fi
36
37
38####################--------------Install------------########################
39
40echo -e "\nInstall Audio-CD to play Audio CDs( you must have installed: libcdaudio,\
41libcdaudio-devel, perl-devel )? Type (y/n): \c"
42
43read resposta
44
45machine=`uname -m`  # i586, i686, x86_32, x86_64
46local=`pwd`  # save local path
47cd packages  # enter the packages directory
48
49if [ "$resposta" = "y" -o "$resposta" = "" ]
50then
51	 echo -e "\n${lilas}Install Audio-CD:${coloroff}"
52	 tar zxvf Audio-CD-0.04-changed.tar.gz
53	 cd Audio-CD-0.04-changed
54	 perl Makefile.PL
55	 make && make install
56	 if [ "$?" = "0" ]
57	    then echo -e "\n${green}Sucess, Audio-CD installed.${coloroff}\n"
58	    else echo -e "\n${red}Could not install Audio-CD.${coloroff}\n"
59	 fi
60	 cd ..
61	 rm -rf Audio-CD-0.04-changed
62
63else     echo -e "\nNot install Audio-CD!\n"
64
65fi
66
67
68PACKINFO=`ls CDDB_get-*.tar.gz`
69PACKDIR=`echo $PACKINFO|sed -e 's/\.tar\.gz//'`
70
71echo -e "\nInstall $PACKINFO? Type (y/n): \c"
72read resposta
73if [ "$resposta" = "y" -o "$resposta" = "" ]
74then
75	 echo -e "\n${lilas}Install $PACKINFO:${coloroff}"
76	 tar -zxvf $PACKINFO
77	 cd $PACKDIR
78	 perl Makefile.PL
79	 make && make install
80	 if [ "$?" = "0" ]
81	    then echo -e "\n${green}Sucess, $PACKINFO installed.${coloroff}\n"
82	    else echo -e "\n${red}Could not install $PACKINFO.${coloroff}\n"
83	 fi
84	 cd ..
85	 rm -rf $PACKDIR
86
87else     echo -e "\nNot install $PACKINFO!\n"
88fi
89
90
91PACKINFO=`ls MP3-Info-*.tar.gz`
92PACKDIR=`echo $PACKINFO|sed -e 's/\.tar\.gz//'`
93
94echo -e "\nInstall $PACKINFO? Type (y/n): \c"
95read resposta
96if [ "$resposta" = "y" -o "$resposta" = "" ]
97then
98	 echo -e "\n${lilas}Install $PACKINFO:${coloroff}"
99	 tar -zxvf $PACKINFO
100	 cd $PACKDIR
101	 perl Makefile.PL
102	 make && make install
103	 if [ "$?" = "0" ]
104	    then echo -e "\n${green}Sucess, $PACKINFO installed.${coloroff}\n"
105	    else echo -e "\n${red}Could not install $PACKINFO.${coloroff}\n"
106	 fi
107	 cd ..
108	 rm -rf $PACKDIR
109
110else     echo -e "\nNot install $PACKINFO!\n"
111fi
112
113
114PACKINFO=`ls mac-*.tar.gz`
115PACKDIR=`echo $PACKINFO|sed -e 's/\.tar\.gz//'`
116
117echo -e "\nInstall $PACKINFO? Type (y/n): \c"
118read resposta
119if [ "$resposta" = "y" -o "$resposta" = "" ]
120then
121	 echo -e "\n${lilas}Install $PACKINFO:${coloroff}"
122	 tar -zxvf $PACKINFO
123	 cd $PACKDIR
124	 ./configure --prefix=/usr
125	 make && make install
126	 if [ "$?" = "0" ]
127	    then echo -e "\n${green}Sucess, $PACKINFO installed.${coloroff}\n"
128	    else echo -e "\n${red}Could not install $PACKINFO.${coloroff}\n"
129	 fi
130	 cd ..
131	 rm -rf $PACKDIR
132
133else     echo -e "\nNot install $PACKINFO!\n"
134fi
135
136
137MPPENC=`ls mppenc-*.tar.bz2`
138MPPENCDIR=`echo $MPPENC|sed -e 's/\.tar\.bz2//'`
139
140echo -e "\nInstall $MPPENC (need 'cmake' to compile) and mppdec? Type (y/n): \c"
141read resposta
142if [ "$resposta" = "y" -o "$resposta" = "" ]
143then
144	 echo -e "\n${lilas}Install $MPPENC:${coloroff}"
145	 tar -jxvf $MPPENC
146	 cd $MPPENCDIR
147         cmake -DCMAKE_INSTALL_PREFIX:=/usr
148 	 make && make install
149
150	 MPPENC_OUTPUT=`echo $?`
151
152	 cd ..
153	 rm -rf $MPPENCDIR
154
155	 if [ $MPPENC_OUTPUT = "0" ]
156	    then echo -e "\n${green}Sucess, MPC encoder installed from source code $MPPENC.${coloroff}\n"
157	         echo -e "\n${lilas}Install MPC decoder from binary:${coloroff}"
158
159		 if [ $machine = "x86_64" ]
160		    then cp -vf mppdec_x86_64 /usr/bin/mppdec; chmod 0755 /usr/bin/mppdec
161		    else cp -vf mppdec /usr/bin/mppdec; chmod 0755 /usr/bin/mppdec
162		 fi
163
164	    else echo -e "\n${red}Could not install MPC encoder from source code $MPPENC!${coloroff}\n"
165	         echo -e "\n${lilas}Install MPC encoder and decoder from binary:${coloroff}"
166
167		 if [ $machine = "x86_64" ]
168		    then cp -vf mppenc_x86_64 /usr/bin/mppenc; chmod 0755 /usr/bin/mppenc
169		         cp -vf mppdec_x86_64 /usr/bin/mppdec; chmod 0755 /usr/bin/mppdec
170		    else cp -vf mppenc /usr/bin/mppenc; chmod 0755 /usr/bin/mppenc
171		         cp -vf mppdec /usr/bin/mppdec; chmod 0755 /usr/bin/mppdec
172		 fi
173	 fi
174else     echo -e "\nNot install $MPPENC and mppdec!\n"
175fi
176
177
178PACKINFO=`ls WaveGain-*.tar.gz`
179PACKDIR=`echo $PACKINFO|sed -e 's/\.tar\.gz//'`
180
181echo -e "\nInstall $PACKINFO (with ReplayGain to normalize wave files)? Type (y/n): \c"
182read resposta
183if [ "$resposta" = "y" -o "$resposta" = "" ]
184then
185	 echo -e "\n${lilas}Install $PACKINFO:${coloroff}"
186	 tar -zxvf $PACKINFO
187	 cd $PACKDIR
188	 # ./configure --prefix=/usr
189	 make && make install
190
191         WAVEGAIN_OUTPUT=`echo $?`
192
193         cd ..
194	 rm -rf $PACKDIR
195
196	 if [ $WAVEGAIN_OUTPUT = "0" ]
197	    then echo -e "\n${green}Sucess, $PACKINFO installed.${coloroff}\n"
198	    else echo -e "\n${red}Could not install $PACKINFO from source code.${coloroff}\n"
199	         echo -e "\n${lilas}Install WaveGain from binary:${coloroff}"
200	         if [ $machine = "x86_64" ]
201		    then cp -vf wavegain_x86_64 /usr/bin/wavegain; chmod 0755 /usr/bin/wavegain
202		    else cp -vf wavegain /usr/bin/wavegain; chmod 0755 /usr/bin/wavegain
203	         fi
204	 fi
205
206else     echo -e "\nNot install $PACKINFO!\n"
207fi
208
209
210cd .. # quit the packages directory
211cd $local
212
213echo -e "\nInstall ${blue}gnormalize${coloroff}? Type (y/n): \c"
214read resposta
215if [ "$resposta" = "y" -o "$resposta" = "" ]
216then
217	 echo -e "\n${lilas}Install gnormalize:${coloroff}"
218
219	 make install
220
221	 if [ "$?" = "0" ]
222	    then echo -e "\n${green}Sucess, install finished.${coloroff}\n"
223	    else echo -e "\n${red}Could not install gnormalize.${coloroff}\n"
224	 fi
225
226else     echo -e "\nNot install!\n"
227fi
228