summaryrefslogblamecommitdiffstats
path: root/mltk
blob: 3af41ce5809b9e4bb9eab2b127b7e133a35682cb (plain) (tree)




















                                                                               













                                                                                                       
 











































                                                                       
# -----------------------------------------------------------------------------
# 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
#				
# -----------------------------------------------------------------------------
#!/bin/bash


SELF=$(readlink -f $0)
ROOT_DIR=$(dirname ${SELF})

print_usage() {
	echo "Toolkit for creating preboot mini-linux for OpenSLX NG (mltk)"
	echo "Usage: $(basename ${SELF}) MODULE [OPTION]"
	echo -e "  MODULE:"
	echo -e "  \t core \t minimal initramfs (stage 3.1) to mount the system-container (stage 3.2)."
	echo -e "  \t sys \t minimal systemd-based rootfs including basic tools."
	echo -e "  OPTION:"
	echo -e "  \t build \t builds [MODULE]"
	echo -e "  \t clean \t clean build files for [MODULE]"
	echo -e ""
	echo -e "  Module specific option:"
	echo -e "  \t sys \t build [TOOL]"
	echo -e "  \t \t TOOL can be: \t base, busybox, dbus, udev, systemd, plymouth"
}

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" = "xsys" ]; then
	[ -e ${SETUP_TOOLS} ] && . ${SETUP_TOOLS}
	shift
	if [ "x$1" = "xbuild" ]; then
		# shift away first 2 parameters
		shift
		echo "[sys] Building $@"
		generate_stage32 $@
	elif [ "x$1" = "xclean" ]; then
		shift
		echo "[sys] Cleaning $@"
		clean_sys $@
	else
		print_usage
		exit 1
	fi
else
	echo "Module $1 not known."
	print_usage
	exit 1
fi