]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - updates/1.4.7/setup
git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@29 ea5c0bd1-69bd-2848...
[people/pmueller/ipfire-2.x.git] / updates / 1.4.7 / setup
CommitLineData
cd1a2927
MT
1#!/bin/bash
2
3UPGRADEVERSION="1.4.7"
4PREVIOUSVERSION="1.4.6"
5echo "This is the $UPGRADEVERSION update patch for IPCop $PREVIOUSVERSION installing."
6
7CURRENTVERSION=`perl -e "require '/var/ipcop/general-functions.pl';print \\$General::version;"`
8if [ "$CURRENTVERSION" != "$PREVIOUSVERSION" ]; then
9 echo "You are not running IPCop v$PREVIOUSVERSION for this patch to install."
10 echo "Aborting installation."
11 exit -1
12fi
13
14KVER=`uname -r`
15
16#we could have supported removing the 'not running' kernel but it will be much harder with each new kernel
17#so be simple and update only from the last one
18if [ "$KVER" = "2.4.27" -o "$KVER" = "2.4.27-smp" ]; then
19 echo "Kernel-2.4.29 is required to install this update"
20 echo "Old kernel 2.4.27 need to be removed to make place for kernel 2.4.31"
21 exit 1
22fi
23#cleanup /boot/grub of unused files (necessary for flash with only 5Mb on /boot)
24rm -f /boot/grub/{fat,ffs,iso9660,jfs,vstafs,minix,reiserfs,ufs2,xfs}_stage1_5 \
25 /boot/grub/stage2_eltorito \
26 /boot/grub/{scsigrub.conf,grubbatch}
27
28#suppress the kernel not in use to make place for a new kernel
29rm -rf /lib/modules/2.4.27{,-smp} \
30 /boot/vmlinuz-2.4.27{,-smp} \
31 /boot/System.map-2.4.27{,-smp} \
32 /boot/ipcoprd-2.4.27.img \
33 /boot/ipcoprd-smp-2.4.27.img
34
35#save active crontab
36mv /var/spool/cron/root.orig /tmp/root.orig
37
38# install udpated files
39/bin/tar -zxpf patch.tar.gz -C /
40
41# general-functions might not be overwrited by patch
42/bin/sed -i -e "s+= '1.4.*$+= '$UPGRADEVERSION';+" /var/ipcop/general-functions.pl
43
44# unneeded,updated, unified (old eci driver)
45/bin/rm -f /lib{libbz2.so.1.0.2,libz.so.1.2.2,libproc.so.3.2.1} /usr/bin/eciadsl-{firmware,synch,pppoeci}
46
47# update linker cache
48/sbin/ldconfig
49
50# Adjust limits in traffic RRDs to support 100Mbit uplinks
51for i in /var/log/rrd/{RED,GREEN,ORANGE,BLUE}.rrd; do
52 if [ -e $i ]; then
53 /usr/bin/perl -e "use RRDs;RRDs::tune('$i','--maximum','incoming:12500000');"
54 /usr/bin/perl -e "use RRDs;RRDs::tune('$i','--maximum','outgoing:12500000');"
55 fi
56done
57
58# optionsfw (ping disable, logging limitation
59mkdir -p /var/ipcop/optionsfw
60chmod 550 /var/ipcop/optionsfw
61touch /var/ipcop/optionsfw/settings
62chown nobody:nobody /var/ipcop/optionsfw
63chown nobody:nobody /var/ipcop/optionsfw/settings
64chmod 644 /var/ipcop/optionsfw/settings
65
66#Add a directory for language files installed by addons
67mkdir -p /var/ipcop/addon-lang
68chmod 550 /var/ipcop/addon-lang
69chown nobody:nobody /var/ipcop/addon-lang
70
71# Strip colon from end of 'section' string in all language files.
72for file in /var/ipcop/langs/*.pl
73do
74 sed -i -e '/section/s/://' $file
75done
76
77# Start of patch update to header.pl
78#
79# Use patch -N switch to apply patches only once
80#
81# First, upgrade to match v1.4.6 iso, if required
82patch -N /var/ipcop/header.pl <<\END
83105c105,107
84< [ $Lang::tr{'blue access'} , '/cgi-bin/wireless.cgi', "IPCop $Lang::tr{'blue access'}" ]]
85---
86> [ $Lang::tr{'blue access'} , '/cgi-bin/wireless.cgi', "IPCop $Lang::tr{'blue access'}" ]
87> # ,[ $Lang::tr{'options fw'} , '/cgi-bin/optionsfw.cgi', "IPCop $Lang::tr{'options fw'}" ]
88> ]
89END
90
91# Uncomment firewall options menu item
92patch -N /var/ipcop/header.pl <<\END
93106c106
94< # ,[ $Lang::tr{'options fw'} , '/cgi-bin/optionsfw.cgi', "IPCop $Lang::tr{'options fw'}" ]
95---
96> ,[ $Lang::tr{'options fw'} , '/cgi-bin/optionsfw.cgi', "IPCop $Lang::tr{'options fw'}" ]
97END
98
99# Apply 'ends never' patch to PrintActualLeases subroutine
100patch -N /var/ipcop/header.pl <<\END
101752,754c752,754
102< }
103<
104< if ($line =~ /^\s*ends/) {
105---
106> } elsif ($line =~ /^\s*ends never;/) {
107> $endtime = 'never';
108> } elsif ($line =~ /^\s*ends/) {
109757,759c757
110< }
111<
112< if ($line =~ /^\s*hardware ethernet/) {
113---
114> } elsif ($line =~ /^\s*hardware ethernet/) {
115762,766c760,762
116< }
117<
118< if ($line =~ /^\s*client-hostname/) {
119< shift (@temp);
120< $hostname = join (' ',@temp);
121---
122> } elsif ($line =~ /^\s*client-hostname/) {
123> shift (@temp);
124> $hostname = join (' ',@temp);
125769,771c765
126< }
127<
128< if ($line eq "}") {
129---
130> } elsif ($line eq "}") {
131776c770
132< }
133---
134> } #unknown format line...
135803,808c797,798
136< my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $dst);
137< ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $dst) = localtime ($entries{$key}->{ENDTIME});
138< my $enddate = sprintf ("%02d/%02d/%d %02d:%02d:%02d",$mday,$mon+1,$year+1900,$hour,$min,$sec);
139<
140< if ($entries{$key}->{ENDTIME} < time() ){
141< print "<strike>$enddate</strike>";
142---
143> if ($entries{$key}->{ENDTIME} eq 'never') {
144> print "$Lang::tr{'no time limit'}";
145810c800,808
146< print "$enddate";
147---
148> my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $dst);
149> ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $dst) = localtime ($entries{$key}->{ENDTIME});
150> my $enddate = sprintf ("%02d/%02d/%d %02d:%02d:%02d",$mday,$mon+1,$year+1900,$hour,$min,$sec);
151>
152> if ($entries{$key}->{ENDTIME} < time() ){
153> print "<strike>$enddate</strike>";
154> } else {
155> print "$enddate";
156> }
157END
158
159# Clean up any rejects
160rm -f /var/ipcop/header.pl.rej
161
162# End of update to header.pl
163
164# removing optionsfw.cgi from the menu because it is not ready
165/bin/sed -i -e 'optionsfw.cgi/ ,[ /# ,[ /' /var/ipcop/header.pl
166#
167# new crontab (supporting minimize ddns updates)
168#
169sum=`md5sum /tmp/root.orig | awk '{print $1}' `
170# if version 1.9.2.1 or 1.9.2.2 is untouched, just replace it else add the new entry only
171if [ "$sum" == "918ec891f5436c0e34ce4ba213a9fbe1" ] ||
172 [ "$sum" == "b18e7567915e576655815fb409145f1a" ] ; then
173 echo "Upgrade original crontab"
174 #file come from the update
175else
176 cat<<END>>/var/spool/cron/root.orig
177
178# ipcop update 1.4.7 addition to not original crontab
179# force update (even if name match IP) once a month if minimize option selected
180
1813 2 1 * * [ -f "/var/ipcop/red/active" ] && /usr/local/bin/setddns.pl -f -m
182END
183fi
184/usr/bin/fcrontab -z
185
186/bin/rm -f /tmp/root.orig
187
188#change in service name to conform to real name
189sed -i -e 's/freedns-afraid/freedns.afraid/' /var/ipcop/ddns/config
190chown nobody:nobody /var/ipcop/ddns/config
191
192#build cachelang file use this call after all "lang/*.pl" updates !
193perl -e "require '/var/ipcop/lang.pl'; &Lang::BuildCacheLang"
194
195cd /bin
196ln -s gzip zcat #logwatch.pl may use it
197ln -s bzip2 bzcat
198
199#fix init update : no more / is busy during shutdown
200/sbin/telinit u
201
202# adjust vpn config for new options DPD_ACTION & PFS
203# if config is 'host' set dpd_action=clear else set hold. Add always yes for PFS
204cp /var/ipcop/vpn/config /var/ipcop/vpn/config.old
205perl -e "while (<>) { chomp; \$V=(/,host,/?'clear':'hold'); print \"\$_,\$V,yes\n\"; }" /var/ipcop/vpn/config.old > /var/ipcop/vpn/config
206chown nobody:nobody /var/ipcop/vpn/config
207
208echo "IPCop v$UPGRADEVERSION - The Bad Packets Stop Here">/etc/issue
209killall mingetty #redisplay correct version
210echo "end of $UPGRADEVERSION update"
211exit 0