#!/bin/bash . config/binary . config/bootstrap . config/common . config/kanotix bit=32 LABEL=Kanotix [ "$LB_ARCHITECTURE" = "amd64" ] && bit=64 && LABEL=${LABEL}64 export LB_BOOTLOADER LB_BINARY_IMAGES # Update kanotix-version (32/64-bit and timestamp) KANOTIX_CODENAMES="lenny=Excalibur squeeze=Hellfire wheezy=Dragonfire jessie=Spitfire stretch=Steelfire buster=Silverfire" KANOTIX_CODENAME="$(echo $KANOTIX_CODENAMES | fmt -w1 | grep "^${LB_DISTRIBUTION}=" | cut -d= -f2)" [ -z "$KANOTIX_CODENAME" ] && KANOTIX_CODENAME="$(echo $LB_DISTRIBUTION|sed -e 's/\b\(.\)/\u\1/g')" mkdir -p config/chroot_local-includes/etc [ ! -f config/chroot_local-includes/etc/kanotix-version ] && echo Kanotix $KANOTIX_CODENAME 0000-00:00 > config/chroot_local-includes/etc/kanotix-version [ "$KANOTIX_CODENAME" ] && perl -pi -e "s%($(echo $(echo $KANOTIX_CODENAMES | fmt -w1 | cut -d= -f2) | tr ' ' '|'))%$KANOTIX_CODENAME%i; s%(Kanotix|$KANOTIX_CODENAME)(32|64)%\${1}$bit%i" config/chroot_local-includes/etc/kanotix-version perl -pi -e "s%(32|64)(bit)%$bit\${2}%i; s|[0-9]+-[0-9]+:[0-9]+|$(date +%Y%m%d-%H:%M)|" config/chroot_local-includes/etc/kanotix-version prebuild() { for bootstrap_dir in cache/stages_bootstrap cache/bootstrap do if [ -d ${bootstrap_dir} ]; then bsbit=$(file ${bootstrap_dir}/bin/true | grep -q "ELF 64-bit" && echo 64 || echo 32) mv ${bootstrap_dir} ${bootstrap_dir}$bsbit fi [ -d ${bootstrap_dir}$bit ] && mv ${bootstrap_dir}$bit ${bootstrap_dir} done rm -f kanotix$bit.iso echo "LB_SYSLINUX_MENU_LIVE_ENTRY=\"$LABEL\"" >> config/binary } postbuild() { for bootstrap_dir in cache/stages_bootstrap cache/bootstrap do [ -d ${bootstrap_dir} ] && mv ${bootstrap_dir} ${bootstrap_dir}$bit done [ -f binary-hybrid.iso ] && mv -f binary-hybrid.iso kanotix$bit.iso [ -f binary.hybrid.iso ] && mv -f binary.hybrid.iso kanotix$bit.iso } if [ "$LB_KANOTIX_TMPFS" = "true" ]; then mkdir -p tmpfs # build using tmpfs [ -z "$(stat --printf "%d\n" . tmpfs | uniq -u)" ] && mount -t tmpfs -o "$LB_KANOTIX_TMPFS_OPTIONS" tmpfs tmpfs cd tmpfs # delete everything except cache and *.iso find . -maxdepth 1 ! -name cache ! -name '*.iso' -exec rm -r '{}' \; 2>/dev/null # copy everything to tmpfs rsync -a .. . --exclude=tmpfs --exclude '*.iso' # build prebuild time lb build noauto "${@}" 2>&1 | tee binary.log postbuild cd .. else prebuild time lb build noauto "${@}" 2>&1 | tee binary.log postbuild fi exit 1