]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - config/rootfiles/updater/update.sh
Fix ffmpeg dependency
[people/pmueller/ipfire-2.x.git] / config / rootfiles / updater / update.sh
CommitLineData
2d9ee050
AF
1#!/bin/bash
2############################################################################
3# #
4# This file is part of the IPFire Firewall. #
5# #
6# IPFire is free software; you can redistribute it and/or modify #
7# it under the terms of the GNU General Public License as published by #
4378d325 8# the Free Software Foundation; either version 3 of the License, or #
2d9ee050
AF
9# (at your option) any later version. #
10# #
11# IPFire is distributed in the hope that it will be useful, #
12# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14# GNU General Public License for more details. #
15# #
16# You should have received a copy of the GNU General Public License #
17# along with IPFire; if not, write to the Free Software #
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
19# #
9b50da9d 20# Copyright (C) 2008 IPFire-Team <info@ipfire.org>. #
2d9ee050
AF
21# #
22############################################################################
ff753a4c 23#
4378d325
AF
24. /opt/pakfire/lib/functions.sh
25/usr/local/bin/backupctrl exclude >/dev/null 2>&1
ff753a4c 26#
4378d325
AF
27OLDVERSION=`grep "version = " /opt/pakfire/etc/pakfire.conf | cut -d'"' -f2`
28NEWVERSION="2.3"
202f35e2 29KVER="2.6.23.17"
2d9ee050
AF
30ROOT=`grep "root=" /boot/grub/grub.conf | cut -d"=" -f2 | cut -d" " -f1 | tail -n 1`
31MOUNT=`grep "kernel" /boot/grub/grub.conf | tail -n 1`
32# Nur den letzten Parameter verwenden
33echo $MOUNT > /dev/null
34MOUNT=$_
609d4fa5 35OLDKERNEL=`ls /boot/vmlinuz-*-ipfire | cut -d"-" -f2 | tail -n 1`
2d9ee050 36#
2d9ee050 37echo
609d4fa5 38echo Update IPFire $OLDVERSION to $NEWVERSION
2d9ee050 39echo
2d9ee050
AF
40#
41# check if we the backup file already exist
42if [ -e /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 ]; then
45ff5fa6
AF
43 echo Moving backup to backup-old ...
44 mv -f /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 \
45 /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION-old.tar.bz2
2d9ee050
AF
46fi
47echo First we made a backup of all files that was inside of the
48echo update archive. This may take a while ...
9b50da9d 49# Add some files that are not in the package to backup
e3d5f630
AF
50echo etc/issue >> /opt/pakfire/tmp/ROOTFILES
51echo opt/pakfire/etc/pakfire.conf >> /opt/pakfire/tmp/ROOTFILES
9b50da9d
AF
52echo var/spool/cron/root.orig >> /opt/pakfire/tmp/ROOTFILES
53echo etc/udev/rules.d/30-persistant-network.rules >> /opt/pakfire/tmp/ROOTFILES
54#
2d9ee050 55tar cjvf /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 \
e3d5f630 56 -T /opt/pakfire/tmp/ROOTFILES --exclude='#*' -C / > /dev/null 2>&1
2d9ee050
AF
57echo
58echo Update IPfire to $NEWVERSON ...
59#
159a9efd
CS
60# Delete old collectd symlink
61#
62rm -rf /etc/rc.d/rc3.d/S20collectd
63#
2d9ee050
AF
64# Backup the old grub config
65#
66mv /boot/grub/grub.conf /boot/grub/grub-old.conf
67#
9b50da9d
AF
68# Remove the kernel modules of the new kernel (only needed if this update run
69# over an already updated system)
70#
71rm -rf /lib/modules/$KVER-ipfire
72#
2d9ee050
AF
73# Unpack the updated files
74#
75echo
76echo Unpack the updated files ...
4378d325 77extract_files
2d9ee050
AF
78#
79# Modify grub.conf
609d4fa5
AF
80#
81echo
2d9ee050 82echo Update grub configuration ...
609d4fa5 83sed -i "s|ROOT|$ROOT|g" /boot/grub/grub.conf
2d9ee050
AF
84sed -i "s|KVER|$KVER|g" /boot/grub/grub.conf
85sed -i "s|MOUNT|$MOUNT|g" /boot/grub/grub.conf
86echo "title Old Kernel" >> /boot/grub/grub.conf
609d4fa5
AF
87echo " configfile /grub/grub-old.conf" >> /boot/grub/grub.conf
88sed -i "s|/vmlinuz-ipfire|/vmlinuz-$OLDKERNEL-ipfire|g" /boot/grub/grub-old.conf
2d9ee050 89#
edd66ab6
AF
90# Made emergency - initramdisk
91#
e3d5f630
AF
92echo
93echo Create new Initramdisks ...
edd66ab6
AF
94cp -f /etc/mkinitcpio.conf /etc/mkinitcpio.conf.org
95sed -i "s| autodetect | |g" /etc/mkinitcpio.conf
e3d5f630 96mkinitcpio -k $KVER-ipfire -g /boot/ipfirerd-$KVER-emergency.img
edd66ab6
AF
97cp -f /etc/mkinitcpio.conf.org /etc/mkinitcpio.conf
98#
2d9ee050
AF
99# Made initramdisk
100#
2d9ee050
AF
101if [ "${ROOT:0:7}" == "/dev/sd" ]; then
102 # Remove ide hook if root is on sda
103 sed -i "s| ide | |g" /etc/mkinitcpio.conf
104else
105if [ "${ROOT:0:7}" == "/dev/hd" ]; then
2e95c21c 106 # Remove pata & sata hook if root is on hda
2d9ee050 107 sed -i "s| pata | |g" /etc/mkinitcpio.conf
2e95c21c 108 sed -i "s| sata | |g" /etc/mkinitcpio.conf
2d9ee050
AF
109fi
110fi
111mkinitcpio -k $KVER-ipfire -g /boot/ipfirerd-$KVER.img
fd383f41 112#mkinitcpio -k $KVER-ipfire-smp -g /boot/ipfirerd-$KVER-smp.img
2d9ee050
AF
113#
114# Change version of Pakfire.conf
115#
116sed -i "s|$OLDVERSION|$NEWVERSION|g" /opt/pakfire/etc/pakfire.conf
609d4fa5
AF
117#
118# Create new issue
119#
30abd974 120echo IPFire v$NEWVERSION - www.ipfire.org > /etc/issue
609d4fa5
AF
121echo =================================== >> /etc/issue
122echo \\n running on \\s \\r \\m >> /etc/issue
9b50da9d
AF
123#
124# Update crontab
125#
126grep -v "ipacsum" /var/spool/cron/root.orig > /tmp/root.orig.tmp
127mv /tmp/root.orig.tmp /var/spool/cron/root.orig
128chmod 600 /var/spool/cron/root.orig
129chown root:cron /var/spool/cron/root.orig
130#
131# Update network-rules
132#
133sed -i 's|"net", SYSFS{"address"}|"net", SYSFS{"type"}=="1", SYSFS{"address"}|g' \
134 /etc/udev/rules.d/30-persistant-network.rules
135#
27731caa 136# Core 17 begin
609d4fa5
AF
137perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
138/etc/init.d/mISDN config
27731caa 139# Core 17 end
7795e9ba
AF
140#
141# Remove obsolete packages
142#
45ff5fa6 143echo '#!/bin/bash' > /tmp/remove_obsolete_paks
7795e9ba
AF
144echo 'while [ "$(ps -A | grep " update.sh")" != "" ]; do' >> /tmp/remove_obsolete_paks
145echo ' sleep 2' >> /tmp/remove_obsolete_paks
146echo 'done' >> /tmp/remove_obsolete_paks
147echo 'while [ "$(ps -A | grep " pakfire")" != "" ]; do' >> /tmp/remove_obsolete_paks
148echo ' sleep 2' >> /tmp/remove_obsolete_paks
149echo 'done' >> /tmp/remove_obsolete_paks
82d8ebf1
AF
150echo '/opt/pakfire/pakfire remove -y zaptel' >> /tmp/remove_obsolete_paks
151echo '/opt/pakfire/pakfire update -y --force' >> /tmp/remove_obsolete_paks
152echo '/opt/pakfire/pakfire upgrade -y' >> /tmp/remove_obsolete_paks
7795e9ba
AF
153echo 'echo' >> /tmp/remove_obsolete_paks
154echo 'echo Update to IPFire $NEWVERSION finished. Please reboot... ' >> /tmp/remove_obsolete_paks
155echo 'echo' >> /tmp/remove_obsolete_paks
156chmod +x /tmp/remove_obsolete_paks
157/tmp/remove_obsolete_paks &
609d4fa5 158echo
7795e9ba 159echo Please wait until pakfire has ended...
27731caa 160echo