diff --git a/debian/changelog b/debian/changelog index 62996c96..eadd8dce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -118,6 +118,8 @@ debian-cd (3.0.5) UNRELEASED; urgency=low * Drop support for building Sarge CDs. * Allow multi-arch builds using D-I images from official mirrors or local D-I images. + * Add easy-build.sh, a wrapper script for building images that takes care + of a lot of the gotchas that can make debian-cd hard to use. -- Frans Pop Tue, 14 Oct 2008 10:01:20 +0200 diff --git a/debian/rules b/debian/rules index 4282cc86..afbd004d 100755 --- a/debian/rules +++ b/debian/rules @@ -24,7 +24,8 @@ install-stamp: build-stamp # Add here commands to install the package into debian/tmp. cp -r tools tasks data Makefile README README.devel build.sh \ - build_all.sh update-cd debian/debian-cd/usr/share/debian-cd/ + build_all.sh update-cd easy-build.sh \ + debian/debian-cd/usr/share/debian-cd/ cp debian/CONF.sh debian/debian-cd/etc/debian-cd/conf.sh ln -sf /etc/debian-cd/conf.sh \ debian/debian-cd/usr/share/debian-cd/CONF.sh diff --git a/easy-build.sh b/easy-build.sh new file mode 100755 index 00000000..2f53dacc --- /dev/null +++ b/easy-build.sh @@ -0,0 +1,149 @@ +#! /bin/sh +set -e + +## Wrapper script for build.sh +## See README.easy-build for instructions how to use this script. +## See also CONF.sh for the meaning of variables used here. + +show_usage() { + echo "Usage: $(basename $0) BC|NETINST|CD|DVD [ ...]" +} + + +# Set configuration file to be used for the build and source it +export CF=CONF.sh +. $CF +export DEBIAN_CD_CONF_SOURCED=true +unset UPDATE_LOCAL + + +## Parse the parameters passed to the script + +if [ $# -eq 0 ]; then + show_usage + exit 1 +fi + +export DISKTYPE="$1" +shift + +# The architecture(s) for which to build the CD/DVD image +if [ "$1" ]; then + ARCHES="$@" +else + ARCHES=i386 +fi + + +## For what release to build images + +# The suite the installed system will be based on +export CODENAME=lenny +# The suite from which the udebs for the installer will be taken (normally +# the same as CODENAME) +export DI_CODENAME=lenny + + +## The debian-installer images to use. This must match the suite (DI_CODENAME) +## from which udebs will be taken. +## Use *only one* of the next four settings. The "%ARCH%" placeholder in the +## 2nd and 4th options will be magically expanded at runtime. +## See also: tools/boot//boot-$ARCH scripts. + +# Use official images from the local mirror +export DI_DIST=$DI_CODENAME +# or, use official images from an outside mirror +#export DI_WWW_HOME="http://ftp.nl.debian.org/debian/dists/$DI_CODENAME/main/installer-%ARCH%/current/images/" +# or, use daily built d-i images (most from http://people.debian.org) +#export DI_WWW_HOME=default +# or, use custom / locally built images +#export DI_DIR="$HOME/d-i_images/%ARCH%" + + +## Other options + +# Include local packages in the build +#export LOCAL=1 +# Automatically update the Packages file(s) for the "local" repository? +#UPDATE_LOCAL=1 + +# Number of CD/DVDs to build; comment out to build full set +MAX_CDS=1 +MAX_DVDS=1 + +# Only create the ISO files; don't create jigdo files +#MAXISOS=0 +MAXJIGDOS=0 + + +## Options that include CODENAME should be set here if needed, not in CONF.sh + +# Include proposed-updates +#export PROPOSED_UPDATES=$CODENAME-proposed-updates + +#export EXCLUDE1="$BASEDIR"/tasks/exclude-$CODENAME +#export UNEXCLUDE2="$BASEDIR"/tasks/unexclude-CD2-$CODENAME +#export UDEB_INCLUDE="$BASEDIR"/data/$CODENAME/udeb_include +#export UDEB_EXCLUDE="$BASEDIR"/data/$CODENAME/udeb_exclude +#export BASE_INCLUDE="$BASEDIR"/data/$CODENAME/base_include +#export BASE_EXCLUDE="$BASEDIR"/data/$CODENAME/base_exclude +#export SPLASHPNG="$BASEDIR/data/$CODENAME/splash-img.png" +#export RELEASE_NOTES_LOCATION="http://www.debian.org/releases/$CODENAME" + + +## The rest of the script should just work without any changes + +# Set variables that determine the type of image to be built +case $DISKTYPE in + BC) + export INSTALLER_CD=1 + ;; + NETINST) + export INSTALLER_CD=2 + ;; + CD) + unset INSTALLER_CD + [ -z "$MAX_CDS" ] || export MAXCDS=$MAX_CDS + ;; + DVD) + export INSTALLER_CD=3 + [ -z "$MAX_DVDS" ] || export MAXCDS=$MAX_DVDS + ;; + *) + show_usage + exit 1 + ;; +esac + + +if [ "$LOCAL" ] && [ "$UPDATE_LOCAL" ]; then + echo "Updating Packages files for local repository..." + for arch in $ARCHES; do + ./tools/Packages-gen.sh $CODENAME $arch + ./tools/Packages-gen.sh -i $DI_CODENAME $arch + done +fi + +if [ -d tasks ]; then + echo "Updating debian-installer task files..." + ( + cd tasks + ../tools/generate_di_list + ../tools/generate_di+k_list + ) +else + echo "Error: cannot find tasks directory" + exit 1 +fi + +echo +echo "Starting the actual debian-cd build..." +./build.sh "$ARCHES" + +# Avoid conflicts when the repository is updated later +if [ -d .svn ]; then + echo + echo "Cleanup: reverting generated changes in tasks..." + svn revert tasks/debian-installer-* \ + tasks/debian-installer+kernel-* +fi diff --git a/tools/Packages-gen.sh b/tools/Packages-gen.sh new file mode 100755 index 00000000..189610ac --- /dev/null +++ b/tools/Packages-gen.sh @@ -0,0 +1,36 @@ +#! /bin/sh +set -e + +dir=${LOCALDEBS:-$MIRROR} + +if [ ! -d "$dir" ]; then + echo "error: directory '$dir' does not exist" + echo "Check that the MIRROR or LOCALDEBS variable is set correctly." + exit 1 +fi +cd $dir + +DI= +if [ "$1" = "-i" ]; then + DI=1 + shift +fi + +distr=$1 +arch=$2 +if [ -z "$distr" ] || [ -z "$arch" ]; then + echo "Usage: $(basename $0) [-i] " + exit 1 +elif [ ! -d dists/$distr/local/ ]; then + echo "No local repository matching '$distr' was found" + exit 1 +fi + +if [ -z "$DI" ]; then + repo="dists/$distr/local/binary-$arch" +else + repo="dists/$distr/local/debian-installer/binary-$arch" +fi +[ -d $repo ] || mkdir -p $repo +echo Creating Packages file for $repo... +apt-ftparchive packages $repo | gzip >$repo/Packages.gz