blob: 0e2447529973ee6a816bfeebf3832f7335d18b94 (
plain) (
tree)
|
|
#!/bin/bash
# -----------------------------------------------------------------------------
#
# Copyright (c) 2011 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your suggestions, praise, or complaints to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
#
# Mini-Linux Toolkit
#
# -----------------------------------------------------------------------------
SELF=$(readlink -f $0)
ROOT_DIR=$(dirname ${SELF})
banner () {
echo -e "\t __ __ __ "
echo -e "\t.--------.| | | |_| |--."
echo -e "\t| || |_| _| < "
echo -e "\t|__|__|__||____|____|__|__|"
echo -e "\t "
echo -e "\t ** OpenSLX Project // 2013 **"
echo -e "\t http://lab.openslx.org/"
echo -e ""
}
print_usage() {
echo "Toolkit for creating preboot mini-linux for OpenSLX NG (mltk)"
echo "Usage: $(basename ${SELF}) MODULE [OPTIONS]"
echo -e ""
echo -e " MODULE:"
echo -e " core \t minimal initramfs (stage 3.1) to mount the system-container (stage 3.2)."
echo -e " tools \t minimal systemd-based rootfs including basic tools."
echo -e " all \t all of the above."
echo -e ""
echo -e " OPTIONS:"
echo -e " build, -b \t builds [MODULE]"
echo -e " clean, -c \t clean build files for [MODULE]"
echo -e " debug, -d \t activates debug output."
echo -e ""
echo -e " Module specific options:"
echo -e " tools [OPTION] [TOOL]"
echo -e " TOOL can be: \t $(echo $(ls ${ROOT_DIR}/remote/tools))"
}
initial_checks() {
if [ "x$(whoami)" != "xroot" ]; then
echo "ERROR: You need to have root rights to install packages."
exit 1
else
banner
fi
# setup_tools and build_core
BUILD_CORE=${ROOT_DIR}/server/build_core
SETUP_TOOLS=${ROOT_DIR}/remote/setup_tools
[ ! -e ${BUILD_CORE} ] && echo "Missing script build_core, re-clone. Exiting." && exit 1
[ ! -e ${SETUP_TOOLS} ] && echo "Missing script setup_tools, re-clone. Exiting." && exit 1
}
read_params() {
MODULE=$1
case "$1" in
core)
TARGET_CORE=1
;;
tools)
TARGET_TOOLS=1
;;
all)
TARGET_CORE=1
TARGET_TOOLS=1
;;
*)
print_usage
exit 1
;;
esac
shift
while true ; do
case "$1" in
-c|clean)
CLEAN=1
shift
;;
-b|build)
BUILD=1
shift
;;
-d|debug)
DEBUG=1
shift
;;
*)
break
;;
esac
done
TOOLS="$@"
}
run() {
if [ $TARGET_TOOLS ]; then
. ${SETUP_TOOLS}
[ $CLEAN ] && clean_tools $TOOLS
[ $BUILD ] && generate_stage32 $TOOLS
fi
if [ $TARGET_CORE ]; then
. ${BUILD_CORE}
[ $CLEAN ] && clean_core
[ $BUILD ] && generate_stage31
fi
}
initial_checks
read_params $@
#exec 6>&1 > stdout.log
#exec 2> stderr.log
run
|