]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - updates/1.4.7/setup
4 PREVIOUSVERSION
="1.4.6"
5 echo "This is the $UPGRADEVERSION update patch for IPCop $PREVIOUSVERSION installing."
7 CURRENTVERSION
=`perl -e "require '/var/ipcop/general-functions.pl';print \\$General::version;"`
8 if [ "$CURRENTVERSION" != "$PREVIOUSVERSION" ]; then
9 echo "You are not running IPCop v$PREVIOUSVERSION for this patch to install."
10 echo "Aborting installation."
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
18 if [ "$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"
23 #cleanup /boot/grub of unused files (necessary for flash with only 5Mb on /boot)
24 rm -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
}
28 #suppress the kernel not in use to make place for a new kernel
29 rm -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
36 mv /var
/spool
/cron
/root.orig
/tmp
/root.orig
38 # install udpated files
39 /bin
/tar -zxpf patch.
tar.gz
-C /
41 # general-functions might not be overwrited by patch
42 /bin
/sed -i -e "s+= '1.4.*$+= '$UPGRADEVERSION';+" /var
/ipcop
/general-functions.pl
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
}
50 # Adjust limits in traffic RRDs to support 100Mbit uplinks
51 for i
in /var
/log
/rrd
/{RED
,GREEN
,ORANGE
,BLUE
}.rrd
; do
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');"
58 # optionsfw (ping disable, logging limitation
59 mkdir
-p /var
/ipcop
/optionsfw
60 chmod 550 /var
/ipcop
/optionsfw
61 touch /var
/ipcop
/optionsfw
/settings
62 chown nobody
:nobody
/var
/ipcop
/optionsfw
63 chown nobody
:nobody
/var
/ipcop
/optionsfw
/settings
64 chmod 644 /var
/ipcop
/optionsfw
/settings
66 #Add a directory for language files installed by addons
67 mkdir
-p /var
/ipcop
/addon-lang
68 chmod 550 /var
/ipcop
/addon-lang
69 chown nobody
:nobody
/var
/ipcop
/addon-lang
71 # Strip colon from end of 'section' string in all language files.
72 for file in /var
/ipcop
/langs
/*.pl
74 sed -i -e '/section/s/://' $file
77 # Start of patch update to header.pl
79 # Use patch -N switch to apply patches only once
81 # First, upgrade to match v1.4.6 iso, if required
82 patch -N /var
/ipcop
/header.pl
<<\END
84 < [ $Lang::tr{'blue access'} , '/cgi-bin/wireless.cgi', "IPCop $Lang::tr{'blue access'}" ]]
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'}" ]
91 # Uncomment firewall options menu item
92 patch -N /var
/ipcop
/header.pl
<<\END
94 < # ,[ $Lang::tr{'options fw'} , '/cgi-bin/optionsfw.cgi', "IPCop $Lang::tr{'options fw'}" ]
96 > ,[ $Lang::tr{'options fw'} , '/cgi-bin/optionsfw.cgi', "IPCop $Lang::tr{'options fw'}" ]
99 # Apply 'ends never' patch to PrintActualLeases subroutine
100 patch -N /var
/ipcop
/header.pl
<<\END
104 < if ($line =~
/^\s
*ends
/) {
106 > } elsif
($line =~
/^\s
*ends never
;/) {
107 > $endtime = 'never';
108 > } elsif
($line =~
/^\s
*ends
/) {
112 < if ($line =~
/^\s
*hardware ethernet
/) {
114 > } elsif
($line =~
/^\s
*hardware ethernet
/) {
118 < if ($line =~
/^\s
*client-hostname
/) {
120 < $hostname = join (' ',@temp
);
122 > } elsif
($line =~
/^\s
*client-hostname
/) {
124 > $hostname = join (' ',@temp
);
128 < if ($line eq
"}") {
130 > } elsif
($line eq
"}") {
134 > } #unknown format line...
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);
140 < if ($entries{$key}->{ENDTIME
} < time() ){
141 < print
"<strike>$enddate</strike>";
143 > if ($entries{$key}->{ENDTIME
} eq
'never') {
144 > print
"$Lang::tr{'no time limit'}";
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);
152 > if ($entries{$key}->{ENDTIME
} < time() ){
153 > print
"<strike>$enddate</strike>";
159 # Clean up any rejects
160 rm -f /var
/ipcop
/header.pl.rej
162 # End of update to header.pl
164 # removing optionsfw.cgi from the menu because it is not ready
165 /bin
/sed -i -e 'optionsfw.cgi/ ,[ /# ,[ /' /var
/ipcop
/header.pl
167 # new crontab (supporting minimize ddns updates)
169 sum=`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
171 if [ "$sum" == "918ec891f5436c0e34ce4ba213a9fbe1" ] ||
172 [ "$sum" == "b18e7567915e576655815fb409145f1a" ] ; then
173 echo "Upgrade original crontab"
174 #file come from the update
176 cat<<END>>/var/spool/cron/root.orig
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
181 3 2 1 * * [ -f "/var/ipcop/red/active" ] && /usr/local/bin/setddns.pl -f -m
186 /bin
/rm -f /tmp
/root.orig
188 #change in service name to conform to real name
189 sed -i -e 's/freedns-afraid/freedns.afraid/' /var
/ipcop
/ddns
/config
190 chown nobody
:nobody
/var
/ipcop
/ddns
/config
192 #build cachelang file use this call after all "lang/*.pl" updates !
193 perl
-e "require '/var/ipcop/lang.pl'; &Lang::BuildCacheLang"
196 ln -s gzip zcat
#logwatch.pl may use it
199 #fix init update : no more / is busy during shutdown
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
204 cp /var
/ipcop
/vpn
/config
/var
/ipcop
/vpn
/config.old
205 perl
-e "while (<>) { chomp; \$V=(/,host,/?'clear':'hold'); print \"\$_,\$V,yes\n\"; }" /var
/ipcop
/vpn
/config.old
> /var
/ipcop
/vpn
/config
206 chown nobody
:nobody
/var
/ipcop
/vpn
/config
208 echo "IPCop v$UPGRADEVERSION - The Bad Packets Stop Here">/etc
/issue
209 killall mingetty
#redisplay correct version
210 echo "end of $UPGRADEVERSION update"