diff --git a/auto/build b/auto/build deleted file mode 100755 index cd9f448..0000000 --- a/auto/build +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# This variable is required otherwise -# /usr/share/live/build/scripts/build/binary_debian-installer fails because -# the version is empty (nothing known in -# /usr/share/live/build/functions/releases.sh) -export RELEASE_kali="7.0" - -lb build noauto "$@" diff --git a/auto/config b/auto/config index 52ba51a..da4db21 100755 --- a/auto/config +++ b/auto/config @@ -1,8 +1,11 @@ -#!/bin/sh +#!/bin/bash + +set -e +set -o pipefail # Bashism # You can put local mirrors here if you want -kali_mirror=http://archive.kali.org/kali -kalisec_mirror=http://archive.kali.org/kali-security +kali_mirror=http://192.168.1.4:9999/kali +kalisec_mirror=http://192.168.1.4:9999/kali-security ### DO NOT EDIT THE REST OF THIS FILE ### @@ -12,7 +15,7 @@ public_kalisec_mirror=http://security.kali.org/kali-security # Detect target architecture and filter args temp="" arch=$(dpkg --print-architecture) -dist="kali" +dist="kali-current" lb_opts="" while [ $# -gt 0 ]; do arg="$1" @@ -23,17 +26,16 @@ while [ $# -gt 0 ]; do temp="$temp "'"'"$2"'"' shift ;; - -p|--proposed-updates) - enable_pu="1" + --distribution) + dist="$2" + shift ;; - -d|--kali-dev) - dist="kali-dev" - # No security repo - lb_opts="--security false --initsystem systemd" + --variant) + variant="$2" + shift ;; - -r|--kali-rolling) - dist="kali-rolling" - lb_opts="--initsystem systemd" + -p|--proposed-updates) + enable_pu="1" ;; --) # Skip the separator, it was added so that "lb config" @@ -49,6 +51,9 @@ while [ $# -gt 0 ]; do done eval set -- "$temp" +# Resolve release name +dist=$(curl -s $kali_mirror/dists/$dist/Release | awk '/^Codename:/ {print $2}') + # 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 if [ ! -e ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd/$dist ]; then @@ -61,6 +66,7 @@ if [ ! -e ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd/$dist ]; then fi fi +# Define options that vary across architectures case "$arch" in amd64) lb_opts="$lb_opts --debian-installer live" @@ -76,7 +82,20 @@ case "$arch" in ;; esac +# Setup configuration files from variant and options + +# Drop all files that a former run might have put into place +for file in $(cd kali-config && find . -type f); do + file=${file#./*/} + rm -f config/$file +done rm -f config/archives/kali-proposed-updates.list.* + +# Copy over all files from official kali configuration +cp -rT kali-config/common config +[ ! -d kali-config/release-$dist ] || cp -rT kali-config/release-$dist config +cp -rT kali-config/variant-$variant config + if [ -n "$enable_pu" ]; then mkdir -p config/archives echo "deb $kali_mirror kali-proposed-updates main contrib non-free" \ @@ -110,7 +129,9 @@ lb config noauto \ $lb_opts \ "$@" -if [ $dist = kali ]; then +case "$dist" in + kali|moto) # Don' use systemd for now sed -i -e 's/systemd/sysvinit/' config/package-lists/live.list.chroot -fi + ;; +esac diff --git a/build.sh b/build.sh index d3297b9..233503e 100755 --- a/build.sh +++ b/build.sh @@ -3,12 +3,14 @@ set -e set -o pipefail # Bashism -KALI_DIST=kali -KALI_VERSION="${VERSION:-daily}" -TARGET_DIR=$(dirname $0)/images -TARGET_SUBDIR="kali-$KALI_VERSION" +KALI_DIST="kali-current" +KALI_VERSION="" +KALI_VARIANT="default" +TARGET_DIR="$(dirname $0)/images" +TARGET_SUBDIR="" SUDO="sudo" VERBOSE="" +HOST_ARCH=$(dpkg --print-architecture) image_name() { local arch=$1 @@ -40,6 +42,23 @@ target_build_log() { echo ${TARGET_IMAGE_NAME%.*}.log } +default_version() { + case "$1" in + kali|kali-current) + echo "daily" + ;; + kali-rolling) + echo "rolling" + ;; + kali-dev) + echo "dev" + ;; + *) + echo "$(date +%Y%m%d)" + ;; + esac +} + failure() { echo "Build of $KALI_DIST/$KALI_ARCH live image failed" >&2 if [ -z "$VERBOSE" ]; then @@ -59,29 +78,32 @@ run_and_log() { } # Parsing command line options -temp=$(getopt -o spdrva: -l single,proposed-updates,kali-dev,kali-rolling,verbose,arch:,get-image-path -- "$@") +temp=$(getopt -o d:pva: -l distribution:,proposed-updates,kali-dev,kali-rolling,verbose,arch:,variant:,version:,get-image-path,subdir: -- "$@") eval set -- "$temp" while true; do case "$1" in - -s|--single) OPT_single="1"; shift 1; ;; + -d|--distribution) KALI_DIST="$2"; shift 2; ;; -p|--proposed-updates) OPT_pu="1"; shift 1; ;; - -d|--kali-dev) OPT_kali_dev="1"; shift 1; ;; - -r|--kali-rolling) OPT_kali_rolling="1"; shift 1; ;; + --kali-dev) KALI_DIST="kali-dev"; shift 1; ;; + --kali-rolling) KALI_DIST="kali-rolling"; shift 1; ;; -a|--arch) KALI_ARCHES="${KALI_ARCHES:+$KALI_ARCHES } $2"; shift 2; ;; -v|--verbose) VERBOSE="1"; shift 1; ;; + --variant) KALI_VARIANT="$2"; shift 2; ;; + --version) KALI_VERSION="$2"; shift 2; ;; + --subdir) TARGET_SUBDIR="$2"; shift 2; ;; --get-image-path) ACTION="get-image-path"; shift 1; ;; --) shift; break; ;; *) echo "ERROR: Invalid command-line option: $1" >&2; exit 1; ;; esac done -if [ -n "$OPT_single" ]; then - echo "WARNING: The --single option is deprecated, it's the default behaviour now." >&2 -fi - -HOST_ARCH=$(dpkg --print-architecture) +# Set default values KALI_ARCHES=${KALI_ARCHES:-$HOST_ARCH} +if [ -z "$KALI_VERSION" ]; then + KALI_VERSION="$(default_version $KALI_DIST)" +fi +# Check parameters for arch in $KALI_ARCHES; do if [ "$arch" = "$HOST_ARCH" ]; then continue @@ -95,21 +117,12 @@ for arch in $KALI_ARCHES; do ;; esac done - -KALI_CONFIG_OPTS="--" -if [ -n "$OPT_kali_rolling" ]; then - KALI_CONFIG_OPTS="$KALI_CONFIG_OPTS --kali-rolling" - if [ "$KALI_VERSION" = "daily" ]; then - KALI_VERSION="rolling" - fi - KALI_DIST="kali-rolling" -elif [ -n "$OPT_kali_dev" ]; then - KALI_CONFIG_OPTS="$KALI_CONFIG_OPTS --kali-dev" - if [ "$KALI_VERSION" = "daily" ]; then - KALI_VERSION="dev" - fi - KALI_DIST="kali-dev" +if [ ! -d "$(dirname $0)/kali-config/variant-$KALI_VARIANT" ]; then + echo "ERROR: Unknown variant of Kali configuration: $KALI_VARIANT" >&2 fi + +# Build parameters for lb config +KALI_CONFIG_OPTS="--distribution $KALI_DIST -- --variant $KALI_VARIANT" if [ -n "$OPT_pu" ]; then KALI_CONFIG_OPTS="$KALI_CONFIG_OPTS --proposed-updates" KALI_DIST="$KALI_DIST+pu" @@ -123,8 +136,8 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Or we ensure we have proper version installed ver_live_build=$(dpkg-query -f '${Version}' -W live-build) -if dpkg --compare-versions "$ver_live_build" lt 4.0.4-1kali2; then - echo "ERROR: You need live-build (>= 4.0.4-1kali2), you have $ver_live_build" >&2 +if dpkg --compare-versions "$ver_live_build" lt 4.0.4-1kali6; then + echo "ERROR: You need live-build (>= 4.0.4-1kali6), you have $ver_live_build" >&2 exit 1 fi if ! echo "$ver_live_build" | grep -q kali; then diff --git a/config/hooks/accessibility-menu.binary b/kali-config/common/hooks/accessibility-menu.binary similarity index 100% rename from config/hooks/accessibility-menu.binary rename to kali-config/common/hooks/accessibility-menu.binary diff --git a/config/hooks/forensic-menu.binary b/kali-config/common/hooks/forensic-menu.binary similarity index 100% rename from config/hooks/forensic-menu.binary rename to kali-config/common/hooks/forensic-menu.binary diff --git a/config/hooks/persistence-menu.binary b/kali-config/common/hooks/persistence-menu.binary similarity index 100% rename from config/hooks/persistence-menu.binary rename to kali-config/common/hooks/persistence-menu.binary diff --git a/config/hooks/sleep.chroot b/kali-config/common/hooks/sleep.chroot similarity index 100% rename from config/hooks/sleep.chroot rename to kali-config/common/hooks/sleep.chroot diff --git a/kali-config/common/includes.binary/isolinux/splash.png b/kali-config/common/includes.binary/isolinux/splash.png new file mode 100644 index 0000000..5c1d704 Binary files /dev/null and b/kali-config/common/includes.binary/isolinux/splash.png differ diff --git a/config/includes.binary/isolinux/stdmenu.cfg b/kali-config/common/includes.binary/isolinux/stdmenu.cfg similarity index 100% rename from config/includes.binary/isolinux/stdmenu.cfg rename to kali-config/common/includes.binary/isolinux/stdmenu.cfg diff --git a/config/includes.chroot/lib/live/config/0031-root-password b/kali-config/common/includes.chroot/lib/live/config/0031-root-password similarity index 100% rename from config/includes.chroot/lib/live/config/0031-root-password rename to kali-config/common/includes.chroot/lib/live/config/0031-root-password diff --git a/config/includes.chroot/lib/live/config/1165-fix-openssh-server b/kali-config/common/includes.chroot/lib/live/config/1165-fix-openssh-server similarity index 100% rename from config/includes.chroot/lib/live/config/1165-fix-openssh-server rename to kali-config/common/includes.chroot/lib/live/config/1165-fix-openssh-server diff --git a/config/includes.chroot/root/.bashrc b/kali-config/common/includes.chroot/root/.bashrc similarity index 100% rename from config/includes.chroot/root/.bashrc rename to kali-config/common/includes.chroot/root/.bashrc diff --git a/config/includes.chroot/usr/share/debian-installer-launcher/hooks/10_nautilus b/kali-config/common/includes.chroot/usr/share/debian-installer-launcher/hooks/10_nautilus similarity index 100% rename from config/includes.chroot/usr/share/debian-installer-launcher/hooks/10_nautilus rename to kali-config/common/includes.chroot/usr/share/debian-installer-launcher/hooks/10_nautilus diff --git a/config/includes.chroot/usr/share/debian-installer-launcher/hooks/10_network_manager b/kali-config/common/includes.chroot/usr/share/debian-installer-launcher/hooks/10_network_manager similarity index 100% rename from config/includes.chroot/usr/share/debian-installer-launcher/hooks/10_network_manager rename to kali-config/common/includes.chroot/usr/share/debian-installer-launcher/hooks/10_network_manager diff --git a/config/includes.installer/preseed.cfg b/kali-config/common/includes.installer/preseed.cfg similarity index 100% rename from config/includes.installer/preseed.cfg rename to kali-config/common/includes.installer/preseed.cfg diff --git a/config/package-lists/kali.list.binary b/kali-config/common/package-lists/kali.list.binary similarity index 100% rename from config/package-lists/kali.list.binary rename to kali-config/common/package-lists/kali.list.binary diff --git a/config/package-lists/standard.list.chroot b/kali-config/common/package-lists/standard.list.chroot similarity index 100% rename from config/package-lists/standard.list.chroot rename to kali-config/common/package-lists/standard.list.chroot diff --git a/config/includes.binary/isolinux/splash.png b/kali-config/release-moto/includes.binary/isolinux/splash.png similarity index 100% rename from config/includes.binary/isolinux/splash.png rename to kali-config/release-moto/includes.binary/isolinux/splash.png diff --git a/config/package-lists/kali.list.chroot b/kali-config/variant-default/package-lists/kali.list.chroot similarity index 100% rename from config/package-lists/kali.list.chroot rename to kali-config/variant-default/package-lists/kali.list.chroot