# initramfs/Makefile
#
-TOPDIR = $(shell pwd)
+PWD = $(shell pwd)
-include $(TOPDIR)/../toolchain/vars.mk
+include $(PWD)/../toolchain/vars.mk
TARGET = arm-crux-linux-gnueabi
DEVICE = versatile
-WORK = $(TOPDIR)/work
-CLFS = $(TOPDIR)/../toolchain/clfs
-CROSSTOOLS = $(TOPDIR)/../toolchain/crosstools
+WORK = $(PWD)/work
+CLFS = $(PWD)/../toolchain/clfs
+CROSSTOOLS = $(PWD)/../toolchain/crosstools
KERNEL_PATH = $(PWD)/../kernel/$(DEVICE)
BUSYBOX_VERSION = 1.20.2
BUSYBOX_SOURCE = http://busybox.net/downloads/busybox-$(BUSYBOX_VERSION).tar.bz2
-DIALOG_VERSION = 1.1-20120215
-DIALOG_SOURCE = ftp://dickey.his.com/dialog/dialog-$(DIALOG_VERSION).tgz
+.PHONY: all check-root busybox gen_init_cpio initramfs clean distclean
-NCURSES_HEADER = $(CLFS)/usr/include/ncurses.h
+all: busybox gen_init_cpio initramfs
-.PHONY: all check-root busybox dialog initramfs clean distclean
+clean: busybox-clean gen_init_cpio-clean initramfs-clean
-all: busybox dialog initramfs
-
-clean: busybox-clean dialog-clean initramfs-clean
-
-dist-clean: busybox-distclean dialog-distclean gen_init_cpio-distclean initramfs-distclean
+distclean: busybox-distclean gen_init_cpio-distclean initramfs-distclean
check-root:
@if [ "$$UID" != "0" ]; then \
cp -v $(PWD)/busybox-$(BUSYBOX_VERSION).config $(WORK)/busybox-$(BUSYBOX_VERSION)/.config
touch $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2
-$(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox: $(WORK)/busybox-$(BUSYBOX_VERSION)
+$(WORK)/busybox-$(BUSYBOX_VERSION)/busybox: $(WORK)/busybox-$(BUSYBOX_VERSION)
export PATH=$(CROSSTOOLS)/bin:$$PATH && \
export LD_LIBRARY_PATH=$(CROSSTOOLS)/lib:$$LD_LIBRARY_PATH && \
- make -C $(WORK)/busybox-$(BUSYBOX_VERSION) ARCH=arm CROSS_COMPILE=$(TARGET)- install && \
- install -D -m 0755 $(WORK)/busybox-$(BUSYBOX_VERSION)/examples/udhcp/simple.script $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/usr/share/udhcpc/default.script && \
- $(TARGET)-strip $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox && \
- touch $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox
+ make -C $(WORK)/busybox-$(BUSYBOX_VERSION) ARCH=arm CROSS_COMPILE=$(TARGET)- && \
+ $(TARGET)-strip $(WORK)/busybox-$(BUSYBOX_VERSION)/busybox && \
+ touch $(WORK)/busybox-$(BUSYBOX_VERSION)/busybox
-busybox: $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox
+busybox: $(WORK)/busybox-$(BUSYBOX_VERSION)/busybox
busybox-clean:
rm -vrf $(WORK)/busybox-$(BUSYBOX_VERSION)
busybox-distclean: busybox-clean
rm -vf $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2
-$(WORK)/dialog-$(DIALOG_VERSION).tgz:
- wget -P $(WORK) -c $(DIALOG_SOURCE)
-
-$(WORK)/dialog-$(DIALOG_VERSION): $(WORK)/dialog-$(DIALOG_VERSION).tgz
- tar -C $(WORK) -xvzf $(WORK)/dialog-$(DIALOG_VERSION).tgz
- touch $(WORK)/dialog-$(DIALOG_VERSION)
-
-$(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog: $(WORK)/dialog-$(DIALOG_VERSION)
- export PATH=$(CROSSTOOLS)/bin:$$PATH && \
- export LD_LIBRARY_PATH=$(CROSSTOOLS)/lib:$$LD_LIBRARY_PATH && \
- cd $(WORK)/dialog-$(DIALOG_VERSION) && \
- ./configure --build=$(BUILD) --host=$(TARGET) --prefix=/usr --with-ncursesw && \
- find -type f -name 'makefile' \
- -exec sed -e "s|-I/usr|-I$(CLFS)/usr|g" -e "s|-L/usr|-L$(CLFS)/usr|g" -i {} \; && \
- make CC="$(TARGET)-gcc -static" && \
- make DESTDIR=$(WORK)/dialog-$(DIALOG_VERSION)/_install install && \
- $(TARGET)-strip $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog && \
- touch $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog
-
-dialog: $(NCURSES_HEADER) $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog
-
-dialog-clean:
- rm -vrf $(WORK)/dialog-$(DIALOG_VERSION)
-
-dialog-distclean: dialog-clean
- rm -vf $(WORK)/dialog-$(DIALOG_VERSION).tgz
-
$(WORK)/gen_init_cpio: $(WORK)/gen_init_cpio.c
cd $(WORK) && \
$(CC) $(CFLAGS) -Wall -o gen_init_cpio gen_init_cpio.c
gen_init_cpio-distclean: gen_init_cpio-clean
-$(WORK)/initramfs.cpio.gz-$(KERNEL_VERSION): check-root busybox dialog $(TOPDIR)/filesystem $(WORK)/gen_init_cpio $(WORK)/initramfs.lst
- mkdir -p $(WORK)/mnt/{etc,lib,usr/share/terminfo}
- cp -dRv $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/* $(WORK)/mnt
- install -v -m 0755 $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog $(WORK)/mnt/usr/bin
- cp -dRv $(CLFS)/lib/libnss_{files*,dns*} $(CLFS)/lib/libresolv* $(WORK)/mnt/lib
- cp -dRv $(CLFS)/usr/share/terminfo/v $(WORK)/mnt/usr/share/terminfo
- install -v -m 0644 $(TOPDIR)/filesystem/{fstab,inittab,profile,protocols,*.conf} $(WORK)/mnt/etc
- install -v -m 0755 $(TOPDIR)/filesystem/rc $(WORK)/mnt/etc
- install -v -m 0755 $(TOPDIR)/filesystem/{setup*,crux} $(WORK)/mnt/usr/bin
- /sbin/ldconfig -r $(WORK)/mnt
- cd $(WORK)/mnt && \
- sed -e "s/#KERNEL_VERSION#/$(KERNEL_VERSION)/g; s/#BUSYBOX_VERSION#/$(BUSYBOX_VERSION)/g" \
- $(WORK)/initramfs.lst > $(WORK)/initramfs.lst-sed && \
- $(WORK)/gen_init_cpio $(WORK)/initramfs.lst-sed | cpio -id && \
- find * | cpio -H newc -o > $(WORK)/initramfs.cpio && \
- gzip -v9 $(WORK)/initramfs.cpio
- mv $(WORK)/initramfs.cpio.gz{,-$(KERNEL_VERSION)}
- rm -rf $(WORK)/mnt
-
-initramfs: $(WORK)/initramfs.cpio.gz-$(KERNEL_VERSION)
+$(WORK)/initramfs: check-root busybox $(WORK)/gen_init_cpio $(PWD)/init $(PWD)/initramfs.lst
+ sed -e "s/#KERNEL_VERSION#/$(KERNEL_VERSION)/g; s/#BUSYBOX_VERSION#/$(BUSYBOX_VERSION)/g" \
+ $(PWD)/initramfs.lst > $(WORK)/initramfs.lst
+ $(WORK)/gen_init_cpio $(WORK)/initramfs.lst > $(WORK)/initramfs
+
+initramfs: $(WORK)/initramfs
initramfs-clean:
- rm -rf $(WORK)/initramfs-$(KERNEL_VERSION) $(WORK)/mnt $(WORK)/initramfs.cpio.gz-$(KERNEL_VERSION)
+ rm -f $(WORK)/initramfs $(WORK)/initramfs.lst
initramfs-distclean: initramfs-clean
+++ /dev/null
-#! /bin/sh
-
-echo "CRUX 2.7"
-
-# End of file
+++ /dev/null
-#
-# /etc/fstab: static file system information
-#
-
-none /sys sysfs defaults 0 0
-none /proc proc defaults 0 0
-tmp /tmp tmpfs defaults 0 0
-
-# End of file
+++ /dev/null
-#
-# /etc/inittab
-#
-
-::sysinit:/etc/rc
-::restart:/sbin/init
-::ctrlaltdel:/sbin/init
-::shutdown:/sbin/swapoff -a
-::shutdown:/bin/umount -a -r
-
-::askfirst:-/bin/sh
-
-tty2::askfirst:-/bin/sh
-tty3::askfirst:-/bin/sh
-tty4::askfirst:-/bin/sh
-
-# End of file
+++ /dev/null
-#
-# /etc/ld.so.conf
-#
-
-# End of file
+++ /dev/null
-#
-# /etc/mdev.conf
-#
-
-# End of file
+++ /dev/null
-#
-# /etc/nsswitch.conf: name service switch configuration file
-#
-
-passwd: files
-group: files
-shadow: files
-
-hosts: files dns
-networks: files
-
-services: files
-protocols: files
-rpc: files
-publickey: files
-ethers: files
-netmasks: files
-netgroup: files
-bootparams: files
-
-automount: files
-aliases: files
-
-# End of file
+++ /dev/null
-#
-# /etc/profile
-#
-
-export PS1="\[\033[1m\]\\$ \[\033[0m\]"
-
-# End of file
+++ /dev/null
-# $NetBSD: protocols,v 1.12.4.1 2006/12/02 12:58:19 bouyer Exp $
-#
-# Internet (IP) protocols
-#
-# originally from: @(#)protocols 8.1 (Berkeley) 6/9/93
-# see http://www.iana.org/assignments/protocol-numbers
-#
-ip 0 IP # internet protocol, pseudo protocol number
-icmp 1 ICMP # internet control message protocol
-igmp 2 IGMP # internet group management protocol
-ggp 3 GGP # gateway-gateway protocol
-ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
-st 5 ST # ST datagram mode
-tcp 6 TCP # transmission control protocol
-cbt 7 CBT
-egp 8 EGP # exterior gateway protocol
-igp 9 IGP # any private interior gateway protocol
-bbn-rcc-mon 10 BBN-RCC-MON # BBN RCC Monitoring
-nvp-ii 11 NVP-II # Network Voice Protocol
-pup 12 PUP # PARC universal packet protocol
-argus 13 ARGUS
-emcon 14 EMCON
-xnet 15 XNET # Cross net debugger
-chaos 16 CHAOS # Chaos
-udp 17 UDP # user datagram protocol
-mux 18 MUX # Multiplexing
-dcn-meas 19 DCN-MEAS # DCN Measurement Subsystems
-hmp 20 HMP # host monitoring protocol
-prm 21 PRM # Packet Radio Measurement
-xns-idp 22 XNS-IDP # Xerox NS IDP
-trunk-1 23 TRUNK-1
-trunk-2 24 TRUNK-2
-leaf-1 25 LEAF-1
-leaf-2 26 LEAF-2
-rdp 27 RDP # reliable data protocol
-irtp 28 IRTP # Internet Reliable Transaction
-iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class 4
-netblt 30 NETBLT # Bulk Data Transfer Protocol
-mfe-nsp 31 MFE-NSP # MFE Network Services Protocol
-merit-inp 32 MERIT-INP # MERIT Internodal Protocol
-sep 33 SEP # Sequential Exchange Protocol
-3pc 34 3PC # Third Party Connect Protocol
-idpr 35 IDPR # Inter-Domain Policy Routing Protocol
-xtp 36 XTP # Xpress Transfer Protocol
-ddp 37 DDP # Datagram Delivery Protocol
-idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport
-tp++ 39 TP++ # TP++ Transport Protocol
-il 40 IL # IL Transport Protocol
-ipv6 41 IPv6 # Internet Protocol, version 6
-sdrp 42 SDRP # Source Demand Routing Protocol
-ipv6-route 43 IPv6-Route # Routing Header for IPv6
-ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6
-idrp 45 IDRP # Inter-Domain Routing Protocol
-rsvp 46 RSVP # Resource ReSerVation Protocol
-gre 47 GRE # General Routing Encapsulation
-mhrp 48 MHRP # Mobile Host Routing Protocol
-bna 49 BNA
-esp 50 ESP # Encapsulating Security Payload
-ah 51 AH # Authentication Header
-i-nlsp 52 I-NLSP # Integrated Net Layer Security
-swipe 53 SWIPE # IP with Encryption
-narp 54 NARP # NBMA Address Resolution Protocol
-mobile 55 MOBILE # IP Mobility (IP tunneling)
-tlsp 56 TLSP # Transport Layer Security Protocol
-skip 57 SKIP
-ipv6-icmp 58 IPv6-ICMP icmp6 # ICMP version 6
-ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6
-ipv6-opts 60 IPv6-Opts # Destination Options for IPv6
-# 61 # any host internal protocol
-cftp 62 CFTP # CFTP
-# 63 # any local network
-sat-expak 64 SAT-expak # SATNET and Backroom EXPAK
-kryptolan 65 KRYPTOLAN # Kryptolan
-rvd 66 RVD # MIT Remote Virtual Disk Protocol
-ippc 67 IPPC # Internet Pluribus Packet Core
-# 68 # any distributed file system
-sat-mon 69 SAT-MON # SATNET Monitoring
-visa 70 VISA # VISA Protocol
-ipcv 71 IPCV # Internet Packet Core Utility
-cpnx 72 CPNX # Computer Protocol Network Executive
-cphb 73 CPHB # Computer Protocol Heart Beat
-wsn 74 WSN # Wang Span Network
-pvp 75 PVP # Packet Video Protocol
-br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring
-sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary
-wb-mon 78 WB-MON # WIDEBAND Monitoring
-wb-expak 79 WB-EXPAK # WIDEBAND EXPAK
-iso-ip 80 ISO-IP # ISO Internet Protocol
-vmtp 81 VMTP # Versatile Message Transport
-secure-vmtp 82 SECURE-VMTP # SECURE-VMTP
-vines 83 VINES
-ttp 84 TTP
-nsfnet-igp 85 NSFNET-IGP
-dgp 86 DGP # Dissimilar Gateway Protocol
-tcf 87 TCF
-eigrp 88 EIGRP # Enhanced Inter-Gateway Routing Protocol
-ospf 89 OSPFIGP # Open Shortest Path First IGP
-sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol
-larp 91 LARP # Locus Address Resolution Protocol
-mtp 92 MTP # Multicast Transport Protocol
-ax.25 93 AX.25 # AX.25 Frames
-ipip 94 IPIP # Yet Another IP encapsulation
-micp 95 MICP # Mobile Internetworking Control Pro.
-scc-sp 96 SCC-SP # Semaphore Communications Sec. Pro.
-etherip 97 ETHERIP # Ethernet-within-IP Encapsulation
-encap 98 ENCAP # RFC1241 encapsulation
-# 99 # any private encryption scheme
-gmtp 100 GMTP
-ifmp 101 IFMP # Ipsilon Flow Management Protocol
-pnni 102 PNNI # PNNI over IP
-pim 103 PIM # Protocol Independent Multicast
-aris 104 ARIS
-scps 105 SCPS
-qnx 106 QNX
-a/n 107 A/N # Active Networks
-ipcomp 108 IPCOMP # IP Payload Compression Protocol
-snp 109 SNP # Sitara Networks Protocol
-compaq-peer 110 Compaq-Peer # Compaq Peer Protocol
-ipx-in-ip 111 IPX-in-IP # IPX in IP
-carp 112 CARP vrrp # Virtual Router Redundancy Protocol
-pgm 113 PGM # PGM Reliable Transport Protocol
-# 114 # any 0-hop protocol
-l2tp 115 L2TP # Layer Two Tunneling Protocol
-ddx 116 DDX # D-II Data Exchange (DDX)
-iatp 117 IATP # Interactive Agent Transfer Protocol
-stp 118 STP # Schedule Transfer Protocol
-srp 119 SRP # SpectraLink Radio Protocol
-uti 120 UTI
-smp 121 SMP # Simple Message Protocol
-sm 122 SM
-ptp 123 PTP # Performance Transparency Protocol
-isis 124 ISIS # IS-IS over IPv4
-fire 125 FIRE
-crtp 126 CRTP # Combat Radio Transport Protocol
-crudp 127 CRUDP # Combat Radio User Datagram
-sscopmce 128 SSCOPMCE
-iplt 129 IPLT
-sps 130 SPS # Secure Packet Shield
-pipe 131 PIPE # Private IP Encapsulation within IP
-sctp 132 SCTP # Stream Control Transmission Protocol
-fc 133 FC # Fibre Channel
-rsvp-e2e-ignore 134 RSVP-E2E-IGNORE
-mobility-header 135 MOBILITY-HEADER # Mobility Header
-udplite 136 UDPLite
-mpls-in-ip 137 MPLS-in-IP # MPLS in IP
-# 138-254 # Unassigned
-# 255 # Reserved
+++ /dev/null
-#
-# /etc/resolv.conf
-#
-
-# End of file
+++ /dev/null
-#!/bin/ash
-#
-# CRUX-ARM Setup
-#
-# Copyright (c) 2001-2005 by Per Liden <per@fukt.bth.se>
-#
-# Adapted for CRUX-ARM by Jose V Beneyto <sepen@crux.nu>
-#
-# 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, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-# USA.
-#
-
-VERSION="2.7.1"
-
-do_dialog() {
- dialog --backtitle "CRUX $VERSION Setup" --no-shadow "$@"
-}
-
-do_abort() {
- do_dialog --aspect 50 --defaultno --yesno "Abort installation?" 0 0 && exit 1
-}
-
-do_select() {
- while true; do
- do_dialog "$@"
- if [ $? != 0 ]; then
- do_abort
- else
- break
- fi
- done
-}
-
-welcome() {
- do_select --aspect 5 --yesno "Welcome!\n\nThis script will guide you through the installation of CRUX packages.\n\nBefore starting the installation make sure you have read and understood the \"CRUX Installation Guide\". If you have done that then please continue, else abort the installation and come back later.\n\nAre you really sure you want to continue?" 0 0
-}
-
-select_action() {
- do_select --menu "Install or upgrade?" 9 45 2 \
- "1" "Install CRUX $VERSION" \
- "2" "Upgrade to CRUX $VERSION" 2> $tmpfile
- ACTION=`cat $tmpfile`
- if [ "$ACTION" = "1" ]; then
- ACTION="INSTALL"
- else
- ACTION="UPGRADE"
- do_select --aspect 5 --yesno "NOTE!\n\nBefore upgrading make sure /etc/pkgadd.conf in the old installation is tuned to fit your needs, important files might otherwise be overwritten. Further, when this script has completed the upgrade you need to go though the rejected files in /var/lib/pkg/rejected/ and upgrade them manually if needed. See the pkgadd(8) man page for more information about /etc/pkgadd.conf.\n\nAre you really sure you want to continue?" 0 0
- fi
- echo "ACTION: $ACTION" > /tmp/action
-}
-
-select_root() {
- while true; do
- do_select --aspect 40 --inputbox "Enter directory where your CRUX root partition is mounted:" 0 0 "/mnt" 2> $tmpfile
- ROOT=`cat $tmpfile`
- if [ -d "$ROOT" ]; then
- if [ "$ACTION" = "INSTALL" ] || [ -f "$ROOT/var/lib/pkg/db" ]; then
- break
- fi
- do_dialog --aspect 50 --msgbox "Directory does not look like a CRUX root directory. Try again." 0 0
- else
- do_dialog --aspect 50 --msgbox "Directory not found. Try again." 0 0
- fi
- done
-}
-
-select_collections() {
- if [ "$ACTION" != "INSTALL" ]; then
- return 0
- fi
- if [ ! -d core ] || [ ! -d kernel ]; then
- do_dialog --aspect 50 --msgbox "Package directories (core and kernel) were not found in $crux_dir. Aborting." 0 0
- exit 1
- fi
- TITLE="Select collections to install:\n(detailed package selection will follow)"
- do_select --separate-output --checklist "$TITLE" 13 60 6 \
- core "The core packages (required)" ON \
- opt "Optional packages" OFF \
- xorg "X.org packages" OFF 2> $collfile
-}
-
-ask_detailed() {
- if [ "$ACTION" != "INSTALL" ]; then
- return 0
- fi
- do_dialog --aspect 50 --defaultno --yesno "Do you want the chance to select packages individually?" 0 0 && DO_DETAILED="yes"
-}
-
-select_packages() {
- if [ ! -d core ] || [ ! -d kernel ]; then
- do_dialog --aspect 50 --msgbox "Package directories (core and kernel) were not found in $crux_dir. Aborting." 0 0
- exit 1
- fi
- if [ "$ACTION" = "INSTALL" ]; then
- if [ "$DO_DETAILED" = "yes" ]; then
- for collection in core opt xorg; do
- [ ! -d $collection ] && continue
- presel=`grep $collection $collfile`
- if [ "$presel" == "$collection" ]; then
- checked=ON
- else
- checked=OFF
- fi
- do_dialog --aspect 50 --infobox "Searching for packages, please wait..." 0 0
- TITLE="Select $collection packages to install:"
- PKG_LIST=`find $collection -name '*.pkg.tar.*' | cut -d'/' -f2 | sed "s|.pkg.tar.[^ ]*|\t($collection) $checked\n|g" | sort | xargs echo ' '`
- do_select --separate-output --checklist "$TITLE" 19 60 12 $PKG_LIST 2>> $pkgfile
- done
- else # no detailed selection
- for collection in core opt xorg; do
- [ ! -d $collection ] && continue
- presel=`grep $collection $collfile`
- if [ "$presel" == "$collection" ]; then
- find $collection -name '*.pkg.tar.*' | cut -d'/' -f2 | sed "s|.pkg.tar.[^ ]*|\t($collection) $checked\n|g" | sort >> $pkgfile
- fi
- done
- fi
- else
- # Upgrade
- do_dialog --aspect 50 --infobox "Searching for packages, please wait..." 0 0
- TITLE="Select packages to upgrade:"
- INSTALLED_PACKAGES=`pkginfo -r $ROOT -i | gawk '{ print $1; }'`
- for package in $INSTALLED_PACKAGES; do
- CORE_LIST="$CORE_LIST `find core \( -name \"${package}#*.pkg.tar.gz\" -o -name \"${package}#*.pkg.tar.bz2\" -o -name \"${package}#*.pkg.tar.xz\" \) -printf '%f (core) ON\n' | sed 's/.pkg.tar.[^ ]*/ /g' | sort | xargs echo ' '`"
- OPT_LIST="$OPT_LIST `find opt \( -name \"${package}#*.pkg.tar.gz\" -o -name \"${package}#*.pkg.tar.bz2\" -o -name \"${package}#*.pkg.tar.xz\" \) -printf '%f (opt) ON\n' | sed 's/.pkg.tar.[^ ]*/ /g' | sort | xargs echo ' '`"
- XORG_LIST="$XORG_LIST `find xorg \( -name \"${package}#*.pkg.tar.gz\" -o -name \"${package}#*.pkg.tar.bz2\" -o -name \"${package}#*.pkg.tar.xz\" \) -printf '%f (xorg) ON\n' | sed 's/.pkg.tar.[^ ]*/ /g' | sort | xargs echo ' '`"
- done
- do_select --separate-output --checklist "$TITLE" 19 60 12 $CORE_LIST $OPT_LIST $XORG_LIST 2> $pkgfile
- fi
-}
-
-check_dependencies() {
- if [ "$ACTION" != "INSTALL" ]; then
- return 0
- fi
- do_dialog --aspect 50 --infobox "Checking dependencies, please wait..." 0 0
- get_missing_deps
- if [ -n "$MISSING_DEPS" ]; then
- for package in $MISSING_DEPS; do
- _package="`find . -name '${package}#*.pkg.tar.*' | sed 's/.pkg.tar.[^ ]*/ /g'`"
- _collection="`dirname $_package | cut -d'/' -f2`"
- # every item should be in the form: "acl#2.2.51-1 (core)"
- MISSING_LIST="$MISSING_LIST $_package ($_collection)"
- done
- TITLE="The following packages are needed by the ones you selected"
- do_select --separate-output --checklist "$TITLE" 19 60 12 $MISSING_LIST 2>> $pkgfile
- fi
-}
-
-get_missing_deps() {
- needed=""
- toinstall=`sed 's/\#.*//g' $pkgfile`
- for f in $toinstall; do
- pdeps=`grep "^$f\:" $depsfile|sed "s|^$f: ||g"`
- for d in $pdeps; do
- needed="$needed $d"
- done
- done
- sed 's/\#.*//g' $pkgfile|sort -u > $markedfile
- echo $needed|tr ' ' '\n'|sort -u > $neededfile
- MISSING_DEPS=`comm -1 -3 $markedfile $neededfile`
-}
-
-confirm() {
- if [ "$ACTION" = "INSTALL" ]; then
- # Install
- do_select --aspect 25 --yesno "Selected packages will now be installed. Are you sure you want to continue?" 0 0
- else
- # Upgrade
- do_select --aspect 25 --yesno "Selected packages will now be upgraded. Are you sure you want to continue?" 0 0
- fi
-}
-
-progressbar() {
- echo "XXX"
- expr $COUNT '*' 100 / $TOTAL
- echo "\n$*"
- echo "XXX"
- let $((COUNT+=1))
-}
-
-install_packages() {
- if [ ! -d $ROOT/var/lib/pkg ]; then
- mkdir -p $ROOT/var/lib/pkg
- touch $ROOT/var/lib/pkg/db
- fi
-
- if [ -d $ROOT/var/lib/pkg/rejected ]; then
- rm -rf $ROOT/var/lib/pkg/rejected
- fi
-
- if [ "$ACTION" = "INSTALL" ]; then
- PKGARGS=""
- else
- # We use -f here since we want to avoid pkgadd conflicts.
- # Unwanted/Unexpected conflicts could arise if files are
- # moved from one package to another, or if the user added
- # the files himself. Instead of failing the whole upgrade
- # we force the upgrade. This should be fairly safe and it
- # will probably help to avoid some "semi-bogus" errors from
- # pkgadd. The rules in /etc/pkgadd.conf will still be used.
- PKGARGS="-f -u"
- fi
-
- (
- # Log header
- echo "Log ($logfile)" > $logfile
- echo "----------------------------------------------------------" >> $logfile
-
- # Install packages
- KERNEL=./kernel/linux-*.tar.bz2
- KERNEL_VERSION=`basename $KERNEL .tar.bz2 | sed "s/linux-//"`
- TOTAL=`cat $pkgfile | wc -l`
- let $((TOTAL+=1))
- let $((COUNT=0))
- let $((ERRORS=0))
- for FILE in `cat $pkgfile | awk '{print $1}'`; do
- progressbar "Installing $FILE..."
- echo -n "Installing $FILE....." >> $logfile
- PKG_FILE=`find . \( -name "$FILE.pkg.tar.gz" -o -name "$FILE.pkg.tar.bz2" -o -name "$FILE.pkg.tar.xz" \)`
- if [ -f $PKG_FILE ]; then
- pkgadd -r $ROOT $PKGARGS $PKG_FILE > $tmpfile 2>&1
- if [ $? = 0 ]; then
- echo "OK" >> $logfile
- else
- let $((ERRORS+=1))
- echo "ERROR" >> $logfile
- echo "" >> $logfile
- cat $tmpfile >> $logfile
- echo "" >> $logfile
- fi
- fi
- done
-
- # Install kernel
- if [ ! -d $ROOT/usr/src/linux-$KERNEL_VERSION ]; then
- progressbar "Installing `basename $KERNEL .tar.bz2`..."
- echo -n "Installing `basename $KERNEL .tar.bz2`....." >> $logfile
- (
- set -e
- tar -C $ROOT/usr/src -xjf $KERNEL
- cp -f ./kernel/linux-$KERNEL_VERSION.config $ROOT/usr/src/linux-$KERNEL_VERSION/.config
- ) > $tmpfile 2>&1
- if [ $? = 0 ]; then
- echo "OK" >> $logfile
- else
- let $((ERRORS+=1))
- echo "ERROR" >> $logfile
- echo "" >> $logfile
- cat $tmpfile >> $logfile
- echo "" >> $logfile
- fi
- else
- echo "Directory $ROOT/usr/src/linux-$KERNEL_VERSION already exists." >> $logfile
- echo "Assuming linux-$KERNEL_VERSION is already installed." >> $logfile
- fi
-
- # Log footer
- echo "----------------------------------------------------------" >> $logfile
- echo "$ERRORS error(s) found" >> $logfile
-
- cat $logfile > $tmpfile
-
- echo "" > $logfile
- if [ "$ERRORS" = "0" ]; then
- echo "$ACTION COMPLETED SUCCESSFULLY!" >> $logfile
- else
- echo "$ACTION FAILED!" >> $logfile
- fi
- echo "" >> $logfile
- echo "" >> $logfile
- cat $tmpfile >> $logfile
-
- ) | do_dialog --title " Please wait " --gauge "" 8 60 0
-
- # Show log
- do_dialog --exit-label "OK" --textbox $logfile 19 68
-}
-
-main() {
- welcome
- select_action
- select_root
- select_collections
- ask_detailed
- select_packages
- check_dependencies
- confirm
- if [ "$ACTION" = "UPGRADE" ] && [ -f /usr/bin/setup-helper ]
- then
- (/usr/bin/setup-helper $ROOT &> $helperlogfile) | do_dialog \
- --title " Please wait [2.6 -> 2.7.1 check]" --gauge "" 8 60 0
- fi
- install_packages
- cat $helperlogfile 2> /dev/null
-}
-
-tmpfile=/tmp/tmp.$$
-collfile=/tmp/collections.$$
-pkgfile=/tmp/packages.$$
-logfile=/tmp/log.$$
-helperlogfile=/tmp/log-helper.$$
-crux_dir=/media/crux
-neededfile=/tmp/needed.$$
-markedfile=/tmp/marked.$$
-
-# Detailed selection of packages
-DO_DETAILED="no"
-MISSINGDEPS=""
-
-trap "rm -f $tmpfile $pkgfile $collfile $neededfile $markedfile" 0 1 2 5 15
-
-if [ "$1" != "" ]; then
- crux_dir=$1
-fi
-
-depsfile=$crux_dir/setup.dependencies
-
-if [ -d $crux_dir ]; then
- cd $crux_dir
-else
- do_dialog --aspect 50 --msgbox "Directory $crux_dir not found. Aborting." 0 0
- exit 1
-fi
-
-main
-
-# End of file
+++ /dev/null
-#!/bin/sh
-
-mount --bind /dev /mnt/dev
-mount --bind /tmp /mnt/tmp
-mount -t proc proc /mnt/proc
-mount -t sysfs none /mnt/sys
-mount -t devpts devpts /mnt/dev/pts
-
-chroot /mnt /bin/bash
-
# search for and mount the crux media, populate a tmpfs from it,
# and prepare /newroot for switch_root at the end of the script
find_and_mount_media() {
+ echo -e -n " ${BOLD}${BLUE}*${NORM} Creating and mounting tmpfs... "
+ mkdir /.tmpfs
+ mount -t tmpfs tmpfs /.tmpfs
+ checkReturn
+
echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX media..."
- mkdir -p /media
+ mkdir -p /.tmpfs/.media
CRUXMEDIA=""
+ CDROM_DEVICES="`grep 'drive name:' /proc/sys/dev/cdrom/info | awk '{print $3 }'`"
MMC_DEVICES="`grep -E 'mmcblk' /proc/partitions | awk '{ print $4 }'`"
BLOCK_DEVICES="`grep -E '[sh]d' /proc/partitions | awk '{ print $4 }'`"
- for DEV in $MMC_DEVICES $BLOCK_DEVICES
+ for DEV in $CDROM_DEVICES $MMC_DEVICES $BLOCK_DEVICES
do
DEV="/dev/$DEV"
- mount -r $DEV /media 2> /dev/null
+ mount -r $DEV /.tmpfs/.media 2> /dev/null
if [ $? -eq 0 ]
- then
+ then
echo -e -n " ${BOLD}${GREEN}*${NORM} Found media on $DEV"
- if [ -e /media/crux-media ]
+ if [ -e /.tmpfs/.media/crux-media ]
then
echo ", CRUX media."
CRUXMEDIA=$DEV
- ln -s $DEV /dev/media
+ #ln -s $DEV /dev/media
break
else
echo ", but it's not the CRUX media."
- umount /media
+ umount /.tmpfs/.media
fi
else
echo -e " ${BOLD}${YELLOW}*${NORM} No media found on $DEV."
done
# check if the media was mounted properly. if not, spawn a shell
- if [ ! -e /media/crux-media ]
+ if [ ! -e /.tmpfs/.media/crux-media ]
then
echo
echo -e " ${BOLD}${RED}*${NORM} The CRUX media was not properly mounted!"
echo " Spawning a shell for you to attempt to fix this problem. If"
echo " you are able to find the correct device, mount it at"
- echo " /media and then log out of this shell to continue."
+ echo " /.tmpfs/.media and then log out of this shell to continue."
echo " If you are NOT able to fix the problem, installation will"
echo " not be possible."
echo
fi
# check again and stop if it's still not there
- if [ ! -e /media/crux-media ]
+ if [ ! -e /.tmpfs/.media/crux-media ]
then
echo
echo -e " ${BOLD}${RED}*${NORM} The CRUX media still appears not to be"
echo " found and installation will not continue."
echo
- else
- # configure modules
- MODULES="`find /media/crux/kernel -type f -name 'modules-*.tar.*'`"
- if [ ! -z "$MODULES" ]; then
- tar -C /tmp -xf $MODULES
- cd /lib && ln -s /tmp/lib/* .
- depmod
- fi
- # configure pkgutils
- PKGUTILS="`find /media/crux/core -type f -name 'pkgutils#*.pkg.tar.*'`"
- if [ ! -z "$PKGUTILS" ]; then
- tar -C /tmp -xf $PKGUTILS
- cd /usr/bin && ln -s /tmp/usr/bin/* .
- cd /etc && ln -s /tmp/etc/* .
- fi
+ sleep 99999
+ exit 1
fi
+
+ echo -e " ${BOLD}${BLUE}*${NORM} Populating root filesystem..."
+ mkdir -p /newroot
+ echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting new root filesystem... "
+ mount -t tmpfs tmpfs /newroot
+ checkReturn
+ echo -e -n " ${BOLD}${BLUE}*${NORM} Copying files from rootfs.tar.xz... "
+ tar -xpf /.tmpfs/.media/rootfs.tar.xz -C /newroot
+ checkReturn
+ echo -e -n " ${BOLD}${BLUE}*${NORM} Copying devices from rootfs... "
+ cp -af /dev/* /newroot/dev
+ checkReturn
+ mkdir -p /newroot/dev/pts /newroot/media
+
+ # the media gets unmounted here and remounted after switch_root
+ umount /.tmpfs/.media
+ rmdir /.tmpfs/.media
+ sed -i -e "s,#CRUXMEDIA#,${CRUXMEDIA}," /newroot/etc/fstab
+
+ echo -e -n " ${BOLD}${BLUE}*${NORM} Unmounting tmpfs... "
+ umount /.tmpfs
+ checkReturn
+ rmdir /.tmpfs
}
/bin/busybox --install -s /bin
echo "/bin/mdev" > /proc/sys/kernel/hotplug
checkReturn
-echo -e -n " ${BOLD}${BLUE}*${NORM} Creating and mounting /dev/pts... "
-mkdir /dev/pts
-mount -t devpts devpts /dev/pts
-checkReturn
-
-echo -e -n " ${BOLD}${BLUE}*${NORM} Starting kernel log daemon... "
-klogd
-checkReturn
-
-echo -e -n " ${BOLD}${BLUE}*${NORM} Setting hostname... "
-hostname crux
-checkReturn
-
-echo -e -n " ${BOLD}${BLUE}*${NORM} Loading network loopback device... "
-ip addr add 127.0.0.1/8 dev lo broadcast + scope host && \
-ip link set lo up && \
-echo "127.0.0.1 localhost crux" > /etc/hosts
-checkReturn
-
-echo -e -n " ${BOLD}${BLUE}*${NORM} Saving boot messages... "
-dmesg > /var/log/boot
-checkReturn
+if [ -d /lib/modules ]
+then
+ echo -e -n " ${BOLD}${BLUE}*${NORM} Loading modules... "
+ # TODO
+else
+ echo -e " ${BOLD}${YELLOW}*${NORM} No modules were found in the initial RAM filesystem."
+fi
grep -q "devicetimeout=*" /proc/cmdline
if [ $? -eq 0 ]
+++ /dev/null
-# base directories/device nodes
-dir /proc 755 0 0
-dir /sys 755 0 0
-dir /lib 755 0 0
-dir /dev 755 0 0
-nod /dev/console 640 0 0 c 5 1
-nod /dev/null 664 0 0 c 1 3
-
-# init itself
-file /init init 755 0 0
-
-# busybox and links
-dir /bin 755 0 0
-file /bin/busybox ../busybox-#BUSYBOX_VERSION#/busybox 4755 0 0
-slink /bin/sh busybox 777 0 0