#!/bin/sh
### Author Hans-J. Ullrich <hans.ullrich@loop.de>
### License: GPL

### Set some variables, not active yet.
### architecture: i386, amd64, arm
ARCH=amd64
### Distribution, you might not want to change it.
DISTRO=kali-rolling
### Your preferred window-manager: lxde, kde, xfce, gnome
VARIANT=xfce
### Environmet for your local proxy
# PROXY=http://localhost:3142/
### language, keyboard, locales everything you might not need to change
BOOTAPP="boot=live hostname=uit-kali ignore_uuid locales=de_DE.UTF-8 keyboard-layouts=de keyboard-variants=nodeadkeys"

### Clean your system, not really necessarey, as the latter "./build.sh" does 
### this either.
# lb clean

### VERY IMPORTANT: Make sure, apt-cacher-ng is started, even, if you are sure, 
### it is already running!
# /etc/init.d/apt-cacher-ng stop && sleep 3 && /etc/init.d/apt-cacher-ng start

### set your needed environment and preparations.
# export http_proxy=http://localhost:3142/
lb config 

### This command starts the actual build. All commands are in one line. 
### However, this script might be improved, to use variables for better 
### configuration possibilities.
# ./build.sh --arch $ARCH --distribution $DISTRO --variant $VARIANT --verbose -- --apt-http-proxy $PROXY --bootappend-live $BOOTAPP
./build.sh --arch $ARCH --distribution $DISTRO --variant $VARIANT --verbose -- --bootappend-live "$BOOTAPP"

### these options can be used for further commands after build
### for example, if you want to burn a dvd, shutdown, whatever
### Examples for my personal needs below
#/etc/init.d/apt-cacher-ng stop

### Suggestions for handling the built image.
# cp /home/username/live-build-config/images/*.iso /home/user/
# wodim /path_to_your_live_build/live-build-config/images/your_image_name.iso

### Some opportunities at unattended build run, what to do after the build succeeded.
# dd if=/mnt/kali-linux/amd64/live-build-config/images/kali-linux-rolling-live-lxde-amd64.iso of=/dev/sdf bs=8192 status=progress
# mv -f /mnt/kali-linux/amd64/live-build-config/images/*.iso /mnt/ISO-latest/
# halt -p
# reboot
# shutdown -h now
exit
