mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-24 18:03:06 +02:00
Merge branch 'master' of ssh://git.ipfire.org/srv/git/ipfire-2.x
Conflicts: make.sh
This commit is contained in:
26
src/dracut/dracut.conf
Normal file
26
src/dracut/dracut.conf
Normal file
@@ -0,0 +1,26 @@
|
||||
# dracut config file
|
||||
|
||||
# Specific list of dracut modules to use
|
||||
#dracutmodules+=""
|
||||
|
||||
# Dracut modules to omit
|
||||
#omit_dracutmodules+=""
|
||||
|
||||
# Dracut modules to add to the default
|
||||
#add_dracutmodules+=""
|
||||
|
||||
# additional kernel modules to the default
|
||||
#add_drivers+=""
|
||||
|
||||
# list of kernel filesystem modules to be included in the generic initramfs
|
||||
filesystems+="ext2 ext3 ext4 reiserfs reiser4 iso9660 vfat"
|
||||
|
||||
# build initrd only to boot current hardware
|
||||
#hostonly="yes"
|
||||
#
|
||||
|
||||
# install local /etc/mdadm.conf
|
||||
mdadmconf="no"
|
||||
|
||||
# install local /etc/lvm/lvm.conf
|
||||
lvmconf="no"
|
||||
188
src/dracut/switch_root.c
Normal file
188
src/dracut/switch_root.c
Normal file
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* switchroot.c - switch to new root directory and start init.
|
||||
*
|
||||
* Copyright 2002-2008 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Peter Jones <pjones@redhat.com>
|
||||
* Jeremy Katz <katzj@redhat.com>
|
||||
*/
|
||||
#include <sys/mount.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#ifndef MS_MOVE
|
||||
#define MS_MOVE 8192
|
||||
#endif
|
||||
|
||||
enum {
|
||||
ok,
|
||||
err_no_directory,
|
||||
err_usage,
|
||||
};
|
||||
|
||||
/* remove all files/directories below dirName -- don't cross mountpoints */
|
||||
static int
|
||||
recursiveRemove(char * dirName)
|
||||
{
|
||||
struct stat sb,rb;
|
||||
DIR * dir;
|
||||
struct dirent * d;
|
||||
char * strBuf = alloca(strlen(dirName) + 1024);
|
||||
|
||||
if (!(dir = opendir(dirName))) {
|
||||
printf("error opening %s: %m\n", dirName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fstat(dirfd(dir),&rb)) {
|
||||
printf("unable to stat %s: %m\n", dirName);
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
|
||||
while ((d = readdir(dir))) {
|
||||
errno = 0;
|
||||
|
||||
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) {
|
||||
errno = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
strcpy(strBuf, dirName);
|
||||
strcat(strBuf, "/");
|
||||
strcat(strBuf, d->d_name);
|
||||
|
||||
if (lstat(strBuf, &sb)) {
|
||||
printf("failed to stat %s: %m\n", strBuf);
|
||||
errno = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* only descend into subdirectories if device is same as dir */
|
||||
if (S_ISDIR(sb.st_mode)) {
|
||||
if (sb.st_dev == rb.st_dev) {
|
||||
recursiveRemove(strBuf);
|
||||
if (rmdir(strBuf))
|
||||
printf("failed to rmdir %s: %m\n", strBuf);
|
||||
}
|
||||
errno = 0;
|
||||
continue;
|
||||
}
|
||||
if (unlink(strBuf)) {
|
||||
printf("failed to remove %s: %m\n", strBuf);
|
||||
errno = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (errno) {
|
||||
closedir(dir);
|
||||
printf("error reading from %s: %m\n", dirName);
|
||||
return 1;
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int switchroot(const char *newroot)
|
||||
{
|
||||
/* Don't try to unmount the old "/", there's no way to do it. */
|
||||
const char *umounts[] = { "/dev", "/proc", "/sys", NULL };
|
||||
int errnum;
|
||||
int i;
|
||||
|
||||
for (i = 0; umounts[i] != NULL; i++) {
|
||||
char newmount[PATH_MAX];
|
||||
strcpy(newmount, newroot);
|
||||
strcat(newmount, umounts[i]);
|
||||
if (mount(umounts[i], newmount, NULL, MS_MOVE, NULL) < 0) {
|
||||
fprintf(stderr, "Error mount moving old %s %s %m\n",
|
||||
umounts[i], newmount);
|
||||
fprintf(stderr, "Forcing unmount of %s\n", umounts[i]);
|
||||
umount2(umounts[i], MNT_FORCE);
|
||||
}
|
||||
}
|
||||
|
||||
if (chdir(newroot) < 0) {
|
||||
errnum=errno;
|
||||
fprintf(stderr, "switchroot: chdir failed: %m\n");
|
||||
errno=errnum;
|
||||
return -1;
|
||||
}
|
||||
recursiveRemove("/");
|
||||
if (mount(newroot, "/", NULL, MS_MOVE, NULL) < 0) {
|
||||
errnum = errno;
|
||||
fprintf(stderr, "switchroot: mount failed: %m\n");
|
||||
errno = errnum;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (chroot(".")) {
|
||||
errnum = errno;
|
||||
fprintf(stderr, "switchroot: chroot failed: %m\n");
|
||||
errno = errnum;
|
||||
return -2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void usage(FILE *output)
|
||||
{
|
||||
fprintf(output, "usage: switchroot <newrootdir> <init> <args to init>\n");
|
||||
if (output == stderr)
|
||||
exit(err_usage);
|
||||
exit(ok);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *newroot = argv[1];
|
||||
char *init = argv[2];
|
||||
char **initargs = &argv[2];
|
||||
|
||||
if (newroot == NULL || newroot[0] == '\0' ||
|
||||
init == NULL || init[0] == '\0' ) {
|
||||
usage(stderr);
|
||||
}
|
||||
|
||||
if (switchroot(newroot) < 0) {
|
||||
fprintf(stderr, "switchroot has failed. Sorry.\n");
|
||||
return 1;
|
||||
}
|
||||
if (access(initargs[0], X_OK))
|
||||
fprintf(stderr, "WARNING: can't access %s\n", initargs[0]);
|
||||
|
||||
/* get session leader */
|
||||
setsid();
|
||||
/* set controlling terminal */
|
||||
ioctl (0, TIOCSCTTY, 1);
|
||||
|
||||
execv(initargs[0], initargs);
|
||||
}
|
||||
|
||||
@@ -98,19 +98,17 @@ case "${1}" in
|
||||
|
||||
if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
|
||||
echo_failure
|
||||
sleep 2
|
||||
boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE}
|
||||
boot_mesg -n " were encountered that could not be"
|
||||
boot_mesg -n " fixed automatically. This system"
|
||||
boot_mesg -n " cannot continue to boot and will"
|
||||
boot_mesg -n " therefore be halted until those"
|
||||
boot_mesg -n " errors are fixed manually by a"
|
||||
boot_mesg -n " System Administrator.\n\nAfter you"
|
||||
boot_mesg -n " press Enter, this system will be"
|
||||
boot_mesg -n " halted and powered off."
|
||||
boot_mesg -n "\n\nPress Enter to continue or wait a minute..." ${INFO}
|
||||
boot_mesg -n " System Administrator.\n\n"
|
||||
boot_mesg "" ${NORMAL}
|
||||
read -t 60 ENTER
|
||||
${rc_base}/init.d/halt stop
|
||||
sulogin
|
||||
reboot -f
|
||||
fi
|
||||
|
||||
if [ "${error_value}" -ge 16 ]; then
|
||||
|
||||
@@ -17,10 +17,16 @@
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
#Skip if root is set by UUID
|
||||
if (grep "root=UUID=" /proc/cmdline > /dev/null); then
|
||||
exit 0;
|
||||
fi
|
||||
boot_mesg "Checking fstab bootdevice ..."
|
||||
ROOTPOS=`expr index "$CMDLINE" root=`
|
||||
read CMDLINE < /proc/cmdline
|
||||
ROOTPOS=${CMDLINE%%root=*}
|
||||
ROOTPOS=${#ROOTPOS}
|
||||
NEWROOT=`echo ${CMDLINE:$ROOTPOS} | cut -d"=" -f2 | cut -d" " -f1`;
|
||||
OLDBOOT=`cat /etc/fstab | grep -m1 "/boot" | cut -d" " -f1 | cut -f1`;
|
||||
OLDBOOT=`cat /etc/fstab | grep -m1 " / " | cut -d" " -f1 | cut -f1`;
|
||||
OLDDRV=${OLDBOOT::`expr length $OLDBOOT`-1}
|
||||
NEWDRV=${NEWROOT::`expr length $NEWROOT`-1}
|
||||
if [ "$OLDDRV" == "$NEWDRV" ]; then
|
||||
@@ -33,6 +39,15 @@ case "${1}" in
|
||||
boot_mesg "Bootdrive: $NEWDRV"
|
||||
boot_mesg "fstab-entry: $OLDDRV"
|
||||
boot_mesg
|
||||
if [ "${OLDDRV:0:4}" == "UUID" ]; then
|
||||
#Short sleep because the kernel has not finished hardware detections
|
||||
#and made many messages here and the password question is not readable
|
||||
sleep 3
|
||||
boot_mesg "${FAILURE}Error OLD Bootdrive is already a UUID. Can't fix."
|
||||
boot_mesg "${NORMAL}"
|
||||
sulogin
|
||||
reboot -f
|
||||
fi
|
||||
boot_mesg "Attempt to repair it ..."
|
||||
mount -o remount,rw /
|
||||
sed -i -e "s|$OLDDRV|$NEWDRV|g" /etc/fstab
|
||||
|
||||
71
src/initscripts/init.d/client175
Normal file
71
src/initscripts/init.d/client175
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/
|
||||
#
|
||||
# Description : Client175 (MPD Client with Webinterface)
|
||||
#
|
||||
# Author : Arne Fitzenreiter
|
||||
#
|
||||
# Version : 01.00
|
||||
#
|
||||
# Notes : for www.ipfire.org - GPLv3
|
||||
#
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -e /var/run/client175.pid ]; then
|
||||
if ps -p $(cat /var/run/client175.pid) > /dev/null
|
||||
then
|
||||
boot_mesg "Client175 is already running."
|
||||
echo_failure
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
boot_mesg "Starting Client175 MPD WebIF..."
|
||||
sudo -u nobody python /srv/client175/server.py > /var/log/client175 2>&1 &
|
||||
echo $! > /var/run/client175.pid
|
||||
evaluate_retval
|
||||
;;
|
||||
|
||||
stop)
|
||||
if [ ! -e /var/run/client175.pid ]; then
|
||||
boot_mesg "Client175 pidfile not found!"
|
||||
echo_failure
|
||||
exit 0
|
||||
fi
|
||||
boot_mesg "Stopping Client175 MPD WebIF..."
|
||||
kill $(cat /var/run/client175.pid)
|
||||
evaluate_retval
|
||||
rm -f /var/run/client175.pid
|
||||
;;
|
||||
|
||||
restart)
|
||||
${0} stop
|
||||
sleep 1
|
||||
${0} start
|
||||
|
||||
;;
|
||||
status)
|
||||
if [ -e /var/run/client175.pid ]; then
|
||||
if ps -p $(cat /var/run/client175.pid) > /dev/null
|
||||
then
|
||||
|
||||
boot_mesg "Client175 is running with Process Id(s) $(cat /var/run/client175.pid)"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
boot_mesg "Client175 should not running"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start|stop|reload|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/
|
||||
@@ -6,7 +6,7 @@
|
||||
#
|
||||
# Authors : Arne Fitzenreiter - arne_f@ipfire.org
|
||||
#
|
||||
# Version : 01.00
|
||||
# Version : 01.01
|
||||
#
|
||||
# Notes :
|
||||
#
|
||||
@@ -21,7 +21,7 @@ case "${1}" in
|
||||
|
||||
# try cpufreq hardware depend modules
|
||||
for i in $(find /lib/modules/$(uname -r)/kernel/arch/x86/kernel/cpu/cpufreq \
|
||||
! -name speedstep-lib.ko | sort -d -r); do
|
||||
! -name speedstep-lib.ko ! -name p4-clockmod.ko | sort -d -r); do
|
||||
module=$(basename $i | cut -d. -f1);
|
||||
modprobe $module > /dev/null 2>&1;
|
||||
if [ ${?} = 0 ]; then
|
||||
|
||||
9
src/initscripts/init.d/firstsetup
Normal file
9
src/initscripts/init.d/firstsetup
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
export LANG=en_US.utf8
|
||||
/usr/local/sbin/setup /dev/tty2 INSTALL
|
||||
echo Restarting udev...
|
||||
killall udevd
|
||||
/sbin/udevd --daemon
|
||||
/sbin/udevadm trigger
|
||||
/sbin/udevadm settle
|
||||
rm -f /etc/rc.d/rcsysinit.d/S75firstsetup
|
||||
@@ -74,7 +74,7 @@ case "${1}" in
|
||||
fi
|
||||
fi
|
||||
|
||||
/usr/sbin/iwconfig $INTERFACE channel $CHANNEL
|
||||
/usr/sbin/iwconfig $INTERFACE channel $CHANNEL 2>/dev/null
|
||||
/usr/sbin/iwconfig $INTERFACE txpower $TXPOWER
|
||||
|
||||
/usr/bin/hostapd -P /var/run/hostapd /etc/hostapd.conf >/dev/null 2>&1 &
|
||||
|
||||
@@ -57,8 +57,8 @@ case "$1" in
|
||||
fi
|
||||
if [ -e /var/ipfire/proxy/enable -o -e /var/ipfire/proxy/enable_blue ]; then
|
||||
boot_mesg "Starting Squid Proxy Server..."
|
||||
loadproc /usr/sbin/squid -D -z >/dev/null 2>&1
|
||||
loadproc /usr/sbin/squid -D
|
||||
loadproc /usr/sbin/squid -z >/dev/null 2>&1
|
||||
loadproc /usr/sbin/squid
|
||||
fi
|
||||
|
||||
eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
|
||||
|
||||
@@ -60,10 +60,10 @@ case "${1}" in
|
||||
|
||||
# Now traverse /sys in order to "coldplug" devices that have
|
||||
# already been discovered
|
||||
/sbin/udevtrigger
|
||||
/sbin/udevadm trigger
|
||||
|
||||
# Now wait for udevd to process the uevents we triggered
|
||||
/sbin/udevsettle
|
||||
/sbin/udevadm settle
|
||||
evaluate_retval
|
||||
|
||||
;;
|
||||
|
||||
@@ -26,7 +26,7 @@ case "${1}" in
|
||||
done 2>/dev/null
|
||||
|
||||
# Now wait for udevd to process the uevents we triggered
|
||||
/sbin/udevsettle
|
||||
/sbin/udevadm settle
|
||||
evaluate_retval
|
||||
;;
|
||||
|
||||
|
||||
55
src/install+setup/install/downloadsource.sh
Normal file
55
src/install+setup/install/downloadsource.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2010 IPFire Team <info@ipfire.org> #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
# Path for testing. Need to be changed for release!
|
||||
IPFireISO=people.ipfire.org/~arne_f/testing/next/ipfire.iso
|
||||
#IPFireISO=download.ipfire.org/iso/ipfire.iso
|
||||
|
||||
#Get user defined download from boot cmdline
|
||||
grep "netinstall=" /proc/cmdline > /dev/null && CMDLINE=1
|
||||
if ( [ "$CMDLINE" == "1" ]); then
|
||||
read CMDLINE < /proc/cmdline
|
||||
POS=${CMDLINE%%netinstall*}
|
||||
POS=${#POS}
|
||||
IPFireISO=`echo ${CMDLINE:POS} | cut -d"=" -f2 | cut -d" " -f1`
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Configure Network with DHCP..."
|
||||
dhcpcd
|
||||
echo
|
||||
echo "Sleep 15s..."
|
||||
sleep 15
|
||||
echo
|
||||
echo "Download with wget..."
|
||||
wget $IPFireISO -O /tmp/download.iso -t3 -U IPFire_NetInstall/2.x
|
||||
echo
|
||||
echo "Checking download..."
|
||||
mount /tmp/download.iso -o loop /cdrom 2> /dev/null
|
||||
if [ -n "$(ls /cdrom/ipfire-*.tlz 2>/dev/null)" ]; then
|
||||
echo -n "null" > /tmp/source_device
|
||||
echo "Found tarball in /tmp/download.iso"
|
||||
exit 0
|
||||
else
|
||||
echo "Found no tarballs in /tmp/download.iso - SKIP"
|
||||
fi
|
||||
umount /cdrom 2> /dev/null
|
||||
exit 10
|
||||
@@ -15,8 +15,9 @@
|
||||
#define UNATTENDED_CONF "/cdrom/boot/unattended.conf"
|
||||
|
||||
#define EXT2 0
|
||||
#define REISERFS 2
|
||||
#define EXT3 1
|
||||
#define EXT4 2
|
||||
#define REISERFS 3
|
||||
|
||||
FILE *flog = NULL;
|
||||
char *mylog;
|
||||
@@ -35,6 +36,9 @@ extern char *fr_tr[];
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
char discl_msg[40000] = "Disclaimer\n";
|
||||
|
||||
char *langnames[] = { "Deutsch", "English", "Français", "Español", NULL };
|
||||
char *shortlangnames[] = { "de", "en", "fr", "es", NULL };
|
||||
char **langtrs[] = { de_tr, en_tr, fr_tr, es_tr, NULL };
|
||||
@@ -44,8 +48,8 @@ int main(int argc, char *argv[])
|
||||
int rc = 0;
|
||||
char commandstring[STRING_SIZE];
|
||||
char mkfscommand[STRING_SIZE];
|
||||
char *fstypes[] = { "ext2", "ext3", "ReiserFS", NULL };
|
||||
int fstype = REISERFS;
|
||||
char *fstypes[] = { "ext2", "ext3", "ext4", "ReiserFS", NULL };
|
||||
int fstype = EXT3;
|
||||
int choice;
|
||||
int i;
|
||||
int found = 0;
|
||||
@@ -57,7 +61,7 @@ int main(int argc, char *argv[])
|
||||
int allok_fastexit=0;
|
||||
int raid_disk = 0;
|
||||
struct keyvalue *ethernetkv = initkeyvalues();
|
||||
FILE *handle, *cmdfile;
|
||||
FILE *handle, *cmdfile, *copying;
|
||||
char line[STRING_SIZE];
|
||||
char string[STRING_SIZE];
|
||||
long memory = 0, disk = 0, free;
|
||||
@@ -108,31 +112,20 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// Load ata-piix prior kudzu because kudzu use ata-generic for ich7
|
||||
mysystem("/sbin/modprobe ata_piix");
|
||||
|
||||
// Starting hardware detection
|
||||
runcommandwithstatus("/bin/probehw.sh", "Probing Hardware ...");
|
||||
// Read gpl ...
|
||||
if (! (copying = fopen("/COPYING", "r")))
|
||||
{
|
||||
fprintf(flog, "Couldn't open gpl (/COPYING)\n");
|
||||
sprintf(discl_msg, "Couldn't open gpl (/COPYING)\n");
|
||||
} else {
|
||||
fread(discl_msg, 1, 40000, copying);
|
||||
fclose(copying);
|
||||
}
|
||||
|
||||
// Load common modules
|
||||
mysystem("/sbin/modprobe ide-generic");
|
||||
mysystem("/sbin/modprobe ide-cd");
|
||||
mysystem("/sbin/modprobe ide-disk");
|
||||
mysystem("/sbin/modprobe ehci-hcd");
|
||||
mysystem("/sbin/modprobe uhci-hcd");
|
||||
mysystem("/sbin/modprobe ohci-hcd");
|
||||
mysystem("/sbin/modprobe ohci1394");
|
||||
mysystem("/sbin/modprobe sd_mod");
|
||||
mysystem("/sbin/modprobe sr_mod");
|
||||
mysystem("/sbin/modprobe usb-storage");
|
||||
mysystem("/sbin/modprobe usbhid");
|
||||
mysystem("/sbin/modprobe ahci");
|
||||
|
||||
mysystem("/sbin/modprobe iso9660"); // CDROM
|
||||
mysystem("/sbin/modprobe ext2"); // Boot patition
|
||||
mysystem("/sbin/modprobe vfat"); // USB key
|
||||
|
||||
runcommandwithstatus("/bin/sleep 10", "Waiting for USB Hardware ...");
|
||||
|
||||
/* German is the default */
|
||||
for (choice = 0; langnames[choice]; choice++)
|
||||
@@ -156,19 +149,24 @@ int main(int argc, char *argv[])
|
||||
sprintf(message, ctr[TR_WELCOME], NAME);
|
||||
newtWinMessage(title, ctr[TR_OK], message);
|
||||
|
||||
switch (mysystem("/bin/mountsource.sh")) {
|
||||
case 0:
|
||||
break;
|
||||
case 10:
|
||||
errorbox(ctr[TR_NO_CDROM]);
|
||||
goto EXIT;
|
||||
if (!unattended) {
|
||||
if (disclaimerbox(discl_msg)==0) {
|
||||
errorbox(ctr[TR_LICENSE_NOT_ACCEPTED]);
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
/* read source drive letter */
|
||||
mysystem("/bin/mountsource.sh");
|
||||
|
||||
if ((handle = fopen("/tmp/source_device", "r")) == NULL) {
|
||||
errorbox(ctr[TR_ERROR_PROBING_CDROM]);
|
||||
goto EXIT;
|
||||
newtWinMessage(title, ctr[TR_OK], ctr[TR_NO_LOCAL_SOURCE]);
|
||||
runcommandwithstatus("/bin/downloadsource.sh",ctr[TR_DOWNLOADING_ISO]);
|
||||
if ((handle = fopen("/tmp/source_device", "r")) == NULL) {
|
||||
errorbox(ctr[TR_DOWNLOAD_ERROR]);
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
fgets(sourcedrive, 5, handle);
|
||||
fprintf(flog, "Source drive: %s\n", sourcedrive);
|
||||
fclose(handle);
|
||||
@@ -231,11 +229,6 @@ int main(int argc, char *argv[])
|
||||
sprintf(hdparams.devnode_part, "/dev/%s%s", harddrive,raid_disk ? "p" : "");
|
||||
/* Now the names after the machine is booted. Only scsi is affected
|
||||
and we only install on the first scsi disk. */
|
||||
{ char tmp[30];
|
||||
strcpy(tmp, scsi_disk ? "sda" : harddrive);
|
||||
sprintf(hdparams.devnode_disk_run, "/dev/%s", tmp);
|
||||
sprintf(hdparams.devnode_part_run, "/dev/%s%s", tmp, raid_disk ? "p" : "");
|
||||
}
|
||||
|
||||
fprintf(flog, "Destination drive: %s\n", hdparams.devnode_disk);
|
||||
|
||||
@@ -259,6 +252,12 @@ int main(int argc, char *argv[])
|
||||
if (rc == 2)
|
||||
goto EXIT;
|
||||
|
||||
fstypes[0]=ctr[TR_EXT2FS_DESCR];
|
||||
fstypes[1]=ctr[TR_EXT3FS_DESCR];
|
||||
fstypes[2]=ctr[TR_EXT4FS_DESCR];
|
||||
fstypes[3]=ctr[TR_REISERFS_DESCR];
|
||||
fstypes[4]=NULL;
|
||||
|
||||
if (!unattended) {
|
||||
sprintf(message, ctr[TR_CHOOSE_FILESYSTEM]);
|
||||
rc = newtWinMenu( ctr[TR_CHOOSE_FILESYSTEM], message,
|
||||
@@ -266,7 +265,7 @@ int main(int argc, char *argv[])
|
||||
ctr[TR_CANCEL], NULL);
|
||||
} else {
|
||||
rc = 1;
|
||||
fstype = REISERFS;
|
||||
fstype = EXT3;
|
||||
}
|
||||
if (rc == 2)
|
||||
goto EXIT;
|
||||
@@ -288,7 +287,7 @@ int main(int argc, char *argv[])
|
||||
* the disk.
|
||||
*/
|
||||
/* Don't use mysystem here so we can redirect output */
|
||||
sprintf(commandstring, "/bin/sfdisk -s /dev/%s > /tmp/disksize 2> /dev/null", harddrive);
|
||||
sprintf(commandstring, "/sbin/sfdisk -s /dev/%s > /tmp/disksize 2> /dev/null", harddrive);
|
||||
system(commandstring);
|
||||
|
||||
/* Calculate amount of disk space */
|
||||
@@ -360,7 +359,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
fclose(handle);
|
||||
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/sfdisk -L -uM %s < /tmp/partitiontable", hdparams.devnode_disk);
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/sfdisk -L -uM %s < /tmp/partitiontable", hdparams.devnode_disk);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_PARTITIONING_DISK]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_PARTITION]);
|
||||
@@ -369,16 +368,19 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (fstype == EXT2) {
|
||||
mysystem("/sbin/modprobe ext2");
|
||||
sprintf(mkfscommand, "/sbin/mke2fs -T ext2 -c");
|
||||
sprintf(mkfscommand, "/sbin/mke2fs -T ext2");
|
||||
} else if (fstype == REISERFS) {
|
||||
mysystem("/sbin/modprobe reiserfs");
|
||||
sprintf(mkfscommand, "/sbin/mkreiserfs -f");
|
||||
} else if (fstype == EXT3) {
|
||||
mysystem("/sbin/modprobe ext3");
|
||||
sprintf(mkfscommand, "/sbin/mke2fs -T ext3 -c");
|
||||
sprintf(mkfscommand, "/sbin/mke2fs -T ext3");
|
||||
} else if (fstype == EXT4) {
|
||||
mysystem("/sbin/modprobe ext4");
|
||||
sprintf(mkfscommand, "/sbin/mke2fs -T ext4");
|
||||
}
|
||||
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mke2fs -T ext2 -c %s1", hdparams.devnode_part);
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/mke2fs -T ext2 -I 128 %s1", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_MAKING_BOOT_FILESYSTEM]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_MAKE_BOOT_FILESYSTEM]);
|
||||
@@ -441,7 +443,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
snprintf(commandstring, STRING_SIZE,
|
||||
"/bin/tar -C /harddisk -xvf /cdrom/" SNAME "-" VERSION ".tlz --lzma");
|
||||
"/bin/tar -C /harddisk -xvf /cdrom/" SNAME "-" VERSION ".tlz --lzma 2>/dev/null");
|
||||
|
||||
if (runcommandwithprogress(60, 4, title, commandstring, INST_FILECOUNT,
|
||||
ctr[TR_INSTALLING_FILES]))
|
||||
@@ -453,17 +455,6 @@ int main(int argc, char *argv[])
|
||||
/* Save language und local settings */
|
||||
write_lang_configs(shortlangname);
|
||||
|
||||
/* touch the modules.dep files */
|
||||
snprintf(commandstring, STRING_SIZE,
|
||||
"/bin/touch /harddisk/lib/modules/%s-ipfire/modules.dep",
|
||||
KERNEL_VERSION);
|
||||
mysystem(commandstring);
|
||||
/* snprintf(commandstring, STRING_SIZE,
|
||||
"/bin/touch /harddisk/lib/modules/%s-ipfire-smp/modules.dep",
|
||||
KERNEL_VERSION);
|
||||
mysystem(commandstring);
|
||||
*/
|
||||
|
||||
/* Rename uname */
|
||||
rename ("/harddisk/bin/uname.bak", "/harddisk/bin/uname");
|
||||
|
||||
@@ -474,7 +465,7 @@ int main(int argc, char *argv[])
|
||||
mysystem("/bin/mount --bind /sys /harddisk/sys");
|
||||
|
||||
/* Build cache lang file */
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /usr/bin/perl -e \"require '" CONFIG_ROOT "/lang.pl'; &Lang::BuildCacheLang\"");
|
||||
snprintf(commandstring, STRING_SIZE, "/usr/sbin/chroot /harddisk /usr/bin/perl -e \"require '" CONFIG_ROOT "/lang.pl'; &Lang::BuildCacheLang\"");
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_LANG_CACHE]))
|
||||
{
|
||||
errorbox(ctr[TR_UNABLE_TO_INSTALL_LANG_CACHE]);
|
||||
@@ -482,8 +473,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Update /etc/fstab */
|
||||
replace("/harddisk/etc/fstab", "DEVICE", hdparams.devnode_part_run);
|
||||
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/sed -i -e \"s#DEVICE1#UUID=$(/sbin/blkid %s1 -sUUID | /usr/bin/cut -d'\"' -f2)#g\" /harddisk/etc/fstab", hdparams.devnode_part);
|
||||
system(commandstring);
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/sed -i -e \"s#DEVICE2#UUID=$(/sbin/blkid %s2 -sUUID | /usr/bin/cut -d'\"' -f2)#g\" /harddisk/etc/fstab", hdparams.devnode_part);
|
||||
system(commandstring);
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/sed -i -e \"s#DEVICE3#UUID=$(/sbin/blkid %s3 -sUUID | /usr/bin/cut -d'\"' -f2)#g\" /harddisk/etc/fstab", hdparams.devnode_part);
|
||||
system(commandstring);
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/sed -i -e \"s#DEVICE4#UUID=$(/sbin/blkid %s4 -sUUID | /usr/bin/cut -d'\"' -f2)#g\" /harddisk/etc/fstab", hdparams.devnode_part);
|
||||
system(commandstring);
|
||||
|
||||
if (fstype == EXT2) {
|
||||
replace("/harddisk/etc/fstab", "FSTYPE", "ext2");
|
||||
replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
|
||||
@@ -491,61 +489,24 @@ int main(int argc, char *argv[])
|
||||
replace("/harddisk/etc/fstab", "FSTYPE", "reiserfs");
|
||||
replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
|
||||
} else if (fstype == EXT3) {
|
||||
snprintf(commandstring, STRING_SIZE, "tune2fs -j %s3", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_JOURNAL_EXT3]))
|
||||
{
|
||||
errorbox(ctr[TR_JOURNAL_ERROR]);
|
||||
replace("/harddisk/etc/fstab", "FSTYPE", "ext2");
|
||||
goto NOJOURNAL;
|
||||
}
|
||||
snprintf(commandstring, STRING_SIZE, "tune2fs -j %s4", hdparams.devnode_part);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_JOURNAL_EXT3]))
|
||||
{
|
||||
errorbox(ctr[TR_JOURNAL_ERROR]);
|
||||
replace("/harddisk/etc/fstab", "FSTYPE", "ext2");
|
||||
goto NOJOURNAL;
|
||||
}
|
||||
replace("/harddisk/etc/fstab", "FSTYPE", "ext3");
|
||||
NOJOURNAL:
|
||||
replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
|
||||
} else if (fstype == EXT4) {
|
||||
replace("/harddisk/etc/fstab", "FSTYPE", "ext4");
|
||||
replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
|
||||
}
|
||||
|
||||
replace("/harddisk/boot/grub/grub.conf", "KVER", KERNEL_VERSION);
|
||||
|
||||
/* Build the emergency ramdisk with all drivers */
|
||||
mysystem("cp -f /harddisk/etc/mkinitcpio.conf /harddisk/etc/mkinitcpio.conf.org");
|
||||
snprintf(commandstring, STRING_SIZE, "/bin/sed -i -e \"s#root=ROOT#root=UUID=$(/sbin/blkid %s3 -sUUID | /usr/bin/cut -d'\"' -f2)#g\" /harddisk/boot/grub/grub.conf", hdparams.devnode_part);
|
||||
system(commandstring);
|
||||
|
||||
replace("/harddisk/etc/mkinitcpio.conf", " autodetect ", " ");
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd-%s-emergency.img -k %s-ipfire", KERNEL_VERSION, KERNEL_VERSION);
|
||||
runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
|
||||
|
||||
mysystem("cp -f /harddisk/etc/mkinitcpio.conf.org /harddisk/etc/mkinitcpio.conf");
|
||||
|
||||
/* mkinitcpio has a problem if ide and pata are included */
|
||||
if ( scsi_disk==1 ) {
|
||||
/* Remove the ide hook if we install sda */
|
||||
replace("/harddisk/etc/mkinitcpio.conf", " ide ", " ");
|
||||
} else {
|
||||
/* Remove the pata & sata hook if we install hda */
|
||||
replace("/harddisk/etc/mkinitcpio.conf", " pata ", " ");
|
||||
replace("/harddisk/etc/mkinitcpio.conf", " sata ", " ");
|
||||
}
|
||||
/* Going to make our initrd... */
|
||||
snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd-%s.img -k %s-ipfire", KERNEL_VERSION, KERNEL_VERSION);
|
||||
runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
|
||||
/* snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd-%s-smp.img -k %s-ipfire-smp", KERNEL_VERSION, KERNEL_VERSION );
|
||||
runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
|
||||
*/
|
||||
|
||||
|
||||
sprintf(string, "root=%s3", hdparams.devnode_part_run);
|
||||
replace( "/harddisk/boot/grub/grub.conf", "root=ROOT", string);
|
||||
mysystem("ln -s grub.conf /harddisk/boot/grub/menu.lst");
|
||||
|
||||
system("sed -e 's#/harddisk#/#g' -e 's#//#/#g' < /proc/mounts > /harddisk/etc/mtab");
|
||||
system("/bin/sed -e 's#/harddisk#/#g' -e 's#//#/#g' < /proc/mounts > /harddisk/etc/mtab");
|
||||
|
||||
snprintf(commandstring, STRING_SIZE,
|
||||
"/sbin/chroot /harddisk /usr/sbin/grub-install --no-floppy %s", hdparams.devnode_disk);
|
||||
"/usr/sbin/chroot /harddisk /usr/sbin/grub-install --no-floppy %s", hdparams.devnode_disk);
|
||||
if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_GRUB])) {
|
||||
errorbox(ctr[TR_UNABLE_TO_INSTALL_GRUB]);
|
||||
goto EXIT;
|
||||
@@ -560,7 +521,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
mysystem("umount /cdrom");
|
||||
snprintf(commandstring, STRING_SIZE, "eject /dev/%s", sourcedrive);
|
||||
snprintf(commandstring, STRING_SIZE, "/usr/bin/eject /dev/%s", sourcedrive);
|
||||
mysystem(commandstring);
|
||||
|
||||
if (!unattended) {
|
||||
@@ -596,10 +557,10 @@ EXIT:
|
||||
fclose(flog);
|
||||
newtFinished();
|
||||
|
||||
if (!unattended) {
|
||||
if (system("/sbin/chroot /harddisk /usr/local/sbin/setup /dev/tty2 INSTALL"))
|
||||
printf("Unable to run setup.\n");
|
||||
}
|
||||
// if (!unattended) {
|
||||
// if (system("/usr/sbin/chroot /harddisk /usr/local/sbin/setup /dev/tty2 INSTALL"))
|
||||
// printf("Unable to run setup.\n");
|
||||
// }
|
||||
|
||||
if (system("/bin/umount /harddisk/proc"))
|
||||
printf("Unable to umount /harddisk/proc.\n");
|
||||
@@ -624,8 +585,9 @@ EXIT:
|
||||
system("/bin/umount /harddisk/var");
|
||||
system("/bin/umount /harddisk/boot");
|
||||
system("/bin/umount /harddisk");
|
||||
|
||||
system("/etc/halt");
|
||||
|
||||
if (!(allok))
|
||||
system("/etc/halt");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@ void reboot(void);
|
||||
void stripnl(char *s);
|
||||
int mysystem(char *command);
|
||||
void errorbox(char *message);
|
||||
int statuswindowscroll(int width, int height, char *title, char *text, ...);
|
||||
int disclaimerbox(char *message);
|
||||
void statuswindow(int width, int height, char *title, char *text, ...);
|
||||
int runcommandwithprogress(int width, int height, char *title, char *command,
|
||||
int lines, char *text, ...);
|
||||
|
||||
@@ -45,6 +45,61 @@ void errorbox(char *message)
|
||||
newtWinMessage(ctr[TR_ERROR], ctr[TR_OK], message);
|
||||
}
|
||||
|
||||
int scrollmsgbox(int width, int height, char *title, char *text, ...)
|
||||
{
|
||||
int rc = 0;
|
||||
newtComponent t, f, b, c;
|
||||
char *buf = NULL;
|
||||
char checkbox;
|
||||
int size = 0;
|
||||
int i = 0;
|
||||
va_list args;
|
||||
|
||||
va_start(args, text);
|
||||
|
||||
do {
|
||||
size += 40000;
|
||||
if (buf) free(buf);
|
||||
buf = malloc(size);
|
||||
i = vsnprintf(buf, size, text, args);
|
||||
} while (i == size);
|
||||
|
||||
va_end(args);
|
||||
|
||||
newtCenteredWindow(width, height, title);
|
||||
|
||||
b = newtCompactButton(width - 15 ,height - 2, ctr[TR_OK]);
|
||||
c = newtCheckbox(3, height - 2, ctr[TR_LICENSE_ACCEPT], ' ', " *", &checkbox);
|
||||
|
||||
t = newtTextbox(1, 1, width - 2, height - 4, NEWT_TEXTBOX_WRAP+NEWT_TEXTBOX_SCROLL);
|
||||
newtTextboxSetText(t, buf);
|
||||
|
||||
f = newtForm(NULL, NULL, 0);
|
||||
free(buf);
|
||||
|
||||
newtFormAddComponent(f, c);
|
||||
newtFormAddComponent(f, b);
|
||||
newtFormAddComponent(f, t);
|
||||
|
||||
newtRunForm(f);
|
||||
if (checkbox=='*') rc=1;
|
||||
newtFormDestroy(f);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int disclaimerbox(char *message)
|
||||
{
|
||||
int rc;
|
||||
char title[STRING_SIZE];
|
||||
|
||||
sprintf (title, "%s v%s - %s", NAME, VERSION, SLOGAN);
|
||||
rc = scrollmsgbox(75, 20, title, message);
|
||||
newtPopWindow();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
void statuswindow(int width, int height, char *title, char *text, ...)
|
||||
{
|
||||
newtComponent t, f;
|
||||
|
||||
65
src/paks/linux-pae/install.sh
Normal file
65
src/paks/linux-pae/install.sh
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
############################################################################
|
||||
# #
|
||||
# This file is part of the IPFire Firewall. #
|
||||
# #
|
||||
# IPFire is free software; you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation; either version 2 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# IPFire is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with IPFire; if not, write to the Free Software #
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
# #
|
||||
# Copyright (C) 2010 IPFire-Team <info@ipfire.org>. #
|
||||
# #
|
||||
############################################################################
|
||||
#
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
extract_files
|
||||
#
|
||||
KVER=2.6.32.26
|
||||
ROOT=`mount | grep " / " | cut -d" " -f1`
|
||||
ROOTUUID=`blkid -c /dev/null -sUUID $ROOT | cut -d'"' -f2`
|
||||
if [ ! -z $ROOTUUID ]; then
|
||||
ROOT="UUID=$ROOTUUID"
|
||||
fi
|
||||
|
||||
MOUNT=`grep "kernel" /boot/grub/grub.conf | tail -n 1`
|
||||
# Nur den letzten Parameter verwenden
|
||||
echo $MOUNT > /dev/null
|
||||
MOUNT=$_
|
||||
if [ ! $MOUNT == "rw" ]; then
|
||||
MOUNT="ro"
|
||||
fi
|
||||
|
||||
ENTRY=`grep "savedefault" /boot/grub/grub.conf | tail -n 1`
|
||||
# Nur den letzten Parameter verwenden
|
||||
echo $ENTRY > /dev/null
|
||||
let ENTRY=$_+1
|
||||
#
|
||||
# backup grub.conf
|
||||
#
|
||||
cp /boot/grub/grub.conf /boot/grub/grub-backup-$KVER-pae.conf
|
||||
#
|
||||
# Add new Entry to grub.conf
|
||||
#
|
||||
echo "" >> /boot/grub/grub.conf
|
||||
echo "title IPFire (PAE-Kernel)" >> /boot/grub/grub.conf
|
||||
echo " kernel /vmlinuz-$KVER-ipfire-pae root=$ROOT rootdelay=10 panic=10 $MOUNT" >> /boot/grub/grub.conf
|
||||
echo " initrd /ipfirerd-$KVER-pae.img" >> /boot/grub/grub.conf
|
||||
echo " savedefault $ENTRY" >> /boot/grub/grub.conf
|
||||
#
|
||||
# Made initramdisk
|
||||
#
|
||||
/sbin/dracut --force --verbose /boot/ipfirerd-$KVER-pae.img $KVER-ipfire-pae
|
||||
#
|
||||
# Create new module depency
|
||||
#
|
||||
depmod -a $KVER-ipfire-pae
|
||||
26
src/paks/linux-pae/uninstall.sh
Normal file
26
src/paks/linux-pae/uninstall.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
############################################################################
|
||||
# #
|
||||
# This file is part of the IPFire Firewall. #
|
||||
# #
|
||||
# IPFire is free software; you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation; either version 2 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# IPFire is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with IPFire; if not, write to the Free Software #
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
# #
|
||||
# Copyright (C) 2010 IPFire-Team <info@ipfire.org>. #
|
||||
# #
|
||||
############################################################################
|
||||
#
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
remove_files
|
||||
mv -f /boot/grub/grub-backup-2.6.32.*-pae.conf /boot/grub/grub.conf
|
||||
27
src/paks/linux-pae/update.sh
Normal file
27
src/paks/linux-pae/update.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
############################################################################
|
||||
# #
|
||||
# This file is part of the IPFire Firewall. #
|
||||
# #
|
||||
# IPFire is free software; you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation; either version 2 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# IPFire is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with IPFire; if not, write to the Free Software #
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
# #
|
||||
# Copyright (C) 2007 IPFire-Team <info@ipfire.org>. #
|
||||
# #
|
||||
############################################################################
|
||||
#
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
#Don't remove old xen kernel at update
|
||||
#./uninstall.sh
|
||||
./install.sh
|
||||
@@ -24,12 +24,21 @@
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
extract_files
|
||||
#
|
||||
KVER=2.6.32.15
|
||||
ROOT=`grep "root=" /boot/grub/grub.conf | cut -d"=" -f2 | cut -d" " -f1 | tail -n 1`
|
||||
KVER=2.6.32.26
|
||||
ROOT=`mount | grep " / " | cut -d" " -f1`
|
||||
ROOTUUID=`blkid -c /dev/null -sUUID $ROOT | cut -d'"' -f2`
|
||||
if [ ! -z $ROOTUUID ]; then
|
||||
ROOT="UUID=$ROOTUUID"
|
||||
fi
|
||||
|
||||
MOUNT=`grep "kernel" /boot/grub/grub.conf | tail -n 1`
|
||||
# Nur den letzten Parameter verwenden
|
||||
echo $MOUNT > /dev/null
|
||||
MOUNT=$_
|
||||
if [ ! $MOUNT == "rw" ]; then
|
||||
MOUNT="ro"
|
||||
fi
|
||||
|
||||
ENTRY=`grep "savedefault" /boot/grub/grub.conf | tail -n 1`
|
||||
# Nur den letzten Parameter verwenden
|
||||
echo $ENTRY > /dev/null
|
||||
@@ -64,9 +73,7 @@ fi
|
||||
#
|
||||
# Made initramdisk
|
||||
#
|
||||
cp -f /etc/mkinitcpio.conf.org /etc/mkinitcpio.conf
|
||||
sed -i -e "s| autodetect | |g" /etc/mkinitcpio.conf
|
||||
mkinitcpio -k $KVER-ipfire-xen -g /boot/ipfirerd-$KVER-xen.img
|
||||
/sbin/dracut --force --verbose /boot/ipfirerd-$KVER-xen.img $KVER-ipfire-xen
|
||||
#
|
||||
# Create new module depency
|
||||
#
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
extract_files
|
||||
restore_backup ${NAME}
|
||||
|
||||
groupadd nut
|
||||
|
||||
ln -svf ../init.d/nut /etc/rc.d/rc0.d/K20nut
|
||||
ln -svf ../init.d/nut /etc/rc.d/rc3.d/S20nut
|
||||
ln -svf ../init.d/nut /etc/rc.d/rc6.d/K20nut
|
||||
|
||||
14
src/patches/dracut-006_lzma.patch
Normal file
14
src/patches/dracut-006_lzma.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff -Naur dracut-006.org/dracut dracut-006/dracut
|
||||
--- dracut-006.org/dracut 2010-06-17 10:46:29.000000000 +0200
|
||||
+++ dracut-006/dracut 2010-08-07 21:00:38.000000000 +0200
|
||||
@@ -308,9 +308,7 @@
|
||||
#strip -R .comment $note "$f" || :
|
||||
done
|
||||
fi
|
||||
-
|
||||
-type pigz &>/dev/null && gzip=pigz || gzip=gzip
|
||||
-( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet |$gzip -9 > "$outfile"; )
|
||||
+( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | lzma > "$outfile"; )
|
||||
if [ $? -ne 0 ]; then
|
||||
derror "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
33
src/patches/dracut-init_start_ipfireinstaller.patch
Normal file
33
src/patches/dracut-init_start_ipfireinstaller.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
diff -Naur org/init new/init
|
||||
--- init 2010-06-17 10:46:29.000000000 +0200
|
||||
+++ init 2010-08-10 17:55:41.000000000 +0200
|
||||
@@ -111,8 +111,9 @@
|
||||
getarg 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
|
||||
source_all cmdline
|
||||
|
||||
-[ -z "$root" ] && die "No or empty root= argument"
|
||||
-[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
|
||||
+# Disable root argument check ...
|
||||
+#[ -z "$root" ] && die "No or empty root= argument"
|
||||
+#[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
|
||||
|
||||
# Network root scripts may need updated root= options,
|
||||
# so deposit them where they can see them (udev purges the env)
|
||||
@@ -202,12 +203,15 @@
|
||||
done
|
||||
|
||||
i=$(($i+1))
|
||||
- [ $i -gt $RDRETRY ] \
|
||||
- && { flock -s 9 ; emergency_shell "No root device found"; } 9>/.console_lock
|
||||
+ # Start IPFire installer after root was not found ;)
|
||||
+ [ $i -gt $RDRETRY ] && break 2;
|
||||
+
|
||||
done
|
||||
unset job
|
||||
unset queuetriggered
|
||||
|
||||
+/etc/rc_installer
|
||||
+
|
||||
# pre-mount happens before we try to mount the root filesystem,
|
||||
# and happens once.
|
||||
getarg 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
|
||||
@@ -0,0 +1,37 @@
|
||||
--- linux-next.orig/mm/vmscan.c 2010-07-28 16:22:21.000000000 +0800
|
||||
+++ linux-next/mm/vmscan.c 2010-07-28 16:23:35.000000000 +0800
|
||||
@@ -324,8 +324,7 @@ typedef enum {
|
||||
* pageout is called by shrink_page_list() for each dirty page.
|
||||
* Calls ->writepage().
|
||||
*/
|
||||
-static pageout_t pageout(struct page *page, struct address_space *mapping,
|
||||
- enum pageout_io sync_writeback)
|
||||
+static pageout_t pageout(struct page *page, struct address_space *mapping)
|
||||
{
|
||||
/*
|
||||
* If the page is dirty, only perform writeback if that write
|
||||
@@ -384,14 +383,6 @@ static pageout_t pageout(struct page *pa
|
||||
return PAGE_ACTIVATE;
|
||||
}
|
||||
|
||||
- /*
|
||||
- * Wait on writeback if requested to. This happens when
|
||||
- * direct reclaiming a large contiguous area and the
|
||||
- * first attempt to free a range of pages fails.
|
||||
- */
|
||||
- if (PageWriteback(page) && sync_writeback == PAGEOUT_IO_SYNC)
|
||||
- wait_on_page_writeback(page);
|
||||
-
|
||||
if (!PageWriteback(page)) {
|
||||
/* synchronous write or broken a_ops? */
|
||||
ClearPageReclaim(page);
|
||||
@@ -727,7 +718,7 @@ static unsigned long shrink_page_list(st
|
||||
goto keep_locked;
|
||||
|
||||
/* Page is dirty, try to write it out here */
|
||||
- switch (pageout(page, mapping, sync_writeback)) {
|
||||
+ switch (pageout(page, mapping)) {
|
||||
case PAGE_KEEP:
|
||||
goto keep_locked;
|
||||
case PAGE_ACTIVATE:
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
diff -Naur udev-096.org/udev_device.c udev-096/udev_device.c
|
||||
--- udev-096.org/udev_device.c 2006-07-09 21:48:19.000000000 +0200
|
||||
+++ udev-096/udev_device.c 2009-04-28 22:04:56.000000000 +0200
|
||||
@@ -102,40 +102,8 @@
|
||||
strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ);
|
||||
retval = ioctl(sk, SIOCSIFNAME, &ifr);
|
||||
if (retval != 0) {
|
||||
- int loop;
|
||||
-
|
||||
- /* see if the destination interface name already exists */
|
||||
- if (errno != EEXIST) {
|
||||
- err("error changing netif name: %s", strerror(errno));
|
||||
- goto exit;
|
||||
- }
|
||||
-
|
||||
- /* free our own name, another process may wait for us */
|
||||
- strlcpy(ifr.ifr_newname, udev->dev->kernel_name, IFNAMSIZ);
|
||||
- strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ);
|
||||
- retval = ioctl(sk, SIOCSIFNAME, &ifr);
|
||||
- if (retval != 0) {
|
||||
- err("error changing netif name: %s", strerror(errno));
|
||||
- goto exit;
|
||||
- }
|
||||
-
|
||||
- /* wait 30 seconds for our target to become available */
|
||||
- strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ);
|
||||
- strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ);
|
||||
- loop = 30 * 20;
|
||||
- while (loop--) {
|
||||
- retval = ioctl(sk, SIOCSIFNAME, &ifr);
|
||||
- if (retval != 0) {
|
||||
- if (errno != EEXIST) {
|
||||
- err("error changing net interface name: %s", strerror(errno));
|
||||
- break;
|
||||
- }
|
||||
- dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop);
|
||||
- usleep(1000 * 1000 / 20);
|
||||
- }
|
||||
- }
|
||||
+ err("error changing netif name: %s", strerror(errno));
|
||||
}
|
||||
-
|
||||
exit:
|
||||
close(sk);
|
||||
return retval;
|
||||
47
src/patches/udev-125-netif_rename.patch
Normal file
47
src/patches/udev-125-netif_rename.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
diff -Nur udev-125.vanilla/udev_device.c udev-125/udev_device.c
|
||||
--- udev-125.vanilla/udev_device.c 2008-07-18 16:26:55.000000000 +0200
|
||||
+++ udev-125/udev_device.c 2010-07-25 18:15:12.289242450 +0200
|
||||
@@ -123,42 +123,7 @@
|
||||
if (retval == 0)
|
||||
kernel_log(ifr);
|
||||
else {
|
||||
- int loop;
|
||||
-
|
||||
- /* see if the destination interface name already exists */
|
||||
- if (errno != EEXIST) {
|
||||
- err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno));
|
||||
- goto exit;
|
||||
- }
|
||||
-
|
||||
- /* free our own name, another process may wait for us */
|
||||
- strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ);
|
||||
- strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ);
|
||||
- retval = ioctl(sk, SIOCSIFNAME, &ifr);
|
||||
- if (retval != 0) {
|
||||
- err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno));
|
||||
- goto exit;
|
||||
- }
|
||||
-
|
||||
- /* wait 30 seconds for our target to become available */
|
||||
- strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ);
|
||||
- strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ);
|
||||
- loop = 30 * 20;
|
||||
- while (loop--) {
|
||||
- retval = ioctl(sk, SIOCSIFNAME, &ifr);
|
||||
- if (retval == 0) {
|
||||
- kernel_log(ifr);
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if (errno != EEXIST) {
|
||||
- err("error changing net interface name %s to %s: %s\n",
|
||||
- ifr.ifr_name, ifr.ifr_newname, strerror(errno));
|
||||
- break;
|
||||
- }
|
||||
- dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop);
|
||||
- usleep(1000 * 1000 / 20);
|
||||
- }
|
||||
+ err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno));
|
||||
}
|
||||
|
||||
exit:
|
||||
12
src/patches/udev-config-6.2_persistent-storage-fix.patch
Normal file
12
src/patches/udev-config-6.2_persistent-storage-fix.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
diff -Naur udev-config-6.2.org/60-persistent-storage.rules udev-config-6.2/60-persistent-storage.rules
|
||||
--- udev-config-6.2.org/60-persistent-storage.rules 2006-05-13 01:03:13.000000000 +0200
|
||||
+++ udev-config-6.2/60-persistent-storage.rules 2010-08-14 11:08:35.000000000 +0200
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
# never access removable ide devices, the drivers are causing event loops on open()
|
||||
KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
|
||||
-KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end"
|
||||
+KERNEL=="hd*[0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end"
|
||||
|
||||
# for partitions import parent information
|
||||
KERNEL=="*[0-9]", IMPORT{parent}=="ID_*"
|
||||
@@ -23,21 +23,5 @@
|
||||
#
|
||||
#
|
||||
KVER=`uname -r | cut -d"-" -f1`
|
||||
ROOT=`grep "root=" /boot/grub/grub.conf | cut -d"=" -f2 | cut -d" " -f1 | tail -n 1`
|
||||
echo
|
||||
echo Rebuild the Initramdisk ...
|
||||
cp -f /etc/mkinitcpio.conf.org /etc/mkinitcpio.conf
|
||||
#
|
||||
# Made initramdisk
|
||||
#
|
||||
if [ "${ROOT:0:7}" == "/dev/sd" ]; then
|
||||
# Remove ide hook if root is on sda
|
||||
sed -i "s| ide | |g" /etc/mkinitcpio.conf
|
||||
else
|
||||
if [ "${ROOT:0:7}" == "/dev/hd" ]; then
|
||||
# Remove pata & sata hook if root is on hda
|
||||
sed -i "s| pata | |g" /etc/mkinitcpio.conf
|
||||
sed -i "s| sata | |g" /etc/mkinitcpio.conf
|
||||
fi
|
||||
fi
|
||||
mkinitcpio -k $KVER-ipfire -g /boot/ipfirerd-$KVER.img
|
||||
|
||||
dracut --force --verbose /boot/ipfirerd-$KVER.img $KVER-ipfire
|
||||
|
||||
Reference in New Issue
Block a user