diff --git a/auto/config b/auto/config index d48b2c0..d00f4da 100755 --- a/auto/config +++ b/auto/config @@ -1,6 +1,11 @@ #!/bin/sh -# Various comments +# You can put local mirrors here if you want +kali_mirror=http://archive.kali.org/kali +kalisec_mirror=http://archive.kali.org/kali-security + +### DO NOT EDIT THE REST OF THIS FILE ### + # live-build doesn't work if --parent-debian-distribution is unknown of # debian-cd => we have to put a symlink so that it deals with kali like wheezy @@ -10,8 +15,36 @@ if [ ! -e /usr/share/live/build/data/debian-cd/kali ]; then exit 1 fi -kali_mirror=http://repo.kali.org/kali -kalisec_mirror=http://repo.kali.org/security +# Detect target architecture +find_arch() { + while [ -n "$1" ]; do + case "$1" in + -a|--arch|--architecture|--architectures) + echo "$2" + return + ;; + esac + shift + done + dpkg --print-architecture +} +arch=$(find_arch "$@") + +case "$arch" in + amd64) + lb_opts="--debian-installer live" + ;; + i386) + lb_opts="--debian-installer live --linux-flavours 686-pae" + ;; + armel|armhf) + lb_opts="--binary-images hdd --chroot-filesystem ext4" + ;; + *) + echo "WARNING: configuration not tested on arch $arch" >&2 + lb_opts="" + ;; +esac lb config noauto \ --distribution "kali" \ @@ -35,4 +68,5 @@ lb config noauto \ --iso-volume "Kali Live" \ --linux-packages linux-image \ --bootappend-live "boot=live config live-config.username=root hostname=kali" \ + $lb_opts \ "$@" diff --git a/build_all.sh b/build_all.sh index 89cc8f2..7b13336 100755 --- a/build_all.sh +++ b/build_all.sh @@ -7,13 +7,10 @@ KALI_VERSION="${VERSION:-daily}" HOST_ARCH="$(dpkg --print-architecture)" case "$HOST_ARCH" in i386|amd64) - CONFIG_OPTS="--debian-installer live" KALI_ARCHES="amd64 i386" IMAGE_NAME="binary.hybrid.iso" ;; armel|armhf) - # Can only generate images for the host arch - CONFIG_OPTS="--binary-images hdd" KALI_ARCHES="$HOST_ARCH" IMAGE_NAME="binary.img" ;; @@ -56,10 +53,7 @@ cd $(dirname $0) for KALI_ARCH in $KALI_ARCHES; do lb clean --purge >prepare.log 2>&1 - if [ "$KALI_ARCH" = "i386" ]; then - CONFIG_OPTS="$CONFIG_OPTS --linux-flavours 686-pae" - fi - lb config --architecture $KALI_ARCH $CONFIG_OPTS >>prepare.log 2>&1 + lb config -a $KALI_ARCH >>prepare.log 2>&1 lb build >/dev/null if [ $? -ne 0 ] || [ ! -e $IMAGE_NAME ]; then echo "Build of $KALI_ARCH live image failed" >&2 @@ -67,6 +61,7 @@ for KALI_ARCH in $KALI_ARCHES; do tail -n 50 binary.log >&2 exit 1 fi + [ -d images ] || mkdir images mv $IMAGE_NAME images/kali-$KALI_VERSION-$KALI_ARCH.${IMAGE_NAME##*.} mv binary.log images/kali-$KALI_VERSION-$KALI_ARCH.log done