]> git.ipfire.org Git - ipfire-2.x.git/blame - config/rootfiles/updater/update.sh
updater now create core-update-2.1-15
[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# #
20# Copyright (C) 2007 IPFire-Team <info@ipfire.org>. #
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"
2d9ee050
AF
29KVER="2.6.20.21"
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
43 echo Error! The backupfile of this update already exist!!!
44 echo Have you already installed this update?
45 exit 3
46fi
47echo First we made a backup of all files that was inside of the
48echo update archive. This may take a while ...
49tar cjvf /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 \
50 -T ROOTFILES --exclude='#*' -C / > /dev/null 2>&1
51echo
52echo Update IPfire to $NEWVERSON ...
53#
54# Backup the old grub config
55#
56mv /boot/grub/grub.conf /boot/grub/grub-old.conf
57#
58# Unpack the updated files
59#
60echo
61echo Unpack the updated files ...
4378d325 62extract_files
2d9ee050
AF
63#
64# Modify grub.conf
609d4fa5
AF
65#
66echo
2d9ee050 67echo Update grub configuration ...
609d4fa5 68sed -i "s|ROOT|$ROOT|g" /boot/grub/grub.conf
2d9ee050
AF
69sed -i "s|KVER|$KVER|g" /boot/grub/grub.conf
70sed -i "s|MOUNT|$MOUNT|g" /boot/grub/grub.conf
71echo "title Old Kernel" >> /boot/grub/grub.conf
609d4fa5
AF
72echo " configfile /grub/grub-old.conf" >> /boot/grub/grub.conf
73sed -i "s|/vmlinuz-ipfire|/vmlinuz-$OLDKERNEL-ipfire|g" /boot/grub/grub-old.conf
2d9ee050
AF
74#
75# Made initramdisk
76#
609d4fa5 77echo
2d9ee050
AF
78echo Create new Initramdisks ...
79if [ "${ROOT:0:7}" == "/dev/sd" ]; then
80 # Remove ide hook if root is on sda
81 sed -i "s| ide | |g" /etc/mkinitcpio.conf
82else
83if [ "${ROOT:0:7}" == "/dev/hd" ]; then
84 # Remove pata hook if root is on hda
85 sed -i "s| pata | |g" /etc/mkinitcpio.conf
86fi
87fi
88mkinitcpio -k $KVER-ipfire -g /boot/ipfirerd-$KVER.img
89mkinitcpio -k $KVER-ipfire-smp -g /boot/ipfirerd-$KVER-smp.img
90#
91# Change version of Pakfire.conf
92#
93sed -i "s|$OLDVERSION|$NEWVERSION|g" /opt/pakfire/etc/pakfire.conf
609d4fa5
AF
94#
95# Create new issue
96#
97echo IPFire v$NEWVERSION - www.ipfire.org > /etc/issue
98echo =================================== >> /etc/issue
99echo \\n running on \\s \\r \\m >> /etc/issue
100# Core 15 begin
101perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
102/etc/init.d/mISDN config
103# Core 15 end
104echo
2d9ee050 105echo
609d4fa5 106echo Update to IPFire $NEWVERSION finished. Please reboot...
2d9ee050 107echo