2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-09-23 08:05:10 +00:00
|
|
|
# lh_source_iso(1) - build iso source image
|
2008-03-06 14:43:00 -01:00
|
|
|
# Copyright (C) 2006-2008 Daniel Baumann <daniel@debian.org>
|
2007-09-23 08:04:48 +00:00
|
|
|
#
|
|
|
|
# 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.
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Including common functions
|
|
|
|
LH_BASE="${LH_BASE:-/usr/share/live-helper}"
|
|
|
|
|
|
|
|
for FUNCTION in "${LH_BASE}"/functions/*.sh
|
2007-09-23 08:04:46 +00:00
|
|
|
do
|
2007-09-23 08:05:11 +00:00
|
|
|
. "${FUNCTION}"
|
2007-09-23 08:04:46 +00:00
|
|
|
done
|
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Setting static variables
|
2007-09-23 08:05:10 +00:00
|
|
|
DESCRIPTION="build iso source image"
|
2007-09-23 08:04:48 +00:00
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} [--force]"
|
|
|
|
|
|
|
|
Arguments "${@}"
|
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Reading configuration files
|
2008-04-07 10:10:21 +00:00
|
|
|
Read_conffile config/all config/common config/bootstrap config/chroot config/binary config/source
|
2007-09-23 08:04:46 +00:00
|
|
|
Set_defaults
|
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ "${LH_SOURCE}" != "enabled" ]
|
2007-09-23 08:04:46 +00:00
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if ! echo "${LH_SOURCE_IMAGES}" | grep -qs iso
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
Echo_message "Begin building source iso image..."
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Requiring stage file
|
|
|
|
Require_stagefile .stage/source_debian
|
2007-09-23 08:04:50 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Checking stage file
|
|
|
|
Check_stagefile .stage/source_iso
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Checking depends
|
2007-10-19 10:54:26 +00:00
|
|
|
Check_package chroot/usr/bin/genisoimage genisoimage
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Installing depends
|
|
|
|
Install_package
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Remove old iso image
|
|
|
|
if [ -f source.iso ]
|
|
|
|
then
|
|
|
|
rm -f source.iso
|
|
|
|
fi
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2007-09-23 12:05:14 +00:00
|
|
|
if [ "${LH_QUIET}" = "enabled" ]
|
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet"
|
|
|
|
fi
|
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
if [ "${LH_VERBOSE}" = "enabled" ]
|
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v"
|
|
|
|
fi
|
2007-09-23 08:05:10 +00:00
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ -n "${LH_ISO_APPLICATION}" ] && [ "${LH_ISO_APPLICATION}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2007-09-23 08:05:17 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LH_ISO_APPLICATION}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
2007-09-23 08:05:10 +00:00
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ -n "${LH_ISO_PREPARER}" ] && [ "${LH_ISO_PREPARER}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2007-09-23 08:05:17 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LH_ISO_PREPARER}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
2007-09-23 08:05:10 +00:00
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ -n "${LH_ISO_PUBLISHER}" ] && [ "${LH_ISO_PUBLISHER}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2007-09-23 08:05:17 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LH_ISO_PUBLISHER}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
2007-09-23 08:05:10 +00:00
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ -n "${LH_ISO_VOLUME}" ] && [ "${LH_ISO_VOLUME}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2007-09-23 08:05:17 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LH_ISO_VOLUME}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Moving image
|
|
|
|
mv source chroot
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
cat >> chroot/source.sh << EOF
|
2007-10-19 10:54:26 +00:00
|
|
|
genisoimage ${GENISOIMAGE_OPTIONS} -o source.iso -r -J -l -cache-inodes source
|
2007-09-23 08:05:09 +00:00
|
|
|
EOF
|
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
Chroot "sh source.sh"
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Move image
|
|
|
|
mv chroot/source chroot/source.iso ./
|
|
|
|
rm -f chroot/source.sh
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Removing depends
|
|
|
|
Remove_package
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Creating stage file
|
|
|
|
Create_stagefile .stage/source_iso
|