#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # # Copyright (C) 2008 Michael Tremer & Christian Schmidt # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ############################################################################### usage() { cat doc/make.sh-usage exit 1 } case "$1" in build) # check for prerequisites check_build # check for sanity of code check_sanity # compile the distro right now build # beeps when finished echo -ne '\a' ;; shell) # enter a shell inside LFS chroot # may be used to change kernel settings prepareenv entershell ;; batch) # build the distro in background case "$2" in start) batch_start $3 ;; _run) batch_run ;; attach|watch) batch_attach ;; *) usage ;; esac ;; ccache) # ccache options case "$2" in stats) ccache_stats ;; esac ;; distcc|distccd) # distcc(d) commands case "$2" in start) distccd_start ;; stop) distccd_stop ;; restart) distccd_restart ;; stats|mon) distcc_mon ;; esac ;; clean) for i in $(mount | grep $BASEDIR | cut -d " " -f 1); do umount $i done stdumount for i in ${TARGET-${POSSIBLE_TARGETS}}; do echo -ne "Cleaning ${BOLD}$i${NORMAL} buildtree" rm -rf $BASEDIR/build_$i rm -rf $BASEDIR/log_$i rm -rf $BASEDIR/packages_$i beautify message DONE done echo -ne "Removing ${BOLD}general files${NORMAL}" rm -f $FAILED $RUNNING 2>/dev/null beautify message DONE ;; source|src) LOGFILE=$BASEDIR/log_${MACHINE}/_build.00-preparation.log case "$2" in get|pull|download) getsource ;; put|push|upload) putsource ;; esac ;; toolchain) case "$2" in get|pull|download) gettoolchain ;; put|push|upload) puttoolchain ;; "") prepareenv # Check if host can build the toolchain check_toolchain build_spy state compiling toolchain_build stdumount echo -ne "\ntarball creation " [ -d $BASEDIR/cache/toolchains ] || mkdir $BASEDIR/cache/toolchains cd $BASEDIR && tar cj --exclude='log_${MACHINE}/_build.*.log' \ --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \ build_${MACHINE} log_${MACHINE} >> $LOGFILE beautify message DONE echo `ls -sh cache/toolchains/$TOOLCHAINNAME.tar.bz2` stdumount build_spy state idle ;; *) usage ;; esac ;; target) case "$2" in put|push|upload) puttarget ;; *) usage ;; esac ;; check) case "$2" in cpu) [ -z "$3" ] && usage if check_cpu $3; then echo -n "CPU has flag $3" beautify message DONE else dialogerror "CPU hasn't got flag $3" exit 1 fi ;; rootfiles) check_rootfiles $3 ;; sanity) check_sanity $3 ;; target*) check_supported_targets ;; *) usage ;; esac ;; g[iu]t) COMMAND=$2 shift 2 case "$COMMAND" in update|pull) git_pull $* ;; commit|ci) git_commit $* ;; dist|export|archive) git_export $* ;; push) git_push $* ;; diff|di) git_diff $* ;; log) git_log $* ;; gc) git_gc ;; put-key) ssh_cert $* ;; *) # If no command matches run git directly git $* ;; esac ;; *) usage ;; esac