Consistency: tabs to spaces

merge-requests/18/head
g0t mi1k 3 months ago
parent 26efadcc71
commit fb95194293

@ -3,13 +3,13 @@
lb clean noauto "$@" lb clean noauto "$@"
rm -fv config/binary \ rm -fv config/binary \
config/bootstrap \ config/bootstrap \
config/chroot \ config/chroot \
config/common \ config/common \
config/source \ config/source \
config/package-lists/live.list.chroot config/package-lists/live.list.chroot
if [ -e config/hooks/ ]; then if [ -e config/hooks/ ]; then
find config/hooks/ -type l \ find config/hooks/ -type l \
| xargs --no-run-if-empty rm -f | xargs --no-run-if-empty rm -f
fi fi

@ -6,9 +6,9 @@ set -o pipefail # Bashism
# You can put a local mirror here if you want (or you can set # You can put a local mirror here if you want (or you can set
# it in .mirror) # it in .mirror)
if [ -e .mirror ]; then if [ -e .mirror ]; then
kali_mirror=$(cat .mirror) kali_mirror=$(cat .mirror)
else else
kali_mirror=http://kali.download/kali kali_mirror=http://kali.download/kali
fi fi
### DO NOT EDIT THE REST OF THIS FILE ### ### DO NOT EDIT THE REST OF THIS FILE ###
@ -21,93 +21,93 @@ arch=$(dpkg --print-architecture)
dist="kali-rolling" dist="kali-rolling"
lb_opts="" lb_opts=""
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
arg="$1" arg="$1"
case "$arg" in case "$arg" in
-a|--arch|--architecture|--architectures) -a|--arch|--architecture|--architectures)
arch="$2" arch="$2"
temp="$temp "'"'"$arg"'"' temp="$temp "'"'"$arg"'"'
temp="$temp "'"'"$2"'"' temp="$temp "'"'"$2"'"'
shift shift
;; ;;
--distribution) --distribution)
dist="$2" dist="$2"
shift shift
;; ;;
--variant) --variant)
variant="$2" variant="$2"
shift shift
;; ;;
-p|--proposed-updates) -p|--proposed-updates)
enable_pu="1" enable_pu="1"
;; ;;
--) --)
# Skip the separator, it was added so that "lb config" # Skip the separator, it was added so that "lb config"
# doesn't barf on our own options, but now we are # doesn't barf on our own options, but now we are
# filtering them away assuming that the remaining ones # filtering them away assuming that the remaining ones
# are intended for lb config ! # are intended for lb config !
;; ;;
*) *)
temp="$temp "'"'"$arg"'"' temp="$temp "'"'"$arg"'"'
;; ;;
esac esac
shift shift
done done
eval set -- "$temp" eval set -- "$temp"
# Resolve release name # Resolve release name
dist=$(wget -q -O- $kali_mirror/dists/$dist/Release | awk '/^Codename:/ {print $2}') dist=$(wget -q -O- $kali_mirror/dists/$dist/Release | awk '/^Codename:/ {print $2}')
if [ -z "$dist" ]; then if [ -z "$dist" ]; then
echo "ERROR: Build release could not be resolved" echo "ERROR: Build release could not be resolved"
exit 1 exit 1
fi fi
# live-build doesn't work if --parent-debian-distribution is unknown of # 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 sid # debian-cd => we have to put a symlink so that it deals with kali like sid
if [ ! -e ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd/$dist ]; then if [ ! -e ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd/$dist ]; then
if [ -w ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd ]; then if [ -w ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd ]; then
ln -sf sid ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd/$dist ln -sf sid ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd/$dist
else else
echo "ERROR: Run this first:" echo "ERROR: Run this first:"
echo "ln -sf sid ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd/$dist" echo "ln -sf sid ${LIVE_BUILD:-/usr/share/live/build}/data/debian-cd/$dist"
exit 1 exit 1
fi fi
fi fi
# Define options that vary across architectures # Define options that vary across architectures
case "$arch" in case "$arch" in
amd64) amd64)
lb_opts="$lb_opts --debian-installer live" lb_opts="$lb_opts --debian-installer live"
;; ;;
i386) i386)
lb_opts="$lb_opts --debian-installer live --linux-flavours 686-pae" lb_opts="$lb_opts --debian-installer live --linux-flavours 686-pae"
;; ;;
arm64) arm64)
lb_opts="$lb_opts --bootloaders grub-efi --uefi-secure-boot disable" lb_opts="$lb_opts --bootloaders grub-efi --uefi-secure-boot disable"
;; ;;
armel|armhf) armel|armhf)
lb_opts="$lb_opts --binary-images hdd --binary-filesystem ext4 --chroot-filesystem none" lb_opts="$lb_opts --binary-images hdd --binary-filesystem ext4 --chroot-filesystem none"
;; ;;
*) *)
echo "WARNING: configuration not tested on arch $arch" >&2 echo "WARNING: configuration not tested on arch $arch" >&2
;; ;;
esac esac
# Define options that vary across distributions # Define options that vary across distributions
case "$dist" in case "$dist" in
kali-last-snapshot) kali-last-snapshot)
# We don't want kali-last-snapshot to end up in the image, it # We don't want kali-last-snapshot to end up in the image, it
# should be replaced with kali-rolling # should be replaced with kali-rolling
lb_opts="$lb_opts --distribution-binary kali-rolling" lb_opts="$lb_opts --distribution-binary kali-rolling"
lb_opts="$lb_opts --debootstrap-script /usr/share/debootstrap/scripts/kali-rolling" lb_opts="$lb_opts --debootstrap-script /usr/share/debootstrap/scripts/kali-rolling"
;; ;;
esac esac
# Setup configuration files from variant and options # Setup configuration files from variant and options
# Drop all files that a former run might have put into place # Drop all files that a former run might have put into place
for file in $(cd kali-config && find ./common ./variant-* -type f); do for file in $(cd kali-config && find ./common ./variant-* -type f); do
file=${file#./*/} file=${file#./*/}
rm -fv config/$file rm -fv config/$file
done done
rm -fv config/archives/kali-proposed-updates.list.* rm -fv config/archives/kali-proposed-updates.list.*
@ -116,37 +116,37 @@ cp -rT kali-config/common config
[ ! -d kali-config/variant-$variant ] || cp -rTL kali-config/variant-$variant config [ ! -d kali-config/variant-$variant ] || cp -rTL kali-config/variant-$variant config
if [ -n "$enable_pu" ]; then if [ -n "$enable_pu" ]; then
mkdir -p config/archives mkdir -p config/archives
echo "deb $kali_mirror $dist-proposed-updates main contrib non-free non-free-firmware" \ echo "deb $kali_mirror $dist-proposed-updates main contrib non-free non-free-firmware" \
> config/archives/kali-proposed-updates.list.chroot > config/archives/kali-proposed-updates.list.chroot
echo "deb $public_kali_mirror $dist-proposed-updates main contrib non-free non-free-firmware" \ echo "deb $public_kali_mirror $dist-proposed-updates main contrib non-free non-free-firmware" \
> config/archives/kali-proposed-updates.list.binary > config/archives/kali-proposed-updates.list.binary
fi fi
lb config noauto \ lb config noauto \
--apt-indices=false \ --apt-indices=false \
--distribution "$dist" \ --distribution "$dist" \
--debian-installer-distribution "$dist" \ --debian-installer-distribution "$dist" \
--archive-areas "main contrib non-free non-free-firmware" \ --archive-areas "main contrib non-free non-free-firmware" \
--debootstrap-options "--keyring=/usr/share/keyrings/kali-archive-keyring.gpg" \ --debootstrap-options "--keyring=/usr/share/keyrings/kali-archive-keyring.gpg" \
--keyring-packages kali-archive-keyring \ --keyring-packages kali-archive-keyring \
--updates false \ --updates false \
--backports false \ --backports false \
--source false \ --source false \
--firmware-binary true \ --firmware-binary true \
--firmware-chroot true \ --firmware-chroot true \
--mirror-bootstrap "$kali_mirror" \ --mirror-bootstrap "$kali_mirror" \
--mirror-debian-installer "$kali_mirror" \ --mirror-debian-installer "$kali_mirror" \
--mirror-binary "$public_kali_mirror" \ --mirror-binary "$public_kali_mirror" \
--iso-application "Kali Linux" \ --iso-application "Kali Linux" \
--iso-publisher "Kali" \ --iso-publisher "Kali" \
--iso-volume "Kali Live" \ --iso-volume "Kali Live" \
--linux-packages linux-image \ --linux-packages linux-image \
--memtest memtest86+ \ --memtest memtest86+ \
--bootappend-live "boot=live components quiet splash noeject" \ --bootappend-live "boot=live components quiet splash noeject" \
--bootappend-live-failsafe "boot=live components noeject memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal" \ --bootappend-live-failsafe "boot=live components noeject memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal" \
--bootappend-install "net.ifnames=0" \ --bootappend-install "net.ifnames=0" \
--security false \ --security false \
--win32-loader false \ --win32-loader false \
$lb_opts \ $lb_opts \
"$@" "$@"

@ -17,111 +17,111 @@ DEBUG=""
HOST_ARCH=$(dpkg --print-architecture) HOST_ARCH=$(dpkg --print-architecture)
image_name() { image_name() {
case "$KALI_ARCH" in case "$KALI_ARCH" in
i386|amd64|arm64) i386|amd64|arm64)
echo "live-image-$KALI_ARCH.hybrid.iso" echo "live-image-$KALI_ARCH.hybrid.iso"
;; ;;
armel|armhf) armel|armhf)
echo "live-image-$KALI_ARCH.img" echo "live-image-$KALI_ARCH.img"
;; ;;
esac esac
} }
target_image_name() { target_image_name() {
local arch=$1 local arch=$1
IMAGE_NAME="$(image_name $arch)" IMAGE_NAME="$(image_name $arch)"
IMAGE_EXT="${IMAGE_NAME##*.}" IMAGE_EXT="${IMAGE_NAME##*.}"
if [ "$IMAGE_EXT" = "$IMAGE_NAME" ]; then if [ "$IMAGE_EXT" = "$IMAGE_NAME" ]; then
IMAGE_EXT="img" IMAGE_EXT="img"
fi fi
if [ "$KALI_VARIANT" = "default" ]; then if [ "$KALI_VARIANT" = "default" ]; then
echo "${TARGET_SUBDIR:+$TARGET_SUBDIR/}kali-linux-$KALI_VERSION-live-$KALI_ARCH.$IMAGE_EXT" echo "${TARGET_SUBDIR:+$TARGET_SUBDIR/}kali-linux-$KALI_VERSION-live-$KALI_ARCH.$IMAGE_EXT"
else else
echo "${TARGET_SUBDIR:+$TARGET_SUBDIR/}kali-linux-$KALI_VERSION-live-$KALI_VARIANT-$KALI_ARCH.$IMAGE_EXT" echo "${TARGET_SUBDIR:+$TARGET_SUBDIR/}kali-linux-$KALI_VERSION-live-$KALI_VARIANT-$KALI_ARCH.$IMAGE_EXT"
fi fi
} }
target_build_log() { target_build_log() {
TARGET_IMAGE_NAME=$(target_image_name $1) TARGET_IMAGE_NAME=$(target_image_name $1)
echo ${TARGET_IMAGE_NAME%.*}.log echo ${TARGET_IMAGE_NAME%.*}.log
} }
default_version() { default_version() {
case "$1" in case "$1" in
kali-*) kali-*)
echo "${1#kali-}" echo "${1#kali-}"
;; ;;
*) *)
echo "$1" echo "$1"
;; ;;
esac esac
} }
failure() { failure() {
echo "Build of $KALI_DIST/$KALI_VARIANT/$KALI_ARCH live image failed (see build.log for details)" >&2 echo "Build of $KALI_DIST/$KALI_VARIANT/$KALI_ARCH live image failed (see build.log for details)" >&2
echo "Log: $BUILD_LOG" >&2 echo "Log: $BUILD_LOG" >&2
exit 2 exit 2
} }
run_and_log() { run_and_log() {
if [ -n "$VERBOSE" ] || [ -n "$DEBUG" ]; then if [ -n "$VERBOSE" ] || [ -n "$DEBUG" ]; then
printf "RUNNING:" >&2 printf "RUNNING:" >&2
for _ in "$@"; do for _ in "$@"; do
[[ $_ =~ [[:space:]] ]] && printf " '%s'" "$_" || printf " %s" "$_" [[ $_ =~ [[:space:]] ]] && printf " '%s'" "$_" || printf " %s" "$_"
done >&2 done >&2
printf "\n" >&2 printf "\n" >&2
"$@" 2>&1 | tee -a "$BUILD_LOG" "$@" 2>&1 | tee -a "$BUILD_LOG"
else else
"$@" >>"$BUILD_LOG" 2>&1 "$@" >>"$BUILD_LOG" 2>&1
fi fi
return $? return $?
} }
debug() { debug() {
if [ -n "$DEBUG" ]; then if [ -n "$DEBUG" ]; then
echo "DEBUG: $*" >&2 echo "DEBUG: $*" >&2
fi fi
} }
clean() { clean() {
debug "Cleaning" debug "Cleaning"
run_and_log $SUDO lb clean --purge run_and_log $SUDO lb clean --purge
#run_and_log $SUDO umount -l $(pwd)/chroot/proc #run_and_log $SUDO umount -l $(pwd)/chroot/proc
#run_and_log $SUDO umount -l $(pwd)/chroot/dev/pts #run_and_log $SUDO umount -l $(pwd)/chroot/dev/pts
#run_and_log $SUDO umount -l $(pwd)/chroot/sys #run_and_log $SUDO umount -l $(pwd)/chroot/sys
#run_and_log $SUDO rm -rf $(pwd)/chroot #run_and_log $SUDO rm -rf $(pwd)/chroot
#run_and_log $SUDO rm -rf $(pwd)/binary #run_and_log $SUDO rm -rf $(pwd)/binary
} }
print_help() { print_help() {
echo "Usage: $0 [<option>...]" echo "Usage: $0 [<option>...]"
echo echo
for x in $(echo "${BUILD_OPTS_LONG}" | sed 's_,_ _g'); do for x in $(echo "${BUILD_OPTS_LONG}" | sed 's_,_ _g'); do
x=$(echo $x | sed 's/:$/ <arg>/') x=$(echo $x | sed 's/:$/ <arg>/')
echo " --${x}" echo " --${x}"
done done
echo echo
echo "More information: https://www.kali.org/docs/development/live-build-a-custom-kali-iso/" echo "More information: https://www.kali.org/docs/development/live-build-a-custom-kali-iso/"
exit 0 exit 0
} }
require_package() { require_package() {
local pkg=$1 local pkg=$1
local required_version=$2 local required_version=$2
local pkg_version= local pkg_version=
pkg_version=$(dpkg-query -f '${Version}' -W $pkg || true) pkg_version=$(dpkg-query -f '${Version}' -W $pkg || true)
if [ -z "$pkg_version" ]; then if [ -z "$pkg_version" ]; then
echo "ERROR: You need $pkg, but it is not installed" >&2 echo "ERROR: You need $pkg, but it is not installed" >&2
exit 1 exit 1
fi fi
if dpkg --compare-versions "$pkg_version" lt "$required_version"; then if dpkg --compare-versions "$pkg_version" lt "$required_version"; then
echo "ERROR: You need $pkg (>= $required_version), you have $pkg_version" >&2 echo "ERROR: You need $pkg (>= $required_version), you have $pkg_version" >&2
exit 1 exit 1
fi fi
debug "$pkg version: $pkg_version" debug "$pkg version: $pkg_version"
} }
# Allowed command line options # Allowed command line options
@ -136,56 +136,56 @@ debug "BUILD_LOG: $BUILD_LOG"
temp=$(getopt -o "$BUILD_OPTS_SHORT" -l "$BUILD_OPTS_LONG,get-image-path" -- "$@") temp=$(getopt -o "$BUILD_OPTS_SHORT" -l "$BUILD_OPTS_LONG,get-image-path" -- "$@")
eval set -- "$temp" eval set -- "$temp"
while true; do while true; do
case "$1" in case "$1" in
-d|--distribution) KALI_DIST="$2"; shift 2; ;; -d|--distribution) KALI_DIST="$2"; shift 2; ;;
-p|--proposed-updates) OPT_pu="1"; shift 1; ;; -p|--proposed-updates) OPT_pu="1"; shift 1; ;;
-a|--arch) KALI_ARCH="$2"; shift 2; ;; -a|--arch) KALI_ARCH="$2"; shift 2; ;;
-v|--verbose) VERBOSE="1"; shift 1; ;; -v|--verbose) VERBOSE="1"; shift 1; ;;
-D|--debug) DEBUG="1"; shift 1; ;; -D|--debug) DEBUG="1"; shift 1; ;;
-h|--help) print_help; ;; -h|--help) print_help; ;;
--variant) KALI_VARIANT="$2"; shift 2; ;; --variant) KALI_VARIANT="$2"; shift 2; ;;
--version) KALI_VERSION="$2"; shift 2; ;; --version) KALI_VERSION="$2"; shift 2; ;;
--subdir) TARGET_SUBDIR="$2"; shift 2; ;; --subdir) TARGET_SUBDIR="$2"; shift 2; ;;
--get-image-path) ACTION="get-image-path"; shift 1; ;; --get-image-path) ACTION="get-image-path"; shift 1; ;;
--clean) ACTION="clean"; shift 1; ;; --clean) ACTION="clean"; shift 1; ;;
--no-clean) NO_CLEAN="1"; shift 1 ;; --no-clean) NO_CLEAN="1"; shift 1 ;;
--) shift; break; ;; --) shift; break; ;;
*) echo "ERROR: Invalid command-line option: $1" >&2; exit 1; ;; *) echo "ERROR: Invalid command-line option: $1" >&2; exit 1; ;;
esac esac
done done
# Set default values # Set default values
KALI_ARCH=${KALI_ARCH:-$HOST_ARCH} KALI_ARCH=${KALI_ARCH:-$HOST_ARCH}
if [ "$KALI_ARCH" = "x64" ]; then if [ "$KALI_ARCH" = "x64" ]; then
KALI_ARCH="amd64" KALI_ARCH="amd64"
elif [ "$KALI_ARCH" = "x86" ]; then elif [ "$KALI_ARCH" = "x86" ]; then
KALI_ARCH="i386" KALI_ARCH="i386"
fi fi
debug "KALI_ARCH: $KALI_ARCH" debug "KALI_ARCH: $KALI_ARCH"
if [ -z "$KALI_VERSION" ]; then if [ -z "$KALI_VERSION" ]; then
KALI_VERSION="$(default_version $KALI_DIST)" KALI_VERSION="$(default_version $KALI_DIST)"
fi fi
debug "KALI_VERSION: $KALI_VERSION" debug "KALI_VERSION: $KALI_VERSION"
# Check parameters # Check parameters
debug "HOST_ARCH: $HOST_ARCH" debug "HOST_ARCH: $HOST_ARCH"
if [ "$HOST_ARCH" != "$KALI_ARCH" ]; then if [ "$HOST_ARCH" != "$KALI_ARCH" ]; then
case "$HOST_ARCH/$KALI_ARCH" in case "$HOST_ARCH/$KALI_ARCH" in
amd64/i386|i386/amd64) amd64/i386|i386/amd64)
;; ;;
*) *)
echo "Can't build $KALI_ARCH image on $HOST_ARCH system." >&2 echo "Can't build $KALI_ARCH image on $HOST_ARCH system." >&2
exit 1 exit 1
;; ;;
esac esac
fi fi
# Build parameters for lb config # Build parameters for lb config
KALI_CONFIG_OPTS="--distribution $KALI_DIST -- --variant $KALI_VARIANT" KALI_CONFIG_OPTS="--distribution $KALI_DIST -- --variant $KALI_VARIANT"
if [ -n "$OPT_pu" ]; then if [ -n "$OPT_pu" ]; then
KALI_CONFIG_OPTS="$KALI_CONFIG_OPTS --proposed-updates" KALI_CONFIG_OPTS="$KALI_CONFIG_OPTS --proposed-updates"
KALI_DIST="$KALI_DIST+pu" KALI_DIST="$KALI_DIST+pu"
fi fi
debug "KALI_CONFIG_OPTS: $KALI_CONFIG_OPTS" debug "KALI_CONFIG_OPTS: $KALI_CONFIG_OPTS"
debug "KALI_DIST: $KALI_DIST" debug "KALI_DIST: $KALI_DIST"
@ -195,27 +195,27 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
debug "PATH: $PATH" debug "PATH: $PATH"
if grep -q -e "^ID=debian" -e "^ID_LIKE=debian" /usr/lib/os-release; then if grep -q -e "^ID=debian" -e "^ID_LIKE=debian" /usr/lib/os-release; then
debug "OS: $( . /usr/lib/os-release && echo $NAME $VERSION )" debug "OS: $( . /usr/lib/os-release && echo $NAME $VERSION )"
elif [ -e /etc/debian_version ]; then elif [ -e /etc/debian_version ]; then
debug "OS: $( cat /etc/debian_version )" debug "OS: $( cat /etc/debian_version )"
else else
echo "ERROR: Non Debian-based OS" >&2 echo "ERROR: Non Debian-based OS" >&2
fi fi
if [ ! -d "$(dirname $0)/kali-config/variant-$KALI_VARIANT" ]; then if [ ! -d "$(dirname $0)/kali-config/variant-$KALI_VARIANT" ]; then
echo "ERROR: Unknown variant of Kali live configuration: $KALI_VARIANT" >&2 echo "ERROR: Unknown variant of Kali live configuration: $KALI_VARIANT" >&2
fi fi
require_package live-build "1:20230502+kali4" require_package live-build "1:20230502+kali4"
require_package debootstrap "1.0.97" require_package debootstrap "1.0.97"
# We need root rights at some point # We need root rights at some point
if [ "$(whoami)" != "root" ]; then if [ "$(whoami)" != "root" ]; then
if ! which $SUDO >/dev/null; then if ! which $SUDO >/dev/null; then
echo "ERROR: $0 is not run as root and $SUDO is not available" >&2 echo "ERROR: $0 is not run as root and $SUDO is not available" >&2
exit 1 exit 1
fi fi
else else
SUDO="" # We're already root SUDO="" # We're already root
fi fi
debug "SUDO: $SUDO" debug "SUDO: $SUDO"
@ -224,15 +224,15 @@ debug "IMAGE_NAME: $IMAGE_NAME"
debug "ACTION: $ACTION" debug "ACTION: $ACTION"
if [ "$ACTION" = "get-image-path" ]; then if [ "$ACTION" = "get-image-path" ]; then
echo $(target_image_name $KALI_ARCH) echo $(target_image_name $KALI_ARCH)
exit 0 exit 0
fi fi
if [ "$NO_CLEAN" = "" ]; then if [ "$NO_CLEAN" = "" ]; then
clean clean
fi fi
if [ "$ACTION" = "clean" ]; then if [ "$ACTION" = "clean" ]; then
exit 0 exit 0
fi fi
cd $(dirname $0) cd $(dirname $0)
@ -248,7 +248,7 @@ run_and_log lb config -a $KALI_ARCH $KALI_CONFIG_OPTS "$@"
debug "Stage 2/2 - Build" debug "Stage 2/2 - Build"
run_and_log $SUDO lb build run_and_log $SUDO lb build
if [ $? -ne 0 ] || [ ! -e $IMAGE_NAME ]; then if [ $? -ne 0 ] || [ ! -e $IMAGE_NAME ]; then
failure failure
fi fi
# If a command fails, make the whole script exit # If a command fails, make the whole script exit

@ -5,16 +5,16 @@ source /boot/grub/config.cfg
LINUX_LIVE LINUX_LIVE
menuentry "Live system (@FLAVOUR_LIVE@ forensic mode)" { menuentry "Live system (@FLAVOUR_LIVE@ forensic mode)" {
linux @KERNEL_LIVE@ @APPEND_LIVE@ noswap noautomount linux @KERNEL_LIVE@ @APPEND_LIVE@ noswap noautomount
initrd @INITRD_LIVE@ initrd @INITRD_LIVE@
} }
menuentry "Live system with USB persistence (check kali.org/prst)" { menuentry "Live system with USB persistence (check kali.org/prst)" {
linux @KERNEL_LIVE@ @APPEND_LIVE@ persistence linux @KERNEL_LIVE@ @APPEND_LIVE@ persistence
initrd @INITRD_LIVE@ initrd @INITRD_LIVE@
} }
menuentry "Live system with USB Encrypted persistence" { menuentry "Live system with USB Encrypted persistence" {
linux @KERNEL_LIVE@ @APPEND_LIVE@ persistent=cryptsetup persistence-encryption=luks persistence linux @KERNEL_LIVE@ @APPEND_LIVE@ persistent=cryptsetup persistence-encryption=luks persistence
initrd @INITRD_LIVE@ initrd @INITRD_LIVE@
} }
# Installer (if any) # Installer (if any)
@ -22,8 +22,8 @@ LINUX_INSTALL
if [ ! -e /boot/grub/install.cfg ]; then if [ ! -e /boot/grub/install.cfg ]; then
menuentry "Start installer with speech synthesis" { menuentry "Start installer with speech synthesis" {
linux @KERNEL_GI@ speakup.synth=soft @APPEND_GI@ linux @KERNEL_GI@ speakup.synth=soft @APPEND_GI@
initrd @INITRD_GI@ initrd @INITRD_GI@
} }
fi fi

@ -24,7 +24,7 @@ label live-persistence
append boot=live username=kali hostname=kali persistence append boot=live username=kali hostname=kali persistence
label live-encrypted-persistence label live-encrypted-persistence
menu label Live system with USB ^Encrypted persistence menu label Live system with USB ^Encrypted persistence
linux @LINUX@ linux @LINUX@
initrd @INITRD@ initrd @INITRD@
append boot=live persistent=cryptsetup persistence-encryption=luks username=kali hostname=kali persistence append boot=live persistent=cryptsetup persistence-encryption=luks username=kali hostname=kali persistence

@ -10,9 +10,9 @@ fi
# This is until https://bugs.debian.org/908220 has a proper fix. # This is until https://bugs.debian.org/908220 has a proper fix.
if [ -e /etc/cryptsetup-initramfs/conf-hook ]; then if [ -e /etc/cryptsetup-initramfs/conf-hook ]; then
if grep -q '^#CRYPTSETUP=' /etc/cryptsetup-initramfs/conf-hook; then if grep -q '^#CRYPTSETUP=' /etc/cryptsetup-initramfs/conf-hook; then
sed -i -e 's/^#CRYPTSETUP=.*/CRYPTSETUP=y/' /etc/cryptsetup-initramfs/conf-hook sed -i -e 's/^#CRYPTSETUP=.*/CRYPTSETUP=y/' /etc/cryptsetup-initramfs/conf-hook
else else
echo "CRYPTSETUP=y" >>/etc/cryptsetup-initramfs/conf-hook echo "CRYPTSETUP=y" >>/etc/cryptsetup-initramfs/conf-hook
fi fi
fi fi

@ -1,4 +1,4 @@
menu background splash.png menu background splash.png
menu color title * #FFFFFFFF * menu color title * #FFFFFFFF *
menu color border * #00000000 #00000000 none menu color border * #00000000 #00000000 none
menu color sel * #ffffffff #26ffffff none menu color sel * #ffffffff #26ffffff none

@ -3,11 +3,11 @@
configure_zsh() { configure_zsh() {
# Stop if zsh is not present # Stop if zsh is not present
if [ ! -x /usr/bin/zsh ]; then if [ ! -x /usr/bin/zsh ]; then
return return
fi fi
# Stop if user has opted out of zsh # Stop if user has opted out of zsh
if echo "${LIVE_CONFIG_CMDLINE}" | grep -qs 'nozsh'; then if echo "${LIVE_CONFIG_CMDLINE}" | grep -qs 'nozsh'; then
return return
fi fi
chsh --shell /usr/bin/zsh kali chsh --shell /usr/bin/zsh kali
chsh --shell /usr/bin/zsh root chsh --shell /usr/bin/zsh root
@ -26,8 +26,8 @@ configure_usergroups() {
kali_groups="adm dialout kaboxer vboxsf wireshark" kali_groups="adm dialout kaboxer vboxsf wireshark"
for grp in $kali_groups; do for grp in $kali_groups; do
getent group $grp >/dev/null || continue getent group $grp >/dev/null || continue
usermod -a -G $grp kali usermod -a -G $grp kali
done done
} }
@ -37,9 +37,9 @@ pkg_installed() {
configure_terminal() { configure_terminal() {
while read -r desktop terminal; do while read -r desktop terminal; do
pkg_installed kali-desktop-$desktop || continue pkg_installed kali-desktop-$desktop || continue
update-alternatives --verbose --set x-terminal-emulator /usr/bin/$terminal || true update-alternatives --verbose --set x-terminal-emulator /usr/bin/$terminal || true
break break
done <<END done <<END
e17 terminology e17 terminology
gnome gnome-terminal.wrapper gnome gnome-terminal.wrapper

@ -9,8 +9,8 @@
configure_sources_list() { configure_sources_list() {
if grep -q '^deb ' /etc/apt/sources.list; then if grep -q '^deb ' /etc/apt/sources.list; then
echo "INFO: sources.list is configured, everything is fine" echo "INFO: sources.list is configured, everything is fine"
return return
fi fi
echo "INFO: sources.list is empty, setting up a default one for Kali" echo "INFO: sources.list is empty, setting up a default one for Kali"
@ -27,27 +27,27 @@ END
get_user_list() { get_user_list() {
for user in $(cd /home && ls); do for user in $(cd /home && ls); do
if ! getent passwd "$user" >/dev/null; then if ! getent passwd "$user" >/dev/null; then
echo "WARNING: user '$user' is invalid but /home/$user exists" >&2 echo "WARNING: user '$user' is invalid but /home/$user exists" >&2
continue continue
fi fi
echo "$user" echo "$user"
done done
echo "root" echo "root"
} }
configure_zsh() { configure_zsh() {
if grep -q 'nozsh' /proc/cmdline; then if grep -q 'nozsh' /proc/cmdline; then
echo "INFO: user opted out of zsh by default" echo "INFO: user opted out of zsh by default"
return return
fi fi
if [ ! -x /usr/bin/zsh ]; then if [ ! -x /usr/bin/zsh ]; then
echo "INFO: /usr/bin/zsh is not available" echo "INFO: /usr/bin/zsh is not available"
return return
fi fi
for user in $(get_user_list); do for user in $(get_user_list); do
echo "INFO: changing default shell of user '$user' to zsh" echo "INFO: changing default shell of user '$user' to zsh"
chsh --shell /usr/bin/zsh $user chsh --shell /usr/bin/zsh $user
done done
} }
@ -64,11 +64,11 @@ configure_usergroups() {
kali_groups="adm dialout kaboxer vboxsf wireshark" kali_groups="adm dialout kaboxer vboxsf wireshark"
for user in $(get_user_list | grep -xv root); do for user in $(get_user_list | grep -xv root); do
echo "INFO: adding user '$user' to groups '$kali_groups'" echo "INFO: adding user '$user' to groups '$kali_groups'"
for grp in $kali_groups; do for grp in $kali_groups; do
getent group $grp >/dev/null || continue getent group $grp >/dev/null || continue
usermod -a -G $grp $user usermod -a -G $grp $user
done done
done done
} }
@ -78,10 +78,10 @@ pkg_installed() {
configure_terminal() { configure_terminal() {
while read -r desktop terminal; do while read -r desktop terminal; do
pkg_installed kali-desktop-$desktop || continue pkg_installed kali-desktop-$desktop || continue
echo "INFO: setting x-terminal-emulator alternative to '$terminal'" echo "INFO: setting x-terminal-emulator alternative to '$terminal'"
update-alternatives --verbose --set x-terminal-emulator /usr/bin/$terminal || true update-alternatives --verbose --set x-terminal-emulator /usr/bin/$terminal || true
break break
done <<END done <<END
e17 terminology e17 terminology
gnome gnome-terminal.wrapper gnome gnome-terminal.wrapper

Loading…
Cancel
Save