summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmltk147
-rwxr-xr-xremote/setup_tools3
-rwxr-xr-xserver/build_core4
3 files changed, 96 insertions, 58 deletions
diff --git a/mltk b/mltk
index bb9789fd..01a0edd8 100755
--- a/mltk
+++ b/mltk
@@ -20,74 +20,107 @@ 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 // 2011 **"
- echo -e "\t http://lab.openslx.org/"
- echo -e ""
+ 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 [OPTION]"
- echo " MODULE:"
+ 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 " OPTION:"
- echo -e " build \t builds [MODULE]"
- echo -e " clean \t clean build files for [MODULE]"
+ 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 option:"
- echo -e " tools \t build [TOOL]"
- echo -e " TOOL can be: \t base, busybox, dbus, udev, systemd, plymouth"
+ echo -e " Module specific options:"
+ echo -e " tools [OPTION] [TOOL]"
+ echo -e " TOOL can be: \t $(echo $(ls ${ROOT_DIR}/remote/tools))"
}
-banner
-
-if [ "x$1" = "x" ]; then
- print_usage
- exit 0
-elif [ "x$(whoami)" != "xroot" ]; then
- echo "ERROR: You need to have root rights to install packages."
- exit 1
-fi
+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
-# read 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
+}
-if [ "x$1" = "xcore" ]; then
- [ -e ${BUILD_CORE} ] && . ${BUILD_CORE}
+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
- if [ "x$1" = "xbuild" ]; then
- generate_stage31
- elif [ "x$1" = "xclean" ]; then
- clean_core
- else
- print_usage
- exit 1
+
+ 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
-elif [ "x$1" = "xtools" ]; then
- [ -e ${SETUP_TOOLS} ] && . $SETUP_TOOLS
- shift
- if [ "x$1" = "xbuild" ]; then
- # shift away first 2 parameters
- shift
- echo "[tools] Building $@"
- generate_stage32 $@
- elif [ "x$1" = "xclean" ]; then
- shift
- echo "[tools] Cleaning $@"
- clean_tools $@
- else
- print_usage
- exit 1
+ if [ $TARGET_CORE ]; then
+ . ${BUILD_CORE}
+ [ $CLEAN ] && clean_core
+ [ $BUILD ] && generate_stage31
fi
-else
- echo "Module $1 not known."
- print_usage
- exit 1
-fi
+}
+
+initial_checks
+read_params $@
+run
diff --git a/remote/setup_tools b/remote/setup_tools
index eeb13150..e12ea00d 100755
--- a/remote/setup_tools
+++ b/remote/setup_tools
@@ -215,12 +215,13 @@ clean_tools() {
clean_tool() {
TOOLDIR=${TOOL_DIR}/$1
- echo "Cleaning ${TOOLDIR}"
+ echo -n "Cleaning ${TOOLDIR}..."
[ -e ${TOOLDIR}/.built ] && rm ${TOOLDIR}/.built
[ -e ${TOOLDIR}/.fetched_source ] && rm ${TOOLDIR}/.fetched_source
[ -d ${TOOLDIR}/build ] && rm -rf ${TOOLDIR}/build
[ -d ${TOOLDIR}/src ] && rm -rf ${TOOLDIR}/src
[ -e ${TOOLDIR}/list_binaries_and_files ] && rm ${TOOLDIR}/list_binaries_and_files
+ echo " done."
}
#generate_stage32 $@
diff --git a/server/build_core b/server/build_core
index 4e615520..bd863e4f 100755
--- a/server/build_core
+++ b/server/build_core
@@ -96,6 +96,10 @@ generate_stage31() {
}
clean_core() {
+ echo -n "Cleaning ${STAGE31_DIR}..."
[ -d ${STAGE31_DIR} ] && rm -rf ${STAGE31_DIR}
+ echo " done."
+ echo -n "Cleaning ${MODULE_DIR}/initramfs..."
[ -e ${MODULE_DIR}/initramfs ] && rm ${MODULE_DIR}/initramfs
+ echo " done."
}