mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
installer: Create dracut module
There is now a new installer module for dracut which will take the installer and put it into the ramdisk.
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
/dev/ram0 / squashfs
|
||||
/proc /proc proc
|
||||
none /sys sysfs
|
||||
none /tmp tmpfs
|
||||
none /dev tmpfs
|
||||
@@ -1,4 +0,0 @@
|
||||
root:x:0:root
|
||||
tty:x:5:
|
||||
disk:x:6:
|
||||
uucp:x:14:
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Clear screen
|
||||
/usr/bin/clear
|
||||
echo "Shutting down..."
|
||||
echo "Sending all processes the TERM signal..."
|
||||
/sbin/killall5 -15
|
||||
sleep 3
|
||||
echo "Sending all processes the KILL signal..."
|
||||
/sbin/killall5 -9
|
||||
sleep 3
|
||||
echo "Unmounting filesystems..."
|
||||
/bin/umount -a > /dev/null 2>&1
|
||||
echo "Unmounting root..."
|
||||
/bin/mount -n -o remount,ro /
|
||||
echo "Rebooting..."
|
||||
/sbin/reboot -f
|
||||
@@ -1 +0,0 @@
|
||||
localhost 127.0.0.1
|
||||
@@ -1,15 +0,0 @@
|
||||
passwd: files
|
||||
shadow: files
|
||||
group: files
|
||||
hosts: files
|
||||
services: files
|
||||
networks: files
|
||||
protocols: files
|
||||
rpc: files
|
||||
ethers: files
|
||||
netmasks: files
|
||||
bootparams: files
|
||||
automount: files
|
||||
aliases: files
|
||||
netgroup: files
|
||||
publickey: files
|
||||
@@ -1 +0,0 @@
|
||||
root::0:0:root:/:/bin/ash
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/ash
|
||||
|
||||
TERM=linux
|
||||
LANG=en_US.UTF-8
|
||||
export TERM LANG
|
||||
|
||||
/usr/bin/unicode_start
|
||||
@@ -1 +0,0 @@
|
||||
/bin/ash
|
||||
@@ -1 +0,0 @@
|
||||
../common/coreutils
|
||||
@@ -1 +0,0 @@
|
||||
../common/dhcpcd
|
||||
@@ -1 +0,0 @@
|
||||
../common/e2fsprogs
|
||||
@@ -1,4 +0,0 @@
|
||||
etc/host.conf
|
||||
etc/hosts
|
||||
etc/protocols
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../common/findutils
|
||||
@@ -1 +0,0 @@
|
||||
../common/gawk
|
||||
@@ -1 +0,0 @@
|
||||
../common/i586/glibc
|
||||
@@ -1 +0,0 @@
|
||||
../common/grep
|
||||
@@ -1 +0,0 @@
|
||||
../common/gzip
|
||||
@@ -1 +0,0 @@
|
||||
../common/hwdata
|
||||
@@ -1 +0,0 @@
|
||||
../common/iproute2
|
||||
@@ -1 +0,0 @@
|
||||
../common/kbd
|
||||
@@ -1 +0,0 @@
|
||||
../common/libidn
|
||||
@@ -1 +0,0 @@
|
||||
../common/libusb
|
||||
@@ -1,2 +0,0 @@
|
||||
bin/ping
|
||||
usr/local/bin/iowrap
|
||||
@@ -1 +0,0 @@
|
||||
../common/ncurses
|
||||
@@ -1 +0,0 @@
|
||||
../common/newt
|
||||
@@ -1 +0,0 @@
|
||||
../common/openssl
|
||||
@@ -1 +0,0 @@
|
||||
../common/parted
|
||||
@@ -1 +0,0 @@
|
||||
../common/pciutils
|
||||
@@ -1 +0,0 @@
|
||||
../common/pcmciautils
|
||||
@@ -1 +0,0 @@
|
||||
../common/pcre
|
||||
@@ -1 +0,0 @@
|
||||
../common/popt
|
||||
@@ -1,2 +0,0 @@
|
||||
sbin/reboot
|
||||
sbin/halt
|
||||
@@ -1 +0,0 @@
|
||||
../common/reiserfsprogs
|
||||
@@ -1 +0,0 @@
|
||||
../common/sed
|
||||
@@ -1 +0,0 @@
|
||||
../common/slang
|
||||
@@ -1 +0,0 @@
|
||||
../common/sysfsutils
|
||||
@@ -1 +0,0 @@
|
||||
../common/tar
|
||||
@@ -1 +0,0 @@
|
||||
../common/udev
|
||||
@@ -1 +0,0 @@
|
||||
../common/usbutils
|
||||
@@ -1 +0,0 @@
|
||||
../common/i586/util-linux
|
||||
@@ -1 +0,0 @@
|
||||
../common/vim
|
||||
@@ -1 +0,0 @@
|
||||
../common/wget
|
||||
@@ -1 +0,0 @@
|
||||
../common/xz
|
||||
@@ -1 +0,0 @@
|
||||
../common/zlib
|
||||
@@ -95,7 +95,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
dd if=/dev/zero bs=1k count=2 > /install/cdrom/boot/isolinux/boot.catalog
|
||||
ifneq "$(MACHINE_TYPE)" "arm"
|
||||
cp /boot/vmlinuz-$(KVER)-ipfire /install/cdrom/boot/isolinux/vmlinuz
|
||||
cp /install/images/initrd /install/cdrom/boot/isolinux/instroot
|
||||
dracut --force -a "installer" --xz /install/cdrom/boot/isolinux/instroot $(KVER)-ipfire
|
||||
cp $(DIR_SRC)/config/syslinux/boot.png /install/cdrom/boot/isolinux/boot.png
|
||||
cp /usr/lib/memtest86+/memtest.bin /install/cdrom/boot/isolinux/memtest
|
||||
cp /usr/share/ipfire-netboot/ipxe.lkrn /install/cdrom/boot/isolinux/netboot
|
||||
|
||||
121
lfs/initrd
121
lfs/initrd
@@ -1,121 +0,0 @@
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007-2014 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/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# Definitions
|
||||
###############################################################################
|
||||
|
||||
include Config
|
||||
|
||||
VER = ipfire
|
||||
|
||||
THISAPP = initrd
|
||||
DIR_APP = $(DIR_SRC)/$(THISAPP)
|
||||
TARGET = $(DIR_INFO)/$(THISAPP)
|
||||
|
||||
SUP_ARCH = i586
|
||||
|
||||
###############################################################################
|
||||
# Top-level Rules
|
||||
###############################################################################
|
||||
|
||||
install : $(TARGET)
|
||||
|
||||
check :
|
||||
|
||||
download :
|
||||
|
||||
md5 :
|
||||
|
||||
###############################################################################
|
||||
# Installation Details
|
||||
###############################################################################
|
||||
|
||||
$(TARGET) :
|
||||
@$(PREBUILD)
|
||||
rm -f /install/images/initrd
|
||||
|
||||
# Finish up initrd directory
|
||||
-mkdir -p /install/initrd/{dev,etc,mnt,root,lib/modules/$(KVER)-ipfire/kernel/drivers,cdrom,dev,harddisk,proc,tmp,usr/share/terminfo/l,var/run,sys}
|
||||
cd /install/initrd && lzma -d -c /boot/initramfs-$(KVER)-ipfire.img | cpio -i
|
||||
|
||||
# Copy Files packages for installer
|
||||
find $(DIR_SRC)/config/rootfiles/installer/* -maxdepth 1 | xargs cat | grep -v "^#" > /tmp/ROOTFILES
|
||||
|
||||
# Patch Kernel Version to rootfiles
|
||||
sed -e "s/KVER/$(KVER)/g" -i /tmp/ROOTFILES
|
||||
|
||||
-cd / && cpio -d -p /install/initrd < /tmp/ROOTFILES
|
||||
|
||||
# Copy hid and network modules (and deps)
|
||||
cp -aRf /lib/modules/$(KVER)-ipfire/kernel/drivers/hid \
|
||||
/install/initrd/lib/modules/$(KVER)-ipfire/kernel/drivers/
|
||||
cp -aRf /lib/modules/$(KVER)-ipfire/kernel/drivers/net \
|
||||
/install/initrd/lib/modules/$(KVER)-ipfire/kernel/drivers/
|
||||
cp -aRf /lib/modules/$(KVER)-ipfire/kernel/drivers/pcmcia \
|
||||
/install/initrd/lib/modules/$(KVER)-ipfire/kernel/drivers/
|
||||
cp -aRf /lib/modules/$(KVER)-ipfire/kernel/drivers/ssb \
|
||||
/install/initrd/lib/modules/$(KVER)-ipfire/kernel/drivers/
|
||||
cp -aRf /lib/modules/$(KVER)-ipfire/kernel/drivers/uio \
|
||||
/install/initrd/lib/modules/$(KVER)-ipfire/kernel/drivers/
|
||||
cp -aRf /lib/modules/$(KVER)-ipfire/kernel/drivers/ptp \
|
||||
/install/initrd/lib/modules/$(KVER)-ipfire/kernel/drivers/
|
||||
cp -aRf /lib/modules/$(KVER)-ipfire/kernel/drivers/dca \
|
||||
/install/initrd/lib/modules/$(KVER)-ipfire/kernel/drivers/
|
||||
cp -aRf /lib/modules/$(KVER)-ipfire/kernel/drivers/pps \
|
||||
/install/initrd/lib/modules/$(KVER)-ipfire/kernel/drivers/
|
||||
# Remove wireless modules
|
||||
rm -rf /install/initrd/lib/modules/$(KVER)-ipfire/kernel/drivers/net/wireless
|
||||
|
||||
cd /install/initrd/etc && rm -f fstab
|
||||
cp -aRf $(DIR_SRC)/config/install/* /install/initrd/etc/
|
||||
rm -rf /install/initrd/usr/share/man
|
||||
chmod 755 /install/initrd/etc/halt /install/initrd/etc/rc_installer
|
||||
|
||||
cd /install/initrd/ && patch -Np0 < $(DIR_SRC)/src/patches/dracut-init_start_ipfireinstaller.patch
|
||||
|
||||
# Hide udev messages
|
||||
sed -i -e "s|err|none|g" /install/initrd/etc/udev/udev.conf
|
||||
|
||||
# make new dependencies
|
||||
depmod -a -F /boot/System.map-$(KVER)-ipfire $(KVER)-ipfire
|
||||
|
||||
-mkdir -p /install/{images,mnt}
|
||||
rm -rf /install/mnt/*
|
||||
|
||||
#Build Module deps for installer.
|
||||
depmod -a -b /install/initrd/ -F /boot/System.map-$(KVER)-ipfire $(KVER)-ipfire
|
||||
|
||||
#Name service from dhcpcd
|
||||
cp -f /etc/nsswitch.conf /install/initrd/etc/
|
||||
cp -f $(DIR_SRC)/config/initrd/dhcpc/* /install/initrd/var/ipfire/dhcpc/dhcpcd-hooks/
|
||||
|
||||
# Install needed locales.
|
||||
-mkdir -pv /install/initrd/usr/lib/locale
|
||||
for lang in $(DIR_SRC)/langs/*; do \
|
||||
for path in /usr/lib/locale/$${lang##*/}*; do \
|
||||
[ -d "$${path}" ] && cp -lrvf "$${path}" /install/initrd/usr/lib/locale/; \
|
||||
done; \
|
||||
done
|
||||
|
||||
cd /install/initrd && find . | cpio -o -H newc | lzma > /install/images/initrd
|
||||
cd /install/initrd && find ./ -ls > $(DIR_INFO)/_build.initrd.log
|
||||
|
||||
@$(POSTBUILD)
|
||||
@@ -60,11 +60,14 @@ $(TARGET) :
|
||||
cd $(DIR_APP)/install && make CFLAGS="-Os -std=gnu99 -fomit-frame-pointer -Wall \
|
||||
-DNAME='\"$(NAME)\"' -DSNAME='\"$(SNAME)\"' -DVERSION='\"$(VERSION)\"' \
|
||||
-DSLOGAN='\"$(SLOGAN)\"' -DCONFIG_ROOT='\"$(CONFIG_ROOT)\"' -DKERNEL_VERSION='\"$(KVER)\"'"
|
||||
cd $(DIR_APP)/install && install -v -m 0755 install probenic.sh \
|
||||
downloadsource.sh mountdest.sh /install/initrd/bin
|
||||
cd $(DIR_APP)/install && install -v -m 0755 installer probenic.sh \
|
||||
downloadsource.sh mountdest.sh /usr/bin
|
||||
rm -rvf /usr/lib/dracut/modules.d/99installer
|
||||
cd $(DIR_APP)/install && cp -rvf dracut-module /usr/lib/dracut/modules.d/99installer
|
||||
|
||||
#Patch ISO Name for download ...
|
||||
sed -i -e "s|ipfire.iso|download.ipfire.org/releases/ipfire-2.x/$(VERSION)-core$(CORE)/$(SNAME)-$(VERSION).$(MACHINE)-full-core$(CORE).iso|g" \
|
||||
/install/initrd/bin/downloadsource.sh
|
||||
/usr/bin/downloadsource.sh
|
||||
#Patch version for mediacheck ...
|
||||
@rm -rf $(DIR_APP)
|
||||
@$(POSTBUILD)
|
||||
|
||||
1
make.sh
1
make.sh
@@ -811,7 +811,6 @@ buildinstaller() {
|
||||
ipfiremake memtest
|
||||
ipfiremake installer
|
||||
installmake strip
|
||||
ipfiremake initrd
|
||||
}
|
||||
|
||||
buildpackages() {
|
||||
|
||||
@@ -33,7 +33,7 @@ LINK = $(LD) $(LDFLAGS)
|
||||
|
||||
all : programs
|
||||
|
||||
programs : install
|
||||
programs : installer
|
||||
|
||||
clean :
|
||||
-rm -f *.o install core
|
||||
@@ -42,7 +42,7 @@ clean :
|
||||
|
||||
OBJS=main.o config.o ../libsmooth/libsmooth.o unattended.o hw.o
|
||||
|
||||
install: $(OBJS)
|
||||
installer: $(OBJS)
|
||||
$(LINK) $(OBJS) -o $@ $(LIBS)
|
||||
|
||||
%.o : %.c
|
||||
|
||||
32
src/install+setup/install/dracut-module/70-dhcpcd.exe
Executable file
32
src/install+setup/install/dracut-module/70-dhcpcd.exe
Executable file
@@ -0,0 +1,32 @@
|
||||
#/bin/bash
|
||||
########################################################################
|
||||
# Begin
|
||||
#
|
||||
# Description : DHCP Client Script (initrd version)
|
||||
#
|
||||
# Authors : Arne Fitzenreiter - arne_f@ipfire.org
|
||||
#
|
||||
# Version : 02.00
|
||||
#
|
||||
# Notes :
|
||||
#
|
||||
########################################################################
|
||||
|
||||
dhcpcd_up()
|
||||
{
|
||||
set | grep "^new_" | sed "s|^new_||g" | \
|
||||
sed "s|'||g" | \
|
||||
sort > /var/ipfire/dhcpc/dhcpcd-$interface.info
|
||||
|
||||
DNS=`grep "domain_name_servers" /var/ipfire/dhcpc/dhcpcd-$interface.info | cut -d"=" -f2`
|
||||
DNS1=`echo $DNS | cut -d" " -f1`
|
||||
DNS2=`echo $DNS | cut -d" " -f2`
|
||||
|
||||
echo "nameserver $DNS1" > /etc/resolv.conf
|
||||
echo "nameserver $DNS2" >> /etc/resolv.conf
|
||||
|
||||
}
|
||||
|
||||
case "$reason" in
|
||||
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) dhcpcd_up;;
|
||||
esac
|
||||
5
src/install+setup/install/dracut-module/fake-root.sh
Normal file
5
src/install+setup/install/dracut-module/fake-root.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Fake root so dracut will start our installer
|
||||
root="installer"
|
||||
rootok=1
|
||||
63
src/install+setup/install/dracut-module/module-setup.sh
Executable file
63
src/install+setup/install/dracut-module/module-setup.sh
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo base bash mdraid shutdown
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst /usr/bin/installer
|
||||
inst /usr/bin/downloadsource.sh
|
||||
inst /usr/local/bin/iowrap
|
||||
|
||||
# Kernel drivers
|
||||
instmods =drivers/hid
|
||||
|
||||
# Network drivers
|
||||
instmods =drivers/net/ethernet =drivers/net/usb
|
||||
instmods virtio_net hv_netvsc vmxnet3
|
||||
|
||||
# Filesystem support
|
||||
inst_multiple parted mkswap mke2fs mkreiserfs
|
||||
instmods ext4 iso9660 reiserfs vfat
|
||||
|
||||
# Extraction
|
||||
inst_multiple tar gzip lzma xz
|
||||
|
||||
# DHCP Client
|
||||
inst dhcpcd
|
||||
inst /var/ipfire/dhcpc/dhcpcd-run-hooks
|
||||
inst /var/ipfire/dhcpc/dhcpcd.conf
|
||||
for file in /var/ipfire/dhcpc/dhcpcd-hooks/*; do
|
||||
inst "${file}"
|
||||
done
|
||||
inst "$moddir/70-dhcpcd.exe" "/var/ipfire/dhcpc/dhcpcd-hooks/70-dhcpcd.exe"
|
||||
|
||||
# Misc. tools
|
||||
inst_multiple eject ping wget
|
||||
inst_multiple -o fdisk cfdisk
|
||||
|
||||
# Hardware IDs
|
||||
inst /usr/share/hwdata/pci.ids /usr/share/hwdata/usb.ids
|
||||
|
||||
# Locales
|
||||
for locale in de en es fr nl pl ru tr; do
|
||||
for file in $(find /usr/lib/locale/${locale}*); do
|
||||
inst "${file}"
|
||||
done
|
||||
done
|
||||
|
||||
inst_hook cmdline 99 "$moddir/fake-root.sh"
|
||||
inst_hook pre-mount 99 "$moddir/run-installer.sh"
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# IPFire Installer RC
|
||||
#
|
||||
|
||||
# Silence the kernel
|
||||
echo >/proc/sys/kernel/printk "1 4 1 7"
|
||||
echo -n -e "\033[9;0]"
|
||||
|
||||
ln -snf /proc/self/fd/0 /dev/stdin
|
||||
ln -snf /proc/self/fd/1 /dev/stdout
|
||||
ln -snf /proc/self/fd/2 /dev/stderr
|
||||
ln -s /proc/kcore /dev/core
|
||||
mount tmpfs -t tmpfs /tmp
|
||||
|
||||
echo "Starting shells on tty2 and tty3 ..."
|
||||
/usr/local/bin/iowrap /dev/tty2 /bin/bash &
|
||||
/usr/local/bin/iowrap /dev/tty3 /bin/bash &
|
||||
|
||||
echo "Loading Installer..."
|
||||
/bin/bash --login -c "/bin/install /dev/tty2"
|
||||
/bin/bash --login -c "/usr/bin/installer /dev/tty2"
|
||||
|
||||
/etc/halt
|
||||
sleep 60
|
||||
|
||||
# Reboot the system
|
||||
/shutdown reboot
|
||||
Reference in New Issue
Block a user