Using image name from configuration to name binary output files.

This commit is contained in:
Daniel Baumann 2012-12-19 12:21:09 +01:00
parent 7bc281edde
commit 9a28d557e6
10 changed files with 43 additions and 37 deletions

View File

@ -41,8 +41,9 @@ New_configuration ()
export LIVE_CONFIGURATION_VERSION export LIVE_CONFIGURATION_VERSION
# Image # Image
#LIVE_IMAGE="$(Get_configuration config/control Image)" LIVE_IMAGE_NAME="$(Get_configuration config/control Name)"
#LIVE_IMAGE="${LIVE_IMAGE:-binary}" LIVE_IMAGE_NAME="${LIVE_IMAGE_NAME:-live}"
export LIVE_IMAGE_NAME
# Image: Architecture (FIXME: Support and default to 'any') # Image: Architecture (FIXME: Support and default to 'any')
LIVE_IMAGE_ARCHITECTURE="$(Get_configuration config/control Architecture)" LIVE_IMAGE_ARCHITECTURE="$(Get_configuration config/control Architecture)"

View File

@ -80,7 +80,7 @@ done
# File list # File list
cd binary cd binary
find . | sed -e 's|^.||g' | grep "^/" | sort > ../binary.contents find . | sed -e 's|^.||g' | grep "^/" | sort > ../${LIVE_IMAGE_NAME}.contents
cd "${OLDPWD}" cd "${OLDPWD}"
# Creating stage file # Creating stage file

View File

@ -88,9 +88,9 @@ Restore_cache cache/packages.binary
Install_package Install_package
# Remove old binary # Remove old binary
if [ -f binary.img ] if [ -f ${LIVE_iMAGE_NAME}.img ]
then then
rm -f binary.img rm -f ${LIVE_iMAGE_NAME}.img
fi fi
# Enforce fat32 if we find individual files bigger than 2GB # Enforce fat32 if we find individual files bigger than 2GB
@ -294,7 +294,7 @@ then
mv chroot/dev.tmp chroot/dev mv chroot/dev.tmp chroot/dev
fi fi
mv chroot/binary.img ./ mv chroot/binary.img ${LIVE_IMAGE_NAME}
# Saving cache # Saving cache
Save_cache cache/packages.binary Save_cache cache/packages.binary

View File

@ -26,11 +26,11 @@ Set_defaults
case "${LIVE_IMAGE_TYPE}" in case "${LIVE_IMAGE_TYPE}" in
iso) iso)
IMAGE="binary.iso" IMAGE="${LIVE_IMAGE_NAME}.iso"
;; ;;
iso-hybrid) iso-hybrid)
IMAGE="binary.hybrid.iso" IMAGE="${LIVE_IMAGE_NAME}.hybrid.iso"
;; ;;
*) *)

View File

@ -60,7 +60,7 @@ cp chroot.packages.live "binary/${INITFS}/filesystem.${SUFFIX}"
echo "$(diff chroot.packages.live chroot.packages.install | awk '/^< / { print $2 }')" \ echo "$(diff chroot.packages.live chroot.packages.install | awk '/^< / { print $2 }')" \
> "binary/${INITFS}/filesystem.${SUFFIX}-remove" > "binary/${INITFS}/filesystem.${SUFFIX}-remove"
cp chroot.packages.live binary.packages cp chroot.packages.live ${LIVE_IMAGE_NAME}.packages
# Creating stage file # Creating stage file
Create_stagefile .build/binary_manifest Create_stagefile .build/binary_manifest

View File

@ -119,7 +119,7 @@ then
fi fi
# Remove old binary # Remove old binary
rm -f binary.netboot.tar binary.netboot.tar.gz binary.netboot.tar.bz2 binary.netboot.tar.xz binary.netboot.tar.xz rm -f ${LIVE_IMAGE_NAME}.netboot.tar ${LIVE_IMAGE_NAME}.netboot.tar.gz ${LIVE_IMAGE_NAME}.netboot.tar.bz2 ${LIVE_IMAGE_NAME}.netboot.tar.xz ${LIVE_IMAGE_NAME}.netboot.tar.xz
# Creating image file # Creating image file
ROOT_DIR=$(basename ${LB_NET_ROOT_PATH}) ROOT_DIR=$(basename ${LB_NET_ROOT_PATH})
@ -142,23 +142,23 @@ cd binary.tmp
mkdir tftpboot/live mkdir tftpboot/live
mv */live/vmlinuz* */live/initrd* tftpboot/live mv */live/vmlinuz* */live/initrd* tftpboot/live
tar cf ../binary.netboot.tar * tar cf ../${LIVE_IMAGE_NAME}.netboot.tar *
case "${LB_COMPRESSION}" in case "${LB_COMPRESSION}" in
bzip2) bzip2)
bzip2 ${BZIP2_OPTIONS} ../binary.netboot.tar bzip2 ${BZIP2_OPTIONS} ../${LIVE_IMAGE_NAME}.netboot.tar
;; ;;
gzip) gzip)
gzip ${GZIP_OPTIONS} ../binary.netboot.tar gzip ${GZIP_OPTIONS} ../${LIVE_IMAGE_NAME}.netboot.tar
;; ;;
lzip) lzip)
lzip ${LZIP_OPTIONS} ../binary.netboot.tar lzip ${LZIP_OPTIONS} ../${LIVE_IMAGE_NAME}.netboot.tar
;; ;;
xz) xz)
xz ${XZ_OPTIONS} ../binary.netboot.tar xz ${XZ_OPTIONS} ../${LIVE_IMAGE_NAME}.netboot.tar
;; ;;
none) none)

View File

@ -14,7 +14,7 @@ set -e
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
# Setting static variables # Setting static variables
DESCRIPTION="$(Echo 'build harddisk binary image')" DESCRIPTION="$(Echo 'build binary tarball')"
HELP="" HELP=""
USAGE="${PROGRAM} [--force]" USAGE="${PROGRAM} [--force]"
@ -29,7 +29,7 @@ then
exit 0 exit 0
fi fi
Echo_message "Begin building binary harddisk image..." Echo_message "Begin building binary tarball..."
# Requiring stage file # Requiring stage file
Require_stagefile .build/config .build/bootstrap Require_stagefile .build/config .build/bootstrap
@ -44,25 +44,24 @@ Check_lockfile .lock
Create_lockfile .lock Create_lockfile .lock
# Remove old binary # Remove old binary
rm -f binary.tar.bz2 binary.tar.gz binary.tar.lz binary.tar rm -f ${LIVE_IMAGE_NAME}.tar.bz2 ${LIVE_IMAGE_NAME}.tar.gz ${LIVE_IMAGE_NAME}.tar.lz ${LIVE_IMAGE_NAME}.tar
tar cf binary-tar.tar binary
tar cf ${LIVE_IMAGE_NAME}.tar.tar ${LIVE_IMAGE_NAME}.
case "${LB_COMPRESSION}" in case "${LB_COMPRESSION}" in
bzip2) bzip2)
bzip2 ${BZIP2_OPTIONS} binary-tar.tar bzip2 ${BZIP2_OPTIONS} ${LIVE_IMAGE_NAME}.tar.tar
;; ;;
gzip) gzip)
gzip ${GZIP_OPTIONS} binary-tar.tar gzip ${GZIP_OPTIONS} ${LIVE_IMAGE_NAME}.tar.tar
;; ;;
lzip) lzip)
lzip ${LZIP_OPTIONS} binary-tar.tar lzip ${LZIP_OPTIONS} ${LIVE_IMAGE_NAME}.tar.tar
;; ;;
xz) xz)
xz ${XZ_OPTIONS} binary-tar.tar xz ${XZ_OPTIONS} ${LIVE_IMAGE_NAME}.tar.tar
;; ;;
none) none)

View File

@ -59,23 +59,23 @@ Install_package
case "${LIVE_IMAGE_TYPE}" in case "${LIVE_IMAGE_TYPE}" in
iso) iso)
_IMAGES="binary.iso" _IMAGES="${LIVE_IMAGE_NAME}.iso"
;; ;;
iso-hybrid) iso-hybrid)
_IMAGES="binary.hybrid.iso" _IMAGES="${LIVE_IMAGE_NAME}.hybrid.iso"
;; ;;
hdd) hdd)
_IMAGES="binary.img" _IMAGES="${LIVE_IMAGE_NAME}.img"
;; ;;
net) net)
_IMAGES="binary.netboot.tar*" _IMAGES="${LIVE_IMAGE_NAME}.netboot.tar*"
;; ;;
tar) tar)
_IMAGES="binary.tar*" _IMAGES="${LIVE_IMAGE_NAME}.tar*"
;; ;;
esac esac

View File

@ -97,12 +97,12 @@ do
--binary) --binary)
${LB_ROOT_COMMAND} umount -f binary.tmp > /dev/null 2>&1 || true ${LB_ROOT_COMMAND} umount -f binary.tmp > /dev/null 2>&1 || true
rm -rf binary.tmp binary.deb binary.udeb rm -rf binary.tmp binary.deb binary.udeb
rm -f binary*.iso rm -f ${LIVE_IMAGE_NAME}*.iso
rm -f binary*.img rm -f ${LIVE_IMAGE_NAME}*.img
rm -f binary*.tar.gz rm -f ${LIVE_IMAGE_NAME}*.tar.gz
rm -f binary*.zsync* rm -f ${LIVE_IMAGE_NAME}*.zsync*
rm -f binary.sh rm -f ${LIVE_IMAGE_NAME}.sh
rm -f binary.contents binary.packages md5sum.txt rm -f ${LIVE_IMAGE_NAME}.contents ${LIVE_IMAGE_NAME}.packages md5sum.txt
rm -rf binary rm -rf binary
rm -rf tftpboot rm -rf tftpboot

View File

@ -66,6 +66,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--initramfs auto|none|live-boot|casper]\n\ \t [--initramfs auto|none|live-boot|casper]\n\
\t [--initramfs-compression bzip2|gzip|lzma]\n\ \t [--initramfs-compression bzip2|gzip|lzma]\n\
\t [--initsystem sysvinit|runit|systemd|upstart|none]\n\ \t [--initsystem sysvinit|runit|systemd|upstart|none]\n\
\t [--image-name [NAME]\n\
\t [--interactive shell]\n\ \t [--interactive shell]\n\
\t [--isohybrid-options OPTION|\"OPTIONS\"]\n\ \t [--isohybrid-options OPTION|\"OPTIONS\"]\n\
\t [--hdd-label LABEL]\n\ \t [--hdd-label LABEL]\n\
@ -150,7 +151,7 @@ Local_arguments ()
mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-chroot-updates:,mirror-chroot-backports:,mirror-binary:, mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-chroot-updates:,mirror-chroot-backports:,mirror-binary:,
mirror-binary-security:,mirror-binary-updates:,mirror-binary-backports:,mirror-debian-installer:, mirror-binary-security:,mirror-binary-updates:,mirror-binary-backports:,mirror-debian-installer:,
archives:,archive-areas:,parent-archive-areas:,chroot-filesystem:,exposed-root:, archives:,archive-areas:,parent-archive-areas:,chroot-filesystem:,exposed-root:,
gzip-options:,hooks:,interactive:,keyring-packages:,linux-flavours:,linux-packages:, gzip-options:,hooks:,image-name:,interactive:,keyring-packages:,linux-flavours:,linux-packages:,
security:,updates:,backports:,binary-filesystem:,binary-images:, security:,updates:,backports:,binary-filesystem:,binary-images:,
apt-indices:,bootappend-install:,bootappend-live:,bootappend-live-failsafe:,bootloader:,checksums:,compression:,config:,zsync:,build-with-chroot:, apt-indices:,bootappend-install:,bootappend-live:,bootappend-live-failsafe:,bootloader:,checksums:,compression:,config:,zsync:,build-with-chroot:,
debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:,
@ -520,6 +521,11 @@ Local_arguments ()
shift 2 shift 2
;; ;;
--image-name)
LIVE_IMAGE_NAME="${2}"
shift 2
;;
--interactive) --interactive)
LB_INTERACTIVE="${2}" LB_INTERACTIVE="${2}"
shift 2 shift 2
@ -1484,7 +1490,7 @@ fi
# New style configuration # New style configuration
Set_configuration "config/control" "Configuration-Version" "${LIVE_CONFIGURATION_VERSION}" Set_configuration "config/control" "Configuration-Version" "${LIVE_CONFIGURATION_VERSION}"
echo "" >> config/control echo "" >> config/control
Set_configuration "config/control" "Image" "binary" Set_configuration "config/control" "Name" "${LIVE_IMAGE_NAME}"
Set_configuration "config/control" "Architecture" "${LIVE_IMAGE_ARCHITECTURE}" Set_configuration "config/control" "Architecture" "${LIVE_IMAGE_ARCHITECTURE}"
Set_configuration "config/control" "Type" "${LIVE_IMAGE_TYPE}" Set_configuration "config/control" "Type" "${LIVE_IMAGE_TYPE}"