#!/bin/bash # Kanotix Build System by acritox ABS_VER="2010-03-01d" [ -z "$build_addons_mirror" ] && export build_addons_mirror="http://acritox.de/kanotix/build/" if [ ! -e "addons" ]; then echo "You have to run the build system from the root-directory of the build!" >&2 echo "(this is the directory containing your buildscript, addons, config, ...)" >&2 exit 1 fi add_packages() { lh_config --packages "$( ( cat config/chroot; echo "echo $@; echo \$LH_PACKAGES"; ) | sh | tr ' ' '\n' | sort -u | tr '\n' ' ')" } include_build_addons() { for addon in $@ do echo "including addon $addon ..." if [ $(expr index "$addon" "://") -eq 0 ]; then wget -Ncq -P addons/ "$build_addons_mirror/$addon"; else wget -Ncq -P addons/ "$addon"; addon="$(basename "$addon")" fi if [ ! -e "addons/$addon" ]; then echo "failed to fetch $addon!" >&2; return 1; fi case "${addon##*.}" in patch) patch --dry-run -Nsp0 -d config/ < "addons/$addon" && patch -p0 -d config/ < "addons/$addon" ;; append) read p file < "addons/$addon" [ "$p" = "#APPEND_TO#" ] && tail -n+2 "addons/$addon" >> "config/$file" ;; conf) read p file < "addons/$addon" [ "$p" = "#WRITE_TO#" ] && tail -n+2 "addons/$addon" > "config/$file" ;; sh) . "addons/$addon" ;; src) srcfile="$(basename "$addon" .src)" read p keyfile < "addons/$addon" if [ "$p" = "key" ]; then tail -n+2 "addons/$addon" | \ tee "config/chroot_sources/$srcfile.binary" > "config/chroot_sources/$srcfile.chroot" wget -qO- "$keyfile" | \ tee "config/chroot_sources/$srcfile.binary.gpg" > "config/chroot_sources/$srcfile.chroot.gpg" elif [ "$p" = "gpgkey" ]; then tail -n+2 "addons/$addon" | \ tee "config/chroot_sources/$srcfile.binary" > "config/chroot_sources/$srcfile.chroot" gpg --keyserver wwwkeys.de.pgp.net --recv-keys $keyfile gpg --armor --export $keyfile | \ tee "config/chroot_sources/$srcfile.binary.gpg" > "config/chroot_sources/$srcfile.chroot.gpg" else cat "addons/$addon" | \ tee "config/chroot_sources/$srcfile.binary" > "config/chroot_sources/$srcfile.chroot" fi ;; packages) packages="$( ( cat config/chroot; echo "echo \$LH_PACKAGES" ) | sh | tr ' ' '\n')" for package in $(grep ^- "addons/$addon"|sed 's/^-//') do packages="$(echo "$packages" | grep -ve "^$package$")" done for package in $(grep ^+ "addons/$addon"|sed 's/^+//') do packages="$(echo "$packages"; eval "echo \"$package\"")" done lh_config --packages "$(echo "$packages" | sort -u | tr '\n' ' ')" ;; *) tar -xvzC config/ < "addons/$addon" ;; esac done } case "$1" in version|--version) echo "Acritox Build System - Version $ABS_VER" exit 0;; update|--update) echo "Updating Acritox Build System..." rm -f addons/acritox_build_system wget -Ncq -P addons/ "$build_addons_mirror/acritox_build_system" echo "Old Version: $ABS_VER - updated to:" "$0" version exit 0;; clean|--clean) echo "Cleaning addons..." find addons/ -type f ! -name acritox_build_system -exec rm '{}' \; exit 0;; help|--help) cat < --version Show version --update Update Acritox Build System fetches latest version of addons/acritox_build_system from build-system mirror --clean Clean "addons/" removes all files (exept the build system) from the addons-directory EOF exit 0;; esac