4 if [[ $UID != 0 ]]; then
5 echo "You have to run this as root." 1>&2
9 if ! type docker >/dev/null 2>&1; then
10 echo "You have to install docker." 1>&2
15 echo "usage ${0} [options]"
17 echo " General options:"
18 echo " -o | --build-opiton \"[options]\" send the build option to ./lfbs"
19 echo " -c | --clean Enable --no-cache option when build docker image"
20 echo " -h | --help This help message and exit"
26 while (( $# > 0 )); do
33 NO_CACHE="--no-cache" # Enable --no-cache option
45 msg_error "Invalid argument '${1}'"
54 SCRIPT_DIR=$(cd $(dirname $0); pwd)
56 docker build ${NO_CACHE} -t lfbs-build:latest .
57 docker run -t -i --privileged -v ${SCRIPT_DIR}/out:/lfbs/out -v /usr/lib/modules:/usr/lib/modules:ro -v ${SCRIPT_DIR}/cache:/lfbs/cache lfbs-build "${BUILD_OPT}"