#!/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 // 2011 **" 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 -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 "" echo -e " Module specific option:" echo -e " tools \t build [TOOL]" echo -e " TOOL can be: \t base, busybox, dbus, udev, systemd, plymouth" } 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 # read setup-tools and build_core BUILD_CORE=${ROOT_DIR}/server/build_core SETUP_TOOLS=${ROOT_DIR}/remote/setup_tools if [ "x$1" = "xcore" ]; then [ -e ${BUILD_CORE} ] && . ${BUILD_CORE} shift if [ "x$1" = "xbuild" ]; then generate_stage31 elif [ "x$1" = "xclean" ]; then clean_core else print_usage exit 1 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 fi else echo "Module $1 not known." print_usage exit 1 fi