diff options
Diffstat (limited to 'helpers')
-rwxr-xr-x | helpers/lh_binary | 1 | ||||
-rwxr-xr-x | helpers/lh_binary_debian-installer | 5 | ||||
-rwxr-xr-x | helpers/lh_binary_encryption | 5 | ||||
-rwxr-xr-x | helpers/lh_binary_linux-image | 5 | ||||
-rwxr-xr-x | helpers/lh_binary_manifest | 5 | ||||
-rwxr-xr-x | helpers/lh_binary_md5sum | 2 | ||||
-rwxr-xr-x | helpers/lh_binary_memtest | 2 | ||||
-rwxr-xr-x | helpers/lh_binary_rootfs | 24 | ||||
-rwxr-xr-x | helpers/lh_binary_virtual-hdd | 110 | ||||
-rwxr-xr-x | helpers/lh_binary_win32-loader | 7 | ||||
-rwxr-xr-x | helpers/lh_chroot_linux-image | 5 | ||||
-rwxr-xr-x | helpers/lh_clean | 4 | ||||
-rwxr-xr-x | helpers/lh_config | 12 | ||||
-rwxr-xr-x | helpers/lh_source | 1 | ||||
-rwxr-xr-x | helpers/lh_source_virtual-hdd | 114 |
15 files changed, 294 insertions, 8 deletions
diff --git a/helpers/lh_binary b/helpers/lh_binary index 470cae0..7dcb281 100755 --- a/helpers/lh_binary +++ b/helpers/lh_binary @@ -77,6 +77,7 @@ lh_binary_iso ${*} lh_binary_net ${*} lh_binary_tar ${*} lh_binary_usb-hdd ${*} +lh_binary_virtual-hdd ${*} if [ "${LH_CHROOT_BUILD}" = "enabled" ] then diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer index 563dae6..56f0b73 100755 --- a/helpers/lh_binary_debian-installer +++ b/helpers/lh_binary_debian-installer @@ -23,6 +23,11 @@ Arguments "${@}" Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source Set_defaults +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + if [ "${_DEBUG}" = "enabled" ] then WGET_OPTIONS="${WGET_OPTIONS} --verbose" diff --git a/helpers/lh_binary_encryption b/helpers/lh_binary_encryption index b21e826..d64af37 100755 --- a/helpers/lh_binary_encryption +++ b/helpers/lh_binary_encryption @@ -23,6 +23,11 @@ Arguments "${@}" Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source Set_defaults +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + case "${LH_ENCRYPTION}" in aes128|aes192|aes256) ;; diff --git a/helpers/lh_binary_linux-image b/helpers/lh_binary_linux-image index 529e57e..f5abaab 100755 --- a/helpers/lh_binary_linux-image +++ b/helpers/lh_binary_linux-image @@ -23,6 +23,11 @@ Arguments "${@}" Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source Set_defaults +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + Echo_message "Begin install linux-image..." # Requiring stage file diff --git a/helpers/lh_binary_manifest b/helpers/lh_binary_manifest index b7d5b91..981699a 100755 --- a/helpers/lh_binary_manifest +++ b/helpers/lh_binary_manifest @@ -23,6 +23,11 @@ Arguments "${@}" Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source Set_defaults +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + Echo_message "Begin creating manifest..." # Requiring stage file diff --git a/helpers/lh_binary_md5sum b/helpers/lh_binary_md5sum index 9e4e5a3..1ca7a1e 100755 --- a/helpers/lh_binary_md5sum +++ b/helpers/lh_binary_md5sum @@ -23,7 +23,7 @@ Arguments "${@}" Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source Set_defaults -if [ "${LH_CHECKSUMS}" != "enabled" ] +if [ "${LH_CHECKSUMS}" != "enabled" ] || [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] then exit 0 fi diff --git a/helpers/lh_binary_memtest b/helpers/lh_binary_memtest index c872bf6..88bacbc 100755 --- a/helpers/lh_binary_memtest +++ b/helpers/lh_binary_memtest @@ -23,7 +23,7 @@ Arguments "${@}" Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source Set_defaults -if [ "${LH_MEMTEST}" = "disabled" ] || [ "${LH_MEMTEST}" = "none" ] +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] || [ "${LH_MEMTEST}" = "disabled" ] || [ "${LH_MEMTEST}" = "none" ] then exit 0 fi diff --git a/helpers/lh_binary_rootfs b/helpers/lh_binary_rootfs index 2099d3d..9040f87 100755 --- a/helpers/lh_binary_rootfs +++ b/helpers/lh_binary_rootfs @@ -299,6 +299,25 @@ case "${LH_CHROOT_FILESYSTEM}" in # Removing depends Remove_package ;; + + none) + if [ -d binary ] + then + rm -rf binary + fi + + case "${LH_CHROOT_BUILD}" in + enabled) + mv chroot/chroot binary + ;; + + disabled) + Echo_message "This may take a while." + cp -a chroot binary + ;; + esac + ;; + esac for STAGE in ${LH_CACHE_STAGES} @@ -309,7 +328,10 @@ do mkdir -p cache/stages_rootfs - ${LH_ROOT_COMMAND} cp -a binary/"${INITFS}"/filesystem.* cache/stages_rootfs + if [ "${LH_CHROOT_FILESYSTEM}" != "none" ] + then + ${LH_ROOT_COMMAND} cp -a binary/"${INITFS}"/filesystem.* cache/stages_rootfs + fi if [ -n "${LH_ROOT_COMMAND}" ] then diff --git a/helpers/lh_binary_virtual-hdd b/helpers/lh_binary_virtual-hdd new file mode 100755 index 0000000..b5d7876 --- /dev/null +++ b/helpers/lh_binary_virtual-hdd @@ -0,0 +1,110 @@ +#!/bin/sh + +# lh_binary_virtual-hdd(1) - build binary virtual-hdd image +# Copyright (C) 2006-2009 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. + +set -e + +# Including common functions +. "${LH_BASE:-/usr/share/live-helper}"/functions.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build binary image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if ! In_list virtual-hdd "${LH_BINARY_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building binary virtual-hdd image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap .stage/chroot_proc + +# Checking stage file +Check_stagefile .stage/binary_virtual-hdd + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LH_CHROOT_BUILD}" = "enabled" ] +then + case "${LH_BINARY_FILESYSTEM}" in + ext2|ext3) + Check_package chroot/sbin/mkfs.ext2 e2fsprogs + ;; + esac +fi + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Remove old binary +if [ -f binary-virtual.img ] +then + rm -f binary-virtual.img +fi + +Echo_message "Creating virtual disk image..." +dd if=/dev/zero of=binary-virtual.img bs=1024k count=0 seek=${LH_VIRTUAL_ROOT_SIZE} + +if [ "${LH_CHROOT_BUILD}" = "enabled" ] +then + mv binary-virtual.img chroot + + case "${LH_BINARY_FILESYSTEM}" in + ext2) + Chroot chroot "mkfs.ext2 -F binary-virtual.img" + ;; + + ext3) + Chroot chroot "mkfs.ext3 -F binary-virtual.img" + ;; + esac + + mv chroot/binary-virtual.img ./ +else + case "${LH_BINARY_FILESYSTEM}" in + ext2) + mkfs.ext2 -F binary-virtual.img + ;; + + ext3) + mkfs.ext3 -F binary-virtual.img + ;; + esac +fi + +mkdir -p binary.tmp +${LH_ROOT_COMMAND} mount -o loop binary-virtual.img binary.tmp +cp -a binary/ binary.tmp + +${LH_ROOT_COMMAND} umount binary.tmp +rmdir binary.tmp + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_virtual-hdd diff --git a/helpers/lh_binary_win32-loader b/helpers/lh_binary_win32-loader index 1126f01..9bf4370 100755 --- a/helpers/lh_binary_win32-loader +++ b/helpers/lh_binary_win32-loader @@ -23,6 +23,11 @@ Arguments "${@}" Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source Set_defaults +if [ "${LH_WIN32_LOADER}" != "enabled" ] || [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + Echo_message "Begin copying win32-loader..." # Requiring stage file @@ -37,7 +42,7 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock -if [ "${LH_WIN32_LOADER}" = "enabled" ] && [ "${LH_DISTRIBUTION}" != "etch" ] +if [ "${LH_DISTRIBUTION}" != "etch" ] then case "${LH_ARCHITECTURE}" in amd64|i386) diff --git a/helpers/lh_chroot_linux-image b/helpers/lh_chroot_linux-image index 1ee14bc..cc2c8e8 100755 --- a/helpers/lh_chroot_linux-image +++ b/helpers/lh_chroot_linux-image @@ -70,7 +70,10 @@ EOF fi # Queue installation of linux-image and ${LH_INITRAMFS} - echo ${LH_INITRAMFS} >> chroot/root/chroot_packages + if [ "${LH_INITRAMFS}" != "none" ] + then + echo ${LH_INITRAMFS} >> chroot/root/chroot_packages + fi # Creating stage file Create_stagefile .stage/chroot_linux-image diff --git a/helpers/lh_clean b/helpers/lh_clean index bb3d28f..95cf60b 100755 --- a/helpers/lh_clean +++ b/helpers/lh_clean @@ -91,7 +91,7 @@ do ${LH_ROOT_COMMAND} umount -f binary.tmp > /dev/null 2>&1 || true rm -rf binary.tmp binary.deb binary.udeb rm -f binary.iso - rm -f binary.img + rm -f binary*.img rm -f binary*.tar.gz rm -f binary.sh rm -f binary.list binary.packages md5sum.txt @@ -118,7 +118,7 @@ do --source) rm -f source.iso - rm -f source.img + rm -f source*.img rm -f source*.tar rm -f source*.tar.gz rm -f source.list diff --git a/helpers/lh_config b/helpers/lh_config index 6e6a330..f91f026 100755 --- a/helpers/lh_config +++ b/helpers/lh_config @@ -120,6 +120,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--tasks TASK]\n\ \t [--templates PATH]\n\ \t [--union-filesystem aufs|unionfs]\n\ +\t [--virtual-root-size MB]\n\ \t [--exposed-root enabled|disabled]\n\ \t [--username NAME]\n\ \t [--verbose]\n\ @@ -133,7 +134,7 @@ Local_arguments () initramfs:,fdisk:,losetup:,mode:,root-command:,use-fakeroot:,tasksel:,includes:, templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,clean, distribution:,mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-binary:, - mirror-binary-security:,categories:,chroot-filesystem:,union-filesystem:,exposed-root:, + mirror-binary-security:,categories:,chroot-filesystem:,union-filesystem:,exposed-root:,virtual-root-size:, hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:, packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-filesystem:,binary-images:, binary-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,chroot-build:, @@ -410,6 +411,11 @@ Local_arguments () shift 2 ;; + --virtual-root-size) + LH_VIRTUAL_ROOT_SIZE="${2}" + shift 2 + ;; + --exposed-root) LH_EXPOSED_ROOT="${2}" shift 2 @@ -962,6 +968,10 @@ LH_CHROOT_FILESYSTEM="${LH_CHROOT_FILESYSTEM}" # (Default: ${LH_UNION_FILESYSTEM}) LH_UNION_FILESYSTEM="${LH_UNION_FILESYSTEM}" +# \$LH_VIRTUAL_ROOT_SIZE: set virtual-hdd filesystem size +# (Default: ${LH_VIRTUAL_ROOT_SIZE}) +LH_VIRTUAL_ROOT_SIZE="${LH_VIRTUAL_ROOT_SIZE}" + # \$LH_EXPOSED_ROOT: expose root as read only # (Default: ${LH_EXPOSED_ROOT}) LH_EXPOSED_ROOT="${LH_EXPOSED_ROOT}" diff --git a/helpers/lh_source b/helpers/lh_source index 35c1831..2f4707b 100755 --- a/helpers/lh_source +++ b/helpers/lh_source @@ -45,6 +45,7 @@ lh_source_iso ${*} lh_source_net ${*} lh_source_tar ${*} lh_source_usb-hdd ${*} +lh_source_virtual-hdd ${*} # Deconfiguring chroot rm -f .stage/chroot_sources diff --git a/helpers/lh_source_virtual-hdd b/helpers/lh_source_virtual-hdd new file mode 100755 index 0000000..e02f0a0 --- /dev/null +++ b/helpers/lh_source_virtual-hdd @@ -0,0 +1,114 @@ +#!/bin/sh + +# lh_source_virtual-hdd(1) - build source virtual-hdd image +# Copyright (C) 2006-2009 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. + +set -e + +# Including common functions +. "${LH_BASE:-/usr/share/live-helper}"/functions.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build source image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE}" != "enabled" ] +then + exit 0 +fi + +if ! In_list virtual-hdd "${LH_SOURCE_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building source virtual-hdd image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/source_debian + +# Checking stage file +Check_stagefile .stage/source_virtual-hdd + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LH_CHROOT_BUILD}" = "enabled" ] +then + case "${LH_BINARY_FILESYSTEM}" in + ext2|ext3) + Check_package chroot/sbin/mkfs.ext2 e2fsprogs + ;; + esac +fi + +# Installing depends +Install_package + +# Remove old source +if [ -f source-virtual.img ] +then + rm -f source-virtual.img +fi + +# Everything which comes here needs to be cleaned up, +DU_DIM="$(du -ms source | cut -f1)" +REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LH_BINARY_FILESYSTEM})" +dd if=/dev/zero of=source-virtual.img bs=1024k count=0 seek=${REAL_DIM} + +if [ "${LH_CHROOT_BUILD}" = "enabled" ] +then + mv source-virtual.img chroot + + case "${LH_BINARY_FILESYSTEM}" in + ext2) + Chroot chroot "mkfs.ext2 -F -m 0 source-virtual.img" + ;; + + ext3) + Chroot chroot "mkfs.ext3 -F source-virtual.img" + ;; + esac + + mv chroot/source-virtual.img ./ +else + case "${LH_BINARY_FILESYSTEM}" in + ext2) + mkfs.ext2 -F -m 0 source-virtual.img + ;; + + ext3) + mkfs.ext3 -F -m 0 source-virtual.img + ;; + esac +fi + +mkdir -p source.tmp +${LH_ROOT_COMMAND} mount -o loop source-virtual.img source.tmp +cp -r source/* source.tmp + +${LH_ROOT_COMMAND} umount source.tmp +rmdir source.tmp + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/source_virtual-hdd |