From: Michael Tremer Date: Wed, 6 May 2009 16:38:45 +0000 (+0200) Subject: Rewrite of packaging code. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db2ab9383f31cf5666ca43f734307807d21373eb;p=ipfire-3.x.git Rewrite of packaging code. --- diff --git a/lfs/Config b/lfs/Config index 0b084615b..44a1bc709 100644 --- a/lfs/Config +++ b/lfs/Config @@ -71,6 +71,8 @@ CONFIGURE_ARCH = \ PKG_PACKAGE=$(PKG_NAME)-$(PKG_VER)-$(SNAME)$(PKG_REL).$(TARGET).ipk +IMAGE_FILE = $(IMAGES_DIR)/$(SNAME)-$(VERSION).sfs + ############################################################################### # Common Macro Definitions ############################################################################### @@ -112,11 +114,9 @@ define DO_PKG_INFO endef define DO_PACKAGE - if [ -n "$$ROOTFILE" ]; then \ - NAME=$(NAME) SNAME=$(SNAME) VERSION=$(VERSION) KVER=$(KVER) \ - TARGET=$(TARGET) MACHINE=$(MACHINE) IFS_TARGET=$(IFS_TARGET) \ - $(DIR_SOURCE)/pakfire/compressor $(PKG_PACKAGE) $$ROOTFILE; \ - fi + NAME=$(NAME) SNAME=$(SNAME) VERSION=$(VERSION) KVER=$(KVER) \ + TARGET=$(TARGET) MACHINE=$(MACHINE) IFS_TARGET=$(IFS_TARGET) \ + $(DIR_SOURCE)/pakfire/compressor $(PKG_PACKAGE) $$ROOTFILE endef # For each package we create a list of files that it installed under diff --git a/lfs/cdrom b/lfs/cdrom deleted file mode 120000 index 5e798fa0e..000000000 --- a/lfs/cdrom +++ /dev/null @@ -1 +0,0 @@ -images \ No newline at end of file diff --git a/lfs/cdrom b/lfs/cdrom new file mode 100644 index 000000000..c664ef8b2 --- /dev/null +++ b/lfs/cdrom @@ -0,0 +1,109 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# 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 . # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +PKG_NAME = cdrom +PKG_VER = +PKG_REL = -1 + +THISAPP = $(PKG_NAME) + +OBJECT = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP) + +MAINTAINER = +GROUP = +CORE = no +EXTRA = no +DEBUG = no +DEPS = images-core images-info images-initramfs images-overlays + +URL = +LICENSE = + +############################################################################### +# Top-level Rules +############################################################################### + +objects = + +download: $(objects) + +info: + $(DO_PKG_INFO) + +install: $(OBJECT) + +package: + @$(DO_PACKAGE) + +$(objects): + @$(LOAD) + +############################################################################### +# Installation Details +############################################################################### + +$(OBJECT): $(objects) + @rm -rf $(CDROM_DIR)/* $(CDROM_DIR)/.$(SNAME)info + + mkdir -pv $(CDROM_DIR)/{isolinux,doc} + + # Copy image and all overlays + cp -vf $(IMAGE_FILE) $(IMAGES_DIR)/*.overlay $(CDROM_DIR) + + # Install documentation + cp -vf $(DIR_SRC)/doc/{COPYING,ChangeLog,packages-list.txt} $(CDROM_DIR)/doc + $(INSTALL_CONFIG) $(DIR_CONF)/cdrom/README.txt > $(CDROM_DIR)/README + + # Install kernel and initramfs + cp -vf $(IMAGES_DIR)/initramfs-$(VERSION).img $(CDROM_DIR)/isolinux/initrd0 + cp -vf /boot/ipfirekernel-$(KVER) $(CDROM_DIR)/isolinux/$(SNAME)0 + + # If we have build the extras, we copy them on + # the disk +ifeq "$(BUILD_EXTRAS)" "1" + # Copying extra packages to cdrom + mkdir -pv $(CDROM_DIR)/packages + cd $(DIR_PACKAGES) && cp -vf $(PACKAGES_EXTRA) $(CDROM_DIR)/packages +endif + + # Install isolinux & configuration + cp -vf /usr/share/syslinux/{isolinux.bin,vesamenu.c32} \ + /usr/lib/memtest86+/memtest.bin \ + $(DIR_CONF)/bootloader/splash.{jpg,lss} \ + $(DIR_CONF)/bootloader/*.msg $(CDROM_DIR)/isolinux/ + $(INSTALL_CONFIG) $(DIR_CONF)/bootloader/installer.conf \ + > $(CDROM_DIR)/$(PREFIX)/isolinux.cfg + + # Info file + echo "Release: $(NAME)-$(VERSION)" >> $(CDROM_DIR)/.$(SNAME)info + echo "Build host: $$(hostname -f)" >> $(CDROM_DIR)/.$(SNAME)info + echo "Date: $$(date -u)" >> $(CDROM_DIR)/.$(SNAME)info + + cd $(CDROM_DIR) && mkisofs -J -r -V "$(NAME)_$(VERSION)" \ + -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ + -boot-load-size 4 -boot-info-table . > $(IMAGES_DIR)/$(IMAGENAME).iso + + @rm -rf $(CDROM_DIR)/* $(CDROM_DIR)/.$(SNAME)info diff --git a/lfs/images b/lfs/images index 905d63ab6..eab199b73 100644 --- a/lfs/images +++ b/lfs/images @@ -42,20 +42,24 @@ DEPS = URL = LICENSE = -IMAGE_FILE = $(IMAGES_DIR)/$(SNAME)-$(VERSION).img +ifeq "$(firstword $(MAKEFILE_LIST))" "images-initramfs" + PASS = initramfs +endif + +ifeq "$(firstword $(MAKEFILE_LIST))" "images-overlays" + PASS = overlays +endif -PASS = $(firstword $(MAKEFILE_LIST)) +ifeq "$(firstword $(MAKEFILE_LIST))" "images-core" + PASS = core +endif -ifeq "$(PASS)" "pxe" - PREFIX = $(SNAME)-$(VERSION) -else - DEPS2 = $(IMAGE_FILE) - PREFIX = isolinux +ifeq "$(firstword $(MAKEFILE_LIST))" "images-info" + PASS = info endif -ROOTFILES = $(DIR_SOURCE)/rootfiles/core -ifeq "$(BUILD_DEBUG)" "1" - ROOTFILES += $(DIR_SOURCE)/rootfiles/debug +ifneq "$(PASS)" "" + PKG_NAME = images-$(PASS) endif ############################################################################### @@ -81,96 +85,33 @@ $(objects): # Installation Details ############################################################################### -$(IMAGE_FILE): - @rm -rf $(IMAGES_DIR)/$(SNAME)-$(VERSION).img /tmp/$(SNAME)-$(VERSION) - - # For the moment, we extract all available packages. - cd $(DIR_PACKAGES) && $(DIR_SOURCE)/pakfire/decompressor --root=/tmp/$(SNAME)-$(VERSION) $(PACKAGES_CORE) - - # Do some tests im the environment is sane - ldconfig -r /tmp/$(SNAME)-$(VERSION) - - cd /tmp/$(SNAME)-$(VERSION) && mksquashfs * $(IMAGES_DIR)/$(SNAME)-$(VERSION).img -b 1M - rm -rf /tmp/$(SNAME)-$(VERSION) - -$(OBJECT): $(objects) $(DEPS2) - @rm -rf $(CDROM_DIR)/* $(CDROM_DIR)/.$(SNAME)info +$(OBJECT): $(objects) -ifeq "$(PASS)" "pxe" - mkdir -pv $(CDROM_DIR)/{pxelinux.cfg,$(PREFIX)} +ifeq "$(PASS)" "info" + # info file + (echo "Release: $(NAME)-$(VERSION) ($(SLOGAN))"; \ + echo "Build host: $$(hostname -f)"; \ + echo "Date: $$(date -u)") >> $(IMAGES_DIR)/.$(SNAME)info endif -ifeq "$(PASS)" "cdrom" - mkdir -pv $(CDROM_DIR)/{isolinux,doc} - - cp -vf $(IMAGES_DIR)/$(SNAME)-$(VERSION).img $(CDROM_DIR) - cd $(CDROM_DIR) && unsquashfs -ls $(SNAME)-$(VERSION).img > $(SNAME)-$(VERSION).ls - - cd $(INSTALLER_DIR) && mksquashfs * $(CDROM_DIR)/pomona-$(VERSION).overlay -b 1M - - # These files won't be included in the iso - @rm -rf $(CDROM_DIR)/archive.{files,errors} $(CDROM_DIR)/tmp - - # Other files - sed 's/VERSION/$(VERSION)/' $(DIR_CONF)/cdrom/README.txt > $(CDROM_DIR)/README - cp -vf $(DIR_SRC)/doc/COPYING $(CDROM_DIR) - cp -vf $(DIR_SRC)/doc/{ChangeLog,packages-list.txt} $(CDROM_DIR)/doc +ifeq "$(PASS)" "initramfs" + mkliveramfs -v -f --with-net $(IMAGES_DIR)/initramfs-$(VERSION).img $(KVER) endif -ifneq "$(PASS)" "$(THISAPP)" - cp -vf $(IMAGES_DIR)/initramfs-$(VERSION).img $(CDROM_DIR)/$(PREFIX)/initrd0 - cp -vf /boot/ipfirekernel-$(KVER) $(CDROM_DIR)/$(PREFIX)/$(SNAME)0 +ifeq "$(PASS)" "core" + @rm -rf /tmp/$(SNAME)-$(VERSION) - cp -vf /usr/share/syslinux/vesamenu.c32 \ - $(DIR_CONF)/bootloader/splash.{jpg,lss} \ - $(DIR_CONF)/bootloader/*.msg \ - $(CDROM_DIR)/$(PREFIX)/ -endif + cd $(DIR_PACKAGES) && $(DIR_SOURCE)/pakfire/decompressor \ + --root=/tmp/$(SNAME)-$(VERSION) $(PACKAGES_CORE) -ifeq "$(PASS)" "pxe" - cp -vf /usr/share/syslinux/pxelinux.0 $(CDROM_DIR)/ - sed -e "s/SNAME/$(SNAME)/g" \ - -e "s/NAME/$(NAME)/g" \ - -e "s/VERSION/$(VERSION)/g" \ - -e "s@$(SNAME)0@$(PREFIX)/$(SNAME)0@g" \ - -e "s@initrd0@$(PREFIX)/initrd0@g" \ - -e "s@splash@$(PREFIX)/splash@g" \ - -e "s@vesamenu.c32@$(PREFIX)/vesamenu.c32@g" \ - $(DIR_CONF)/bootloader/installer.conf \ - > $(CDROM_DIR)/pxelinux.cfg/$(SNAME)-pxe-$(VERSION).model - - sed -e "s@splash@$(PREFIX)/splash@g" \ - -i $(CDROM_DIR)/$(PREFIX)/boot.msg - - cd $(CDROM_DIR) && \ - tar cfz $(IMAGES_DIR)/$(IMAGENAME).pxe.tar.gz * -endif + # Do some tests im the environment is sane + ldconfig -r /tmp/$(SNAME)-$(VERSION) -ifeq "$(PASS)" "cdrom" - cp -vf /usr/share/syslinux/isolinux.bin $(CDROM_DIR)/$(PREFIX)/ - - # Copying extra packages to cdrom - mkdir -pv $(CDROM_DIR)/packages - for package in $(PACKAGES_EXTRA); do \ - cp -vf $(DIR_PACKAGES)/$$package $(CDROM_DIR)/packages; \ - done - sed -e "s/SNAME/$(SNAME)/g" \ - -e "s/NAME/$(NAME)/g" \ - -e "s/VERSION/$(VERSION)/g" \ - $(DIR_CONF)/bootloader/installer.conf \ - > $(CDROM_DIR)/$(PREFIX)/isolinux.cfg - cp -vf /usr/lib/memtest86+/memtest.bin $(CDROM_DIR)/$(PREFIX)/memtest + cd /tmp/$(SNAME)-$(VERSION) && mksquashfs * $(IMAGE_FILE) -b 1M -noappend + rm -rf /tmp/$(SNAME)-$(VERSION) +endif - # info file - echo "Release: $(NAME)-$(VERSION)" >> $(CDROM_DIR)/.$(SNAME)info - echo "Build host: $$(hostname)" >> $(CDROM_DIR)/.$(SNAME)info - echo "Date: $$(date)" >> $(CDROM_DIR)/.$(SNAME)info - echo "SHA1: $$(sha1sum $(CDROM_DIR)/$(SNAME)-$(VERSION).img | awk '{ print $$1 }')" \ - >> $(CDROM_DIR)/.$(SNAME)info - - cd $(CDROM_DIR) && mkisofs -J -r -V "$(NAME)_$(VERSION)" \ - -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ - -boot-info-table . > $(IMAGES_DIR)/$(IMAGENAME).iso +ifeq "$(PASS)" "overlays" + # Creating installer's overlay + cd $(INSTALLER_DIR) && mksquashfs * $(IMAGES_DIR)/pomona-$(VERSION).overlay -b 1M -noappend endif - - @rm -rf $(CDROM_DIR)/* $(CDROM_DIR)/.$(SNAME)info diff --git a/lfs/images-core b/lfs/images-core new file mode 120000 index 000000000..5e798fa0e --- /dev/null +++ b/lfs/images-core @@ -0,0 +1 @@ +images \ No newline at end of file diff --git a/lfs/images-info b/lfs/images-info new file mode 120000 index 000000000..5e798fa0e --- /dev/null +++ b/lfs/images-info @@ -0,0 +1 @@ +images \ No newline at end of file diff --git a/lfs/images-initramfs b/lfs/images-initramfs new file mode 120000 index 000000000..5e798fa0e --- /dev/null +++ b/lfs/images-initramfs @@ -0,0 +1 @@ +images \ No newline at end of file diff --git a/lfs/images-overlays b/lfs/images-overlays new file mode 120000 index 000000000..5e798fa0e --- /dev/null +++ b/lfs/images-overlays @@ -0,0 +1 @@ +images \ No newline at end of file diff --git a/lfs/pxe b/lfs/pxe index a9aea00ab..0403dcd46 100644 --- a/lfs/pxe +++ b/lfs/pxe @@ -37,7 +37,7 @@ GROUP = CORE = no EXTRA = no DEBUG = no -DEPS = +DEPS = images-initramfs URL = LICENSE = @@ -70,9 +70,8 @@ $(objects): $(OBJECT): $(objects) @rm -rf $(PXE_DIR)/* && mkdir -pv $(PXE_DIR)/{pxelinux.cfg,$(SNAME)} - # Make image with networking support - mkliveramfs -f --with-net $(CDROM_DIR)/$(SNAME)/initrd0 $(KVER) - + # Copy image with networking support + cp -vf $(IMAGES_DIR)/initramfs-$(VERSION).img $(CDROM_DIR)/$(SNAME)/initrd0 cp -vf /boot/ipfirekernel-$(KVER) $(CDROM_DIR)/$(SNAME)/$(SNAME)0 cp -vf /usr/share/syslinux/vesamenu.c32 \ $(DIR_CONF)/bootloader/splash.{jpg,lss} \ diff --git a/make.sh b/make.sh index 9b0ceaeb6..3e9e71a8c 100755 --- a/make.sh +++ b/make.sh @@ -472,8 +472,10 @@ packages_build() { beautify message DONE if [ ${EMB} -eq 0 ]; then - ipfire_make initramfs - ipfire_make images + ipfire_make images-core + ipfire_make images-info + ipfire_make images-initramfs + ipfire_make images-overlays ipfire_make pxe ipfire_make cdrom diff --git a/src/pakfire/decompressor b/src/pakfire/decompressor index 337a4deab..75bc101f2 100755 --- a/src/pakfire/decompressor +++ b/src/pakfire/decompressor @@ -50,6 +50,9 @@ if [ "$ROOT" != "/" ]; then fi fi +# Sort all packages +FILES=$(for i in $FILES; do echo $i; done | sort -u) + for file in $FILES; do echo "Extracting $file..." lzma -cd $file | cpio -diu --no-absolute-filenames --quiet