diff options
45 files changed, 847 insertions, 398 deletions
@@ -1,9 +1,7 @@ *~ *.swp -server/kernel -server/initramfs -server/initramfs2 -server/openslx +server/boot +server/remote_builds src build/ .built diff --git a/helper/binutil.inc b/helper/binutil.inc index b34230de..607041f0 100644 --- a/helper/binutil.inc +++ b/helper/binutil.inc @@ -23,20 +23,16 @@ get_dynamic_dependencies() { if [ "x$1" == "x-l" ]; then LOCALSEARCH=1 - pdebug "Local search activated." shift [ ! -d $1 ] && perror "Directory given does not exist, exiting." LOCALSEARCHDIR=$1 shift - pdebug "Looking in: $LOCALSEARCHDIR" fi while [ $# != 0 ]; do local BINARY=$1 shift - pdebug "Processing $BINARY ..." - local LDD_OUT="ldd_output" if ldd $BINARY > $LDD_OUT; then # Case 1: dynamic @@ -49,7 +45,7 @@ get_dynamic_dependencies() { done else # Case 2: not a dynamic - pdebug "$BINARY not a dynamic, skipping." + pdebug "\t\t\t(Not a dynamic.)" rm -f $LDD_OUT continue fi @@ -60,7 +56,6 @@ get_dynamic_dependencies() { lib_search(){ - pdebug "\tSearching for ${liblink[0]}..." # if activated, start by searching the lib locally if [ "x$LOCALSEARCH" == "x1" ]; then cd $LOCALSEARCHDIR @@ -68,7 +63,6 @@ lib_search(){ cd - &>/dev/null if [ "x${LOCAL_MATCHES}" != "x" ]; then for llib in ${LOCAL_MATCHES}; do - pdebug "\t\tFound locally, copying ${LOCALSEARCHDIR}/${llib}" get_link_chain "${LOCALSEARCHDIR}"/"${llib}" "${LOCALSEARCHDIR}" get_dynamic_dependencies -l "${LOCALSEARCHDIR}" "${llib}" CURRENT_BLACKLIST+="\|${liblink[0]}" @@ -81,7 +75,6 @@ lib_search(){ # search the lib on the system since it was not found earlier if [ ! -z ${liblink[1]} ] && [ "x${liblink[1]}" != "xnot" ]; then - pdebug "\t\tNot found locally but in system, copying ${liblink[1]}" # get chain of symlink for that lib get_link_chain ${liblink[1]} CURRENT_BLACKLIST+="\|${liblink[1]}" @@ -161,7 +154,7 @@ get_link_chain() { echo "$LINK" fi done - pdebug "\t\tCHAIN: $CHAIN" + pdebug "\t\t$CHAIN" } # Function to get libc and ld-linux diff --git a/helper/downloader.inc b/helper/downloader.inc index 7ded5b4f..e12c8a02 100644 --- a/helper/downloader.inc +++ b/helper/downloader.inc @@ -6,7 +6,9 @@ # 2. download "http://example.com/something.tar.gz" "somename.tar.gz" download () { [ $# -lt 1 -o $# -gt 2 ] && perror "download called with $# arguments, need 1 or 2" + [ -z "$1" ] && perror "download: URL empty." if [ $# -eq 2 ]; then + [ -z "$2" ] && perror "download: target file name given but empty" pinfo "Downloading $2 from '$1'...." wget -O "$2" "$1" local RET=$? @@ -24,13 +26,14 @@ download () { # 2. download_untar "http://example.com/something.tar.gz" "src/" "temporary_name.tar.gz" download_untar () { [ $# -lt 2 -o $# -gt 3 ] && perror "download_untar called with $# arguments, need 2 or 3" - local URL=$1 - local DEST=$2 + local URL="$1" + local DEST="$2" if [ $# -eq 2 ]; then local TMPFILE=dltmp.$(basename "$URL") else - local TMPFILE=$3 + local TMPFILE="$3" fi + pdebug "$URL ---> $TMPFILE" download "$URL" "$TMPFILE" mkdir -p "$DEST" pinfo "Unpacking to '$DEST'..." @@ -40,3 +43,29 @@ download_untar () { unlink "$TMPFILE" } +# Download first param URL to second param path, +# iff the local file does not exist or is empty. +# Return 1 if remote file does not exist, 0 otherwise +download_if_empty() { + [ $# -ne 2 ] && perror "download_if_empty: want 2 args, got $# ($@)" + local SRC="$1" + local DST="$2" + [ -s "$DST" ] && pdebug "Not downloading $DST: already there." && return 0 + pdebug "Downloading $DST" + [ -e "$DST" ] && unlink "$DST" + local DSTDIR="$(dirname "$DST")" + pdebug "wgetting $SRC" + local TMP=$(mktemp) + wget -O "$TMP" "$SRC" + local RET=$? + if [ "x$RET" = "x0" -a -s "$TMP" ]; then + mkdir -p "$DSTDIR" + mv "$TMP" "$DST" || perror "Could not mv '$TMP' '$DST'" + return 0 + fi + pdebug "WGET failed" + rmdir "$DSTDIR" + unlink "$TMP" + return 1 +} + diff --git a/helper/fileutil.inc b/helper/fileutil.inc index d39fbe87..07dab7af 100755..100644 --- a/helper/fileutil.inc +++ b/helper/fileutil.inc @@ -24,7 +24,8 @@ tarcopy () { [ ${#SHORT} -gt 30 ] && SHORT=$(echo "$SHORT" | sed ':a;N;$!ba;s/\n/ /g' | cut -c-25)...$(echo "$SHORT" | cut -c$[${#SHORT} - 4]-) [ -z "$TO" ] && perror "tarcopy called with empty destination." [ ! -d "$TO" ] && { mkdir -p "$TO" || perror "could not create destination "$TO" for tar-copy."; } - tar -cp $FROM | tar -xp -C "$TO" + # TODO count files copied? would remove the need to do it everywhere :) + tar -cpP $FROM | tar -xp -C "$TO" 2> /dev/null local PS=(${PIPESTATUS[*]}) [ "x${PS[0]}" != "x0" ] && perror "packing-part of tar-copy from '$SHORT' to '$TO' failed. (${PS[0]})" [ "x${PS[1]}" != "x0" ] && perror "unpacking-part of tar-copy from '$SHORT' to '$TO' failed. (${PS[1]})" @@ -45,8 +46,8 @@ list_packet_files() { #FILES=$(echo "$FILES" | sed 's/^\(.*\):###:[0-9]*$/\1/g') local LPRET=$(echo "$FILES" | awk -F ':###:' '{printf $2}') FILES=$(echo "$FILES" | awk -F ':###:' '{print $1}') - [ "x$LPRET" != "x0" ] && pwarning "dpkg/rpm exited with code '$LPRET' for packet ${PACKAGE}." && return 1 - [ -z "$FILES" ] && pwarning "list_packet_files empty for packet ${PACKAGE}." + [ "x$LPRET" != "x0" ] && pwarning "dpkg/rpm exited with code '$LPRET' for packet ${PACKAGE}." && continue + [ -z "$FILES" ] && pwarning "list_packet_files empty for packet ${PACKAGE}." && continue for FILE in $FILES; do [ ! -d "$FILE" ] && echo "$FILE" done @@ -56,8 +57,10 @@ list_packet_files() { # install all dependencies of a module # goes through all package as given in the variable REQUIRED_DEPENDENCIES install_dependencies() { - [ -z "$REQUIRED_DEPENDENCIES" ] && return + [ -z "$REQUIRED_DEPENDENCIES" ] && return if [ "$PACKET_MANAGER" = "apt" ]; then + # install package, only if not already installed + dpkg -l $(echo $(echo "$REQUIRED_DEPENDENCIES")) &> /dev/null && return apt-get install -y $REQUIRED_DEPENDENCIES || perror "Could not apt-get install $REQUIRED_DEPENDENCIES" elif [ "$PACKET_MANAGER" = "zypper" ]; then zypper --no-refresh install -y -n $REQUIRED_DEPENDENCIES || perror "Could not zypper install $REQUIRED_DEPENDENCIES" @@ -68,11 +71,30 @@ install_dependencies() { # copy_static_data() { [ ! -d "${MODULE_DIR}/data" ] && pinfo "${MODULE} has no static 'data' directory." && return - cp -r ${MODULE_DIR}/data/* ${TARGET_BUILD_DIR} || perror "Could not copy static data of ${MODULE}" + cp -r "${MODULE_DIR}/data/"* ${TARGET_BUILD_DIR} || perror "Could not copy static data of ${MODULE}" } +calc_size() { + + local CURRENT_BUILD_SIZE=$(du -bc "${TARGET_BUILD_DIR}" | awk 'END {print $1}') + + [ ! -z "${BUILD_SIZE[$MODULE]}" ] && local OLD_MODULE_SIZE=${BUILD_SIZE[$MODULE]} || local OLD_MODULE_SIZE=0 + local diff=$((CURRENT_BUILD_SIZE-TARGET_BUILD_SIZE+OLD_MODULE_SIZE)) + + if [ -z "${BUILD_SIZE[$MODULE]}" ]; then + echo "BUILD_SIZE[$MODULE]=${diff}" >> "${ROOT_DIR}/logs/${TARGET}.size" + else + sed -i "s/^BUILD_SIZE\[${MODULE}\]=.*$/BUILD_SIZE\[${MODULE}\]=${diff}/g" "${ROOT_DIR}/logs/${TARGET}.size" + fi + + MODULE_BUILD_SIZE=$(echo $diff | awk '{ sum=$1; hum[1024^3]="GB"; hum[1024^2]="MB"; hum[1024]="KB"; + for (x=1024^3; x>=1024; x/=1024){ + if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break } + } + }') + TARGET_BUILD_SIZE=$CURRENT_BUILD_SIZE +} -###################################################################################################################### # # generate initramfs of directory # usage: @@ -80,7 +102,6 @@ copy_static_data() { # example: # generate_initramfs "./server/boot/stage32_sqfs" "./mnt/openslx.sqfs" "./server/boot/initramfs2" # generate_initramfs "./server/build/stage31" "." "./server/boot/initramfs" - generate_initramfs() { [ $# -ne 3 ] && perror "Sanity check failed: generate_initramfs needs exactly two params, but $# were given." cd "$1" || perror "Cannot cd to '$1'" @@ -90,7 +111,7 @@ generate_initramfs() { [ "x${PS[0]}" != "x0" ] && perror "'find $2' in '$(pwd)' failed." [ "x${PS[1]}" != "x0" ] && perror "cpio create failed." [ "x${PS[2]}" != "x0" ] && perror "gzip to '$3' failed." - cd - + cd - &> /dev/null pinfo "Created initramfs of $1 at $3" } diff --git a/helper/kernel.inc b/helper/kernel.inc new file mode 100644 index 00000000..4216f25a --- /dev/null +++ b/helper/kernel.inc @@ -0,0 +1,137 @@ +# +# Common functions to copy kernel related files +# +############################################################ +# +# +# copies kernel modules as given in the module config file +# * depends on 'depmod' +# * requires REQUIRED_KERNEL_MODULES to be set. +# (entries must be a relative path to /lib/modules/<KERNEL_VERSION>) +# +# ex: for /lib/modules/3.2.0/kernel/fs/nfs/nfs.ko +# must be given as kernel/fs/nfs/nfs.ko +# + +# this code depends on KERNEL_VERSION, this file needs to be sourced after helper/system.inc! +# (TODO: maybe source system.inc if KERNEL_VERSION is empty. +#[ -z "${KERNEL_VERSION}" ] && perror "KERNEL_VERSION not set. Was helper/system.inc sourced?" + +KERNEL_NFS_DIR="" +mount_kernel_dir() { + [ -z "$KERNEL_NFS_DIR" ] || return 0 + KERNEL_NFS_DIR="$(mktemp -d)" + mount -t nfs -o ro "132.230.8.228:/srv/openslx/kernel" "$KERNEL_NFS_DIR" + local RET=$? + if [ "x$RET" != "x0" ]; then + KERNEL_NFS_DIR="" + perror "Mounting kernel nfs dir to $KERNEL_NFS_DIR failed." + exit 1 + fi + #pinfo "$KERNEL_NFS_DIR/$SELECTED_KERNEL" + #qnd_exit + [ -d "$KERNEL_NFS_DIR/$SELECTED_KERNEL" ] || perror "directory for $KERNEL_VERSION ($SELECTED_KERNEL) does not exist on NFS server" +} + +unmount_kernel_dir() { + [ -z "$KERNEL_NFS_DIR" ] && return 0 + pinfo "Unmounting kernel nfs stuff....." + umount "$KERNEL_NFS_DIR" || perror "Could not unmount kernel NFS share at '$KERNEL_NFS_DIR' - check the following lsof output:\n$(lsof -n | grep "$KERNEL_NFS_DIR")\n- End of lsof output -" + rmdir "$KERNEL_NFS_DIR" + KERNEL_NFS_DIR="" +} + +copy_kernel_modules() { + + [ -z "${REQUIRED_KERNEL_MODULES}" ] && perror "REQUIRED_KERNEL_MODULES is empty. Check your config file." + + # + # process modules list + # + mount_kernel_dir + cd "$KERNEL_NFS_DIR/$SELECTED_KERNEL" || perror "Could not cd to $KERNEL_NFS_DIR/$SELECTED_KERNEL" + local KERNEL_MODULES_DIR="lib/modules/${KERNEL_VERSION}" + local KERNEL_MODULES_LIST="" + for KERNEL_MODULE in ${REQUIRED_KERNEL_MODULES}; do + local KERNEL_MODULE_PATH="${KERNEL_MODULES_DIR}/${KERNEL_MODULE}" + if grep "${KERNEL_MODULE}" "${KERNEL_NFS_DIR}/${SELECTED_KERNEL}/${KERNEL_MODULES_DIR}/modules.builtin" >/dev/null; then + pdebug "Already built-in ${KERNEL_MODULE}." + elif [ -e "${KERNEL_MODULE_PATH}" ]; then + pdebug "Copying '${KERNEL_MODULE_PATH}'" + MODULES_LIST+=" ${KERNEL_MODULE_PATH}" + else + pwarning "Module ${KERNEL_MODULE} not found. Skipping. (might cause problems on certain clients!)" + continue + fi + done + + if [ ! -z "${KERNEL_MODULES_LIST}" ]; then + local COUNT=$(echo "${KERNEL_MODULES_LIST}" | wc -w) + pinfo "Copying $COUNT modules to target directory." + tarcopy "${KERNEL_MODULES_LIST}" "${TARGET_BUILD_DIR}" + fi + + # + # generate modules map files + # + # first strip modules.order of all the modules we don't use + cat "${KERNEL_MODULES_DIR}/modules.order" | grep -E $(echo ${REQUIRED_KERNEL_MODULES} | tr '\ ' '|') \ + >> "${TARGET_BUILD_DIR}/${KERNEL_MODULES_DIR}/modules.order" + # copy list of builtin kernel modules + cp "${KERNEL_MODULES_DIR}/modules.builtin" "${TARGET_BUILD_DIR}/${KERNEL_MODULES_DIR}" + # with modules.order and modules.builtin, we can run depmod for the rest of the files + depmod -b "${TARGET_BUILD_DIR}" -a "${KERNEL_VERSION}" + + cd - >/dev/null +} + +copy_firmware() { + + [ -z "${REQUIRED_FIRMWARE}" ] && perror "REQUIRED_FIRMWARE is empty. Check your config file." + + # + # process firmware list + # + mount_kernel_dir + cd "$KERNEL_NFS_DIR/$SELECTED_KERNEL" || perror "Could not cd to $KERNEL_NFS_DIR/$SELECTED_KERNEL" + local FIRMWARE_DIR="lib/firmware" + local FIRMWARE_LIST="" + for FIRMWARE in ${REQUIRED_FIRMWARE}; do + local FOUND=0 + for CANDIDATE in "${FIRMWARE_DIR}/${FIRMWARE}" "${FIRMWARE_DIR}/${KERNEL_VERSION}/${FIRMWARE}"; do + if [ -e "${CANDIDATE}" ]; then + pdebug "Copying '${CANDIDATE}'" + FIRMWARE_LIST+=" ${CANDIDATE}" + FOUND=1 + fi + done + + [ $FOUND -ne 1 ] && pwarning "Neither '${FIRMWARE_DIR}/${FIRMWARE}' nor '${FIRMWARE_DIR}/${KERNEL_VERSION}/${FIRMWARE}' "\ + " was found on the system. Skipping. (might cause problems on certain clients!)" + done + + if [ ! -z "${FIRMWARE_LIST}" ]; then + local COUNT=$(echo "${FIRMWARE_LIST}" | wc -w) + pinfo "Copying $COUNT firmware to target directory." + tarcopy "${FIRMWARE_LIST}" "${TARGET_BUILD_DIR}" + fi + cd - >/dev/null +} + +copy_kernel() { + + local KERNEL_NAME="vmlinuz-${KERNEL_VERSION}" + [ -e "${KERNEL_DIR}/${KERNEL_NAME}" ] && return + + local TOOL_STR="$TOOL_STR copy_kernel:" + + mkdir -p "${KERNEL_DIR}" + + pinfo "New kernel found. Copying '${KERNEL_NAME}' to '${KERNEL_DIR}'." + mount_kernel_dir + + cp "$KERNEL_NFS_DIR/$SELECTED_KERNEL/bzImage" "$KERNEL_DIR/$KERNEL_NAME" || perror "Could not copy kernel from '$KERNEL_NFS_DIR/$SELECTED_KERNEL/bzImage' to '$KERNEL_DIR/$KERNEL_NAME'" + + pinfo "You may want to update your systems firmware/modules to match the current kernel." +} + diff --git a/helper/logging.inc b/helper/logging.inc index eb20775c..a237edc2 100644 --- a/helper/logging.inc +++ b/helper/logging.inc @@ -34,6 +34,7 @@ pinfo () { perror () { echo -e "\033[38;5;9m[error]\033[0m $TOOL_STR $@" >&6 + unmount_kernel_dir qnd_exit } diff --git a/helper/system.inc b/helper/system.inc index 4c0ea467..21e92422 100644 --- a/helper/system.inc +++ b/helper/system.inc @@ -11,8 +11,8 @@ ARCH_LIB_DIR=$(ldd $SHELL | grep "libc.so" | sed -r 's#^.*(/lib.*)/libc.so.*$#\1 [ -z "$ARCH_LIB_DIR" -o ! -d "$ARCH_LIB_DIR" ] && perror "Could not determine arch dependent lib dir (where libc.so resides)" # determine kernel version -KERNEL_VERSION=$(uname -r) -[ ! -z $KERNEL_VERSION ] || pwarning "Could not determine kernel version." +#KERNEL_VERSION=$(uname -r) +#[ ! -z $KERNEL_VERSION ] || pwarning "Could not determine kernel version." # determine number of CPU cores CPU_CORES=$(cat /proc/cpuinfo | grep processor | wc -l) @@ -26,13 +26,21 @@ qnd_exit() { [ $# -ge 1 ] && kill "$1" } -. "${ROOT_DIR}/helper/logging.inc" -. "${ROOT_DIR}/helper/useradd.inc" -. "${ROOT_DIR}/helper/downloader.inc" -. "${ROOT_DIR}/helper/fileutil.inc" -. "${ROOT_DIR}/helper/binutil.inc" -. "${ROOT_DIR}/helper/system.inc" - +for HELPER in $ROOT_DIR/helper/*.inc; do + . "$HELPER" && continue + unset_quiet + echo "Could not source $HELPER" + qnd_exit +done + +# TODO: Configurable! +if [ "$(uname -p)" = "x86_64" ]; then + KERNEL_VERSION="3.4.0-1.16-default+" + SELECTED_KERNEL="x86_64/$KERNEL_VERSION" +else + KERNEL_VERSION="3.4.0-1.16-default" + SELECTED_KERNEL="x86_32/$KERNEL_VERSION" +fi banner () { echo -e "\033[38;5;202m\t __ __ __ " @@ -49,7 +57,7 @@ print_usage() { echo -e "" echo -e "Toolkit for creating preboot mini-linux for OpenSLX NG (mltk)" echo -e "Usage: $(basename ${SELF}) remote <target> [-d] [-c [module]*] [-b [module]*] [-p profile]" - echo -e " $(basename ${SELF}) server <target> [-e stage31|stage32|addons] [-d] [-c]" + echo -e " $(basename ${SELF}) server [-s] [<target>] [-e stage31|stage32|addons] [-d] [-c]" echo -e "" echo -e " Mode:" echo -e " server \t server mode: packs stage3.1, stage3.2 or addons as initramfs/squashfs." @@ -58,9 +66,10 @@ print_usage() { echo -e " Mode options:" echo -e " -b remote: build module(s)" echo -e " -e type server: export target as stage31, stage32 or addons" + echo -e " -s server: sync 'builds' directory of remote host" echo -e " -c remote: clean module(s). / server: clean target in remote_builds/ and corresponding files under boot/" echo -e " -d activates debug output for current target/build" - echo -e " -p profile build all modules from given profile" + echo -e " -p profile remote: build all modules from given profile" echo -e "" echo -e " In mode 'remote', you can pass names of specific modules to clean/build." echo -e " Otherwise, all modules will be built/cleaned." @@ -76,7 +85,7 @@ print_usage() { echo -e " Existing targets for remote are:" echo -e " $(echo $(ls ${ROOT_DIR}/remote/targets 2>/dev/null || echo "No targets for remote found."))" echo -e " Existing targets for server are:" - echo -e " $(echo $(ls ${ROOT_DIR}/server/remote_builds 2>/dev/null || echo "No targets for remote found."))" + echo -e " $(echo $(ls ${ROOT_DIR}/server/remote_builds 2>/dev/null || echo "No targets for server found."))" echo -e "" } @@ -91,7 +100,7 @@ initial_checks() { pinfo "Arch triplet of this machine: $ARCH_TRIPLET" pinfo "Kernel version: $KERNEL_VERSION" pinfo "System's packet manager is $PACKET_MANAGER" - + # setup_target and export_target REMOTE_SETUP_TARGET="${ROOT_DIR}/remote/setup_target" SERVER_EXPORT_TARGET="${ROOT_DIR}/server/export_target" @@ -124,7 +133,7 @@ read_params() { if [[ $1 != "-"* ]]; then TARGET=$1 shift - else + elif [[ $1 != "-s" ]]; then perror "A target is required. None given." fi @@ -136,6 +145,11 @@ read_params() { # options to current target if [[ "$PARAM" == "-"* ]]; then case "$PARAM" in + -s) + SERVER_SYNC="1" + #TODO mit Remote IP + continue + ;; -c) SUBMODE="CLEAN" ;; @@ -183,7 +197,8 @@ read_params() { done # exit if no command - [[ $SERVER_CLEAN == 0 && $SERVER_EXPORT == 0 && $REMOTE_CLEAN == 0 && $REMOTE_BUILD == 0 ]] && print_usage && exit 1 + + [[ $SERVER_CLEAN == 0 && $SERVER_EXPORT == 0 && $REMOTE_CLEAN == 0 && $REMOTE_BUILD == 0 && $SERVER_SYNC == 0 ]] && print_usage && exit 1 } run() { @@ -193,9 +208,10 @@ run() { [[ $REMOTE_CLEAN == 1 ]] && clean_modules $TARGET $REMOTE_LIST_CLEAN [[ $REMOTE_BUILD == 1 ]] && generate_target $TARGET $REMOTE_LIST_BUILD fi - if [[ $SERVER_CLEAN == 1 || $SERVER_EXPORT == 1 ]]; then + if [[ $SERVER_CLEAN == 1 || $SERVER_EXPORT == 1 || $SERVER_SYNC == 1 ]]; then [[ $SERVER_DEBUG == 1 ]] && unset_quiet || set_quiet . "${SERVER_EXPORT_TARGET}" || perror "Cannot source ${SERVER_EXPORT_TARGET}" + [[ $SERVER_SYNC == 1 ]] && sync_remote [[ $SERVER_CLEAN == 1 ]] && clean_target $TARGET [[ $SERVER_EXPORT == 1 ]] && export_target $TARGET $SERVER_EXPORT_TYPE fi @@ -205,6 +221,7 @@ SERVER_DEBUG="0" SERVER_EXPORT="0" SERVER_CLEAN="0" SERVER_EXPORT_TYPE="" +SERVER_SYNC="0" REMOTE_DEBUG="0" REMOTE_CLEAN="0" REMOTE_BUILD="0" @@ -215,3 +232,6 @@ initial_checks read_params $@ run + +unmount_kernel_dir + diff --git a/remote/modules/busybox/busybox.build b/remote/modules/busybox/busybox.build index d11a3828..45bdd396 100644 --- a/remote/modules/busybox/busybox.build +++ b/remote/modules/busybox/busybox.build @@ -1,25 +1,16 @@ #!/bin/bash -fetch_source() -{ - [ ! -d src ] && mkdir src - if [ ! -e .fetched_source ]; then - git clone "${GIT}" src - touch .fetched_source - fi +fetch_source() { + git clone "${GIT}" src } -build() -{ - if [ ! -e .built ]; then - cd src - pinfo "Running make" - make || perror "failed." - pinfo "Running make install" - make CONFIG_PREFIX="${MODULE_DIR}"/build/"${PREFIX}" install || perror "failed" - cd - - touch .built - fi +build() { + cd src + pinfo "Running make" + make || perror "failed." + pinfo "Running make install" + make CONFIG_PREFIX="${MODULE_DIR}"/build/"${PREFIX}" install || perror "failed" + cd - &> /dev/null } post_copy() { diff --git a/remote/modules/hwinfo/hwinfo.build b/remote/modules/hwinfo/hwinfo.build index b2012a22..9cf7eb1e 100644 --- a/remote/modules/hwinfo/hwinfo.build +++ b/remote/modules/hwinfo/hwinfo.build @@ -1,23 +1,36 @@ +BIN_PATH=$(which hwinfo) + fetch_source() { - [ ! -d "${MODULE_DIR}/src" ] && mkdir -p "${MODULE_DIR}/src" - cd "${MODULE_DIR}/src" - git clone git://gitorious.org/opensuse/hwinfo.git - git clone git://gitorious.org/x86emu/libx86emu.git - cd - &> /dev/null + if [ -z ${BIN_PATH} ]; then + [ ! -d "${MODULE_DIR}/src" ] && mkdir -p "${MODULE_DIR}/src" + cd "${MODULE_DIR}/src" + git clone git://gitorious.org/opensuse/hwinfo.git + git clone git://gitorious.org/x86emu/libx86emu.git + cd - &> /dev/null + else + pinfo "Copying hwinfo from system." + fi } build() { - pdebug "Installing libx86emu in ${MODULE_DIR}/build..." - cd "${MODULE_DIR}/src/libx86emu" - EXTRA_FLAGS="-I${MODULE_DIR}/src/libx86emu/include" make || perror "libx86emu: make failed." - DESTDIR="${MODULE_DIR}"/build make install || perror "libx86emu: make install failed." - cd - &> /dev/null - pdebug "Installing hwinfo in ${MODULE_DIR}/build..." - cd "${MODULE_DIR}/src/hwinfo" - make || perror "hwinfo: make failed." - DESTDIR="${MODULE_DIR}/build" make install || perror "hwinfo: make install failed." - cd - &> /dev/null + if [ ! -z ${BIN_PATH} -a -e ${BIN_PATH} ]; then + tarcopy "$(get_link_chain ${BIN_PATH})" "${MODULE_BUILD_DIR}" + else + pdebug "Installing libx86emu in ${MODULE_BUILD_DIR}..." + cd "${MODULE_DIR}/src/libx86emu" + make || perror "libx86emu: make failed." + DESTDIR="${MODULE_BUILD_DIR}" make install || perror "libx86emu: make install failed." + cd - &> /dev/null + + pdebug "Installing hwinfo in ${MODULE_BUILD_DIR}..." + cd "${MODULE_DIR}/src/hwinfo" + # find libx86emu path + LIBX86EMU_DIR=$(dirname $(find ${MODULE_BUILD_DIR} -name libx86emu.so)) + EXTRA_FLAGS="-I${MODULE_BUILD_DIR}/usr/include" LIBRARY_PATH="${LIBX86EMU_DIR}" LD_LIBRARY_PATH="${LIBX86EMU_DIR}" make || pwarning "hwinfo: make failed." + DESTDIR="${MODULE_BUILD_DIR}" make install || pwarning "hwinfo: make install failed." + cd - &> /dev/null + fi } diff --git a/remote/modules/hwinfo/hwinfo.conf b/remote/modules/hwinfo/hwinfo.conf index af5783a2..2d3db99d 100644 --- a/remote/modules/hwinfo/hwinfo.conf +++ b/remote/modules/hwinfo/hwinfo.conf @@ -1 +1,3 @@ REQUIRED_BINARIES=" hwinfo" +REQUIRED_DEPENDENCIES=" flex + hwinfo" diff --git a/remote/modules/kdm/kdm.build b/remote/modules/kdm/kdm.build index 638f8088..9f2008f5 100644 --- a/remote/modules/kdm/kdm.build +++ b/remote/modules/kdm/kdm.build @@ -21,6 +21,6 @@ post_copy() { #copy required icons [ ! -z "$REQUIRED_SYSTEM_FILES" ] && tarcopy "$REQUIRED_SYSTEM_FILES" "$TARGET_BUILD_DIR" - gtk-update-icon-cache-3.0 "${TARGET_BUILD_DIR}/usr/share/icons/oxygen/" || perror "update-icon-cache-3.0 failed." + gtk-update-icon-cache-3.0 "${TARGET_BUILD_DIR}/usr/share/icons/oxygen/" || pwarning "update-icon-cache-3.0 failed." } diff --git a/remote/modules/kdm/kdm.conf b/remote/modules/kdm/kdm.conf index 75a84999..2ae5dd91 100644 --- a/remote/modules/kdm/kdm.conf +++ b/remote/modules/kdm/kdm.conf @@ -1,4 +1,4 @@ -REQUIRED_DEPENDENCIES="kdm" +REQUIRED_DEPENDENCIES="kdm kde-workspace-kgreet-plugins" REQUIRED_PACKAGES="kdm kde-workspace-kgreet-plugins" REQUIRED_BINARIES="" REQUIRED_DIRECTORIES=" /etc/dbus-1 diff --git a/remote/modules/ldm-gtk-greeter/ldm-gtk-greeter.build b/remote/modules/ldm-gtk-greeter/ldm-gtk-greeter.build index 7f02e281..27e5a592 100644 --- a/remote/modules/ldm-gtk-greeter/ldm-gtk-greeter.build +++ b/remote/modules/ldm-gtk-greeter/ldm-gtk-greeter.build @@ -1,30 +1,25 @@ #tool/distro specific functions for fetching, building and installing dependencies fetch_source () { - [ ! -e .fetched_source ] && download_untar "$URL" "src/" - touch .fetched_source + download_untar "$URL" "src/" } build () { - if [ ! -e .built ]; then - cd "src/$VERSION" - pinfo "Running configure" - ./configure --prefix="/" --datarootdir="/usr/share" || perror "failed." - pinfo "Running make" - make || perror "failed." - pinfo "Running make install" - DESTDIR="${MODULE_BUILD_DIR}" make install || perror "failed." + cd "src/$VERSION" + pinfo "Running configure" + ./configure --prefix="/" --datarootdir="/usr/share" || perror "failed." + pinfo "Running make" + make || perror "failed." + pinfo "Running make install" + DESTDIR="${MODULE_BUILD_DIR}" make install || perror "failed." - COPYLIST="list_dpkg_output" - [ -e "$COPYLIST" ] && rm "$COPYLIST" + COPYLIST="list_dpkg_output" + [ -e "$COPYLIST" ] && rm "$COPYLIST" - list_packet_files >> "$COPYLIST" - tarcopy "$(cat "$COPYLIST" | sort -u)" "${MODULE_BUILD_DIR}" + list_packet_files >> "$COPYLIST" + tarcopy "$(cat "$COPYLIST" | sort -u)" "${MODULE_BUILD_DIR}" - cd - - touch .built - - fi + cd - } post_copy() { diff --git a/remote/modules/ldm/ldm.build b/remote/modules/ldm/ldm.build index 0e73148c..e88f0b08 100644 --- a/remote/modules/ldm/ldm.build +++ b/remote/modules/ldm/ldm.build @@ -1,30 +1,26 @@ #tool/distro specific functions for fetching, building and installing dependencies fetch_source () { - [ ! -e .fetched_source ] && download_untar "$URL" "src/" - touch .fetched_source + download_untar "$URL" "src/" } build () { - if [ ! -e .built ]; then - cd "src/$VERSION" - pinfo "Running configure" - ./configure --prefix="/" --datarootdir="/usr/share" || perror "failed." - pinfo "Running make" - make || perror "failed." - pinfo "Running make install" - DESTDIR="${MODULE_BUILD_DIR}" make install || perror "failed." + cd "src/$VERSION" + pinfo "Running configure" + ./configure --prefix="/" --datarootdir="/usr/share" || perror "failed." + pinfo "Running make" + make || perror "failed." + pinfo "Running make install" + DESTDIR="${MODULE_BUILD_DIR}" make install || perror "failed." - COPYLIST="list_dpkg_output" + COPYLIST="list_dpkg_output" - [ -e "$COPYLIST" ] && rm "$COPYLIST" + [ -e "$COPYLIST" ] && rm "$COPYLIST" - list_packet_files >> "$COPYLIST" - tarcopy "$(cat "$COPYLIST" | sort -u)" "${MODULE_BUILD_DIR}" + list_packet_files >> "$COPYLIST" + tarcopy "$(cat "$COPYLIST" | sort -u)" "${MODULE_BUILD_DIR}" - cd - - touch .built - fi + cd - } post_copy() { diff --git a/remote/modules/plymouth/plymouth.build b/remote/modules/plymouth/plymouth.build index d5e9c594..1346f087 100644 --- a/remote/modules/plymouth/plymouth.build +++ b/remote/modules/plymouth/plymouth.build @@ -1,22 +1,18 @@ #!/bin/bash fetch_source() { - [ ! -e .fetched_source ] && download_untar "$URL" "src/" - touch .fetched_source + download_untar "$URL" "src/" } build() { - if [ ! -e .built ]; then - cd src/$VERSION - pinfo "Running configure" - ./configure --enable-systemd-integration --disable-gtk --disable-static --prefix=""|| perror "failed." - pinfo "Running make" - make || perror "failed" - pinfo "Running make install" - DESTDIR="${MODULE_BUILD_DIR}" make install || perror "failed" - cd - - touch .built - fi + cd src/$VERSION + pinfo "Running configure" + ./configure --enable-systemd-integration --disable-gtk --disable-static --prefix=""|| perror "failed." + pinfo "Running make" + make || perror "failed" + pinfo "Running make install" + DESTDIR="${MODULE_BUILD_DIR}" make install || perror "failed" + cd - } post_copy() { diff --git a/remote/modules/policykit-src/policykit.build b/remote/modules/policykit-src/policykit.build index 811d9b0c..26d1e27a 100644 --- a/remote/modules/policykit-src/policykit.build +++ b/remote/modules/policykit-src/policykit.build @@ -2,35 +2,31 @@ fetch_source () { - [ ! -e .fetched_source ] && download_untar "$URL" "src/" - touch .fetched_source + download_untar "$URL" "src/" } build () { - if [ ! -e .built ]; then - cd src/$VERSION - - [ ! -d "${MODULES_DIR}/systemd/build" ] && perror "systemd build directory not found. Build it first." - SYSTEMD_BUILD_DIR="${MODULES_DIR}/systemd/build" - pinfo "configuring..." - LIBSYSTEMD_LOGIN_LIBS="-L${SYSTEMD_BUILD_DIR}/usr/lib/" \ - LIBSYSTEMD_LOGIN_CFLAGS="-I${SYSTEMD_BUILD_DIR}/usr/include -I${SYSTEMD_BUILD_DIR}/usr/include/systemd -lsystemd-login -lsystemd-daemon" \ - ./configure --enable-libsystemd-login=yes --with-systemdsystemunitdir=/etc/systemd/system -prefix="/" --datarootdir="/usr/share" --enable-man-pages=no --enable-gtk-doc-html=no --enable-examples=no --enable-static=no - pinfo "calling make..." - make || perror "make failed." - [ ! -d "${MODULE_BUILD_DIR}" ] && mkdir -p "${MODULE_BUILD_DIR}" - pinfo "installing to ${MODULE_BUILD_DIR}..." - DESTDIR="${MODULE_BUILD_DIR}" make install || perror "make install failed..." - - COPYLIST="list_dpkg_output" - [ -e "$COPYLIST" ] && rm "$COPYLIST" - - list_packet_files >> "$COPYLIST" - tarcopy "$(cat "$COPYLIST" | sort -u)" "${MODULE_BUILD_DIR}" - - cd - - touch .built - fi + cd src/$VERSION + + [ ! -d "${MODULES_DIR}/systemd/build" ] && perror "systemd build directory not found. Build it first." + SYSTEMD_BUILD_DIR="${MODULES_DIR}/systemd/build" + pinfo "configuring..." + LIBSYSTEMD_LOGIN_LIBS="-L${SYSTEMD_BUILD_DIR}/usr/lib/" \ + LIBSYSTEMD_LOGIN_CFLAGS="-I${SYSTEMD_BUILD_DIR}/usr/include -I${SYSTEMD_BUILD_DIR}/usr/include/systemd -lsystemd-login -lsystemd-daemon" \ + ./configure --enable-libsystemd-login=yes --with-systemdsystemunitdir=/etc/systemd/system -prefix="/" --datarootdir="/usr/share" --enable-man-pages=no --enable-gtk-doc-html=no --enable-examples=no --enable-static=no + pinfo "calling make..." + make || perror "make failed." + [ ! -d "${MODULE_BUILD_DIR}" ] && mkdir -p "${MODULE_BUILD_DIR}" + pinfo "installing to ${MODULE_BUILD_DIR}..." + DESTDIR="${MODULE_BUILD_DIR}" make install || perror "make install failed..." + + COPYLIST="list_dpkg_output" + [ -e "$COPYLIST" ] && rm "$COPYLIST" + + list_packet_files >> "$COPYLIST" + tarcopy "$(cat "$COPYLIST" | sort -u)" "${MODULE_BUILD_DIR}" + + cd - } post_copy() { diff --git a/remote/modules/sshd/sshd.build b/remote/modules/sshd/sshd.build index 0b198c6c..89dcd386 100644 --- a/remote/modules/sshd/sshd.build +++ b/remote/modules/sshd/sshd.build @@ -4,9 +4,9 @@ fetch_source() { build() { - BIN_LOCATION=$(which sshd) - [ ! -z ${BIN_LOCATION} ] && BIN_LOCATION=$(readlink -f "$BIN_LOCATION") - if [ ! -z ${BIN_LOCATION} -a -e ${BIN_LOCATION} ]; then + local BIN_LOCATION="$(which sshd)" + [ ! -z "${BIN_LOCATION}" ] && BIN_LOCATION=$(readlink -f "$BIN_LOCATION") + if [ ! -z "${BIN_LOCATION}" -a -e "${BIN_LOCATION}" ]; then tarcopy "${BIN_LOCATION}" "${MODULE_BUILD_DIR}" else perror "'sshd' not found on the system! Please install it." @@ -14,7 +14,8 @@ build() { } post_copy() { - mkdir -p "${TARGET_BUILD_DIR}/var/run/sshd" + mkdir -p "${TARGET_BUILD_DIR}/var/run/sshd" # ubuntu + mkdir -p "${TARGET_BUILD_DIR}/var/lib/empty" # suse - chmod go-rwx "${TARGET_BUILD_DIR}/etc/ssh/*" + chmod go-rwx "${TARGET_BUILD_DIR}/etc/ssh/"* # no space, " before * } diff --git a/remote/modules/systemd/systemd.build b/remote/modules/systemd/systemd.build index 57fb705e..ee74d53a 100644 --- a/remote/modules/systemd/systemd.build +++ b/remote/modules/systemd/systemd.build @@ -1,34 +1,27 @@ #tool/distro specific functions for fetching, building and installing dependencies fetch_source () { - if [ ! -e .fetched_source ]; then - download_untar "$URL" "src/" - download_untar "$LIBKMOD_URL" "src/" - touch .fetched_source - fi + download_untar "$URL" "src/" + download_untar "$LIBKMOD_URL" "src/" } build () { - if [ ! -e .built ]; then - #build libkmod - cd "${MODULE_DIR}/src/$LIBKMOD_VERSION" - pwarning "$(pwd)" - ./configure - make || perror "make failed." - make install || perror "make install failed." - cd - &> /dev/null + #build libkmod + cd "${MODULE_DIR}/src/$LIBKMOD_VERSION" + ./configure + make || perror "make failed." + make install || perror "make install failed." + cd - &> /dev/null - #build systemd - cd "${MODULE_DIR}/src/$VERSION" - pinfo "calling configure" - ./configure --disable-manpages --enable-split-usr --sysconfdir="/etc" --enable-gtk-doc-html=no || perror "configure failed." - pinfo "calling make" - make || perror "make failed." - pinfo "calling make install" - DESTDIR="${MODULE_BUILD_DIR}" make install || perror "make install failed." - cd - &> /dev/null - touch .built - fi + #build systemd + cd "${MODULE_DIR}/src/$VERSION" + pinfo "calling configure" + ./configure --disable-manpages --enable-split-usr --sysconfdir="/etc" --enable-gtk-doc-html=no || perror "configure failed." + pinfo "calling make" + make || perror "make failed." + pinfo "calling make install" + DESTDIR="${MODULE_BUILD_DIR}" make install || perror "make install failed." + cd - &> /dev/null } post_copy() { diff --git a/remote/modules/vmchooser/data/usr/share/xsessions/default.desktop b/remote/modules/vmchooser/data/usr/share/xsessions/default.desktop new file mode 100755 index 00000000..c6a0f825 --- /dev/null +++ b/remote/modules/vmchooser/data/usr/share/xsessions/default.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=virtual machine chooser (default) +Name[de]=Virtuelle Maschine auswählen +Comment=This session starts the vm session chooser +Comment[de]=Diese Sitzung startet das Auswahlmenü für die vorhandenen Sitzungen +Exec=/openslx/bin/vmchooser +TryExec=/openslx/bin/vmchooser +Icon= +Type=Application diff --git a/remote/modules/vmchooser/vmchooser.build b/remote/modules/vmchooser/vmchooser.build index 536aa5d3..340b1d9a 100644 --- a/remote/modules/vmchooser/vmchooser.build +++ b/remote/modules/vmchooser/vmchooser.build @@ -1,24 +1,15 @@ #!/bin/bash -fetch_source() -{ - [ ! -d src ] && mkdir src - if [ ! -e .fetched_source ]; then - git clone "${GIT}" src - touch .fetched_source - fi +fetch_source() { + git clone "${GIT}" src } -build() -{ - if [ ! -e .built ]; then - cd src - pinfo "Running vmchooser buildscript" - . build.sh - pinfo "" - cd - - touch .built - fi +build() { + cd src + pinfo "Running vmchooser buildscript" + . build.sh + pinfo "" + cd - &> /dev/null } post_copy() { diff --git a/remote/modules/xorg/xorg.build b/remote/modules/xorg/xorg.build index 8026f2b2..34750ef5 100644 --- a/remote/modules/xorg/xorg.build +++ b/remote/modules/xorg/xorg.build @@ -15,7 +15,5 @@ build() { post_copy() { mkdir -p "${TARGET_BUILD_DIR}/etc/X11" [ ! -e ${TARGET_BUILD_DIR}/etc/X11/X ] && ln -s /usr/bin/Xorg ${TARGET_BUILD_DIR}/etc/X11/X - mkdir -p "${TARGET_BUILD_DIR}/var/lib/xkb" - cp /var/lib/xkb/server* "${TARGET_BUILD_DIR}/var/lib/xkb/" #|| perror "Copying /var/lib/xkb/server* to '${TARGET_BUILD_DIR}/var/lib/xkb/' failed." } diff --git a/remote/modules/xorg/xorg.conf.zypper b/remote/modules/xorg/xorg.conf.zypper index c5e21646..ba681c66 100644 --- a/remote/modules/xorg/xorg.conf.zypper +++ b/remote/modules/xorg/xorg.conf.zypper @@ -1,6 +1,9 @@ REQUIRED_PACKAGES=" xorg-x11 xorg-x11-server - xorg-x11-driver-input" + xorg-x11-driver-input + xorg-x11-driver-video + Mesa + xkeyboard-config" REQUIRED_BINARIES=" Xorg gtf cvt diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init index 5f614bb3..cf89cff0 100755 --- a/remote/rootfs/rootfs-stage31/data/init +++ b/remote/rootfs/rootfs-stage31/data/init @@ -25,9 +25,6 @@ mount -n -t tmpfs -o 'mode=755' run "/run" echo "/sbin/mdev" > /proc/sys/kernel/hotplug # read graphic and network adaptor configuration (without proprietary drivers yet) -( hwinfo --gfxcard > /etc/hwinfo ) & -( hwinfo --netcard > /etc/netcard ) & - # read kernel command line for debugging switch DEBUG=0 read KCL < /proc/cmdline @@ -49,57 +46,24 @@ for opts in ${KCL}; do esac done -while ps | grep -v grep | grep -q " hwinfo --gfxcard" ; do usleep 10 ; done - -case $(cat /etc/hwinfo) in - *i915*) - modprobe -a i915 2>/dev/null - ;; - *intel*|*Intel*) - modprobe -a i810 i830 i915 2>/dev/null - ;; - *nvidia*|*NVidia*|*nouveau*) - modprobe -q nouveau 2>/dev/null - ;; - *radeon*|*Radeon*) - modprobe -q radeon 2>/dev/null - ;; - *mga*|*matrox*|*Matrox*) - modprobe -q mga 2>/dev/null - ;; - *VMWARE*) - modprobe -q uvesafb mode_option=1024x768-32 mtrr=3 scroll=ywrap 2>/dev/null - modprove -q vmwgfx 2>/dev/null - ;; - *) - modprobe -qa r128 savage sis tdfx ttm via viafb - ;; -esac -(modprobe -a drm; mdev -s ) & +mdev -s & if [ "x$SPLASH" == "x1" -a "x$DEBUG" != "x1" ]; then # start plymouth plymouthd && plymouth show-splash fi -# load required network and usb controller drivers, filter out wireless adaptors -while ps | grep -v grep | grep -q " hwinfo --netcard" ; do usleep 10 ; done -nwcardlist="forcedeth|e1000e|e1000|e100|tg3|via-rhine|r8169|pcnet32" -echo "modprobe -qa usbhid hid-bright" >/etc/modprobe.base -grep modprobe /etc/netcard | grep -E "$nwcardlist" \ - | sed 's/.* Cmd: "//;s/"//;s/modprobe/modprobe -qb/' \ - | sort -u >>/etc/modprobe.base -# virtio hack -if [ $(grep -ic "virtio_pci" /etc/modprobe.base) -ge 1 ]; then - echo "modprobe -q virtio_net" >>/etc/modprobe.base -fi -/bin/sh /etc/modprobe.base; mdev -s +# still needed? +#echo "modprobe -qa usbhid hid-bright" >/etc/modprobe.base +#/bin/sh /etc/modprobe.base; mdev -s # setup network nwif="eth0" # set up loopback networking +echo "Setting up loopback" ip link set dev lo up 2>/dev/null ip addr add 127.0.0.1/8 dev lo 2>/dev/null +echo "Setting up $nwif" ip link set dev $nwif up 2>/dev/null || { echo "No link for $nwif, dropping to shell.."; setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1'; } # analyze ip information from the kernel command line and put parts @@ -132,35 +96,39 @@ else fi -# load local file systems -modprobe aufs -modprobe squashfs +# load local file systems - in kernel now! :-) +#modprobe aufs +#modprobe squashfs mkdir -p /dev/shm/union /dev/shm/uniontmp /rorootfs mount -n -t tmpfs none /dev/shm/uniontmp if [ -n "$nfs" ] ; then + echo "Mounting stage 3.2 as NFS" mount -t nfs -o ro,async,nolock ${nfsserver}:${nfspath} /rorootfs || { echo "Problem mounting NFS-Directory from ${nfsserver}:${nfspath}. Dropping to DEBUG shell."; DEBUG=1; } else - mount -n /mnt/openslx.sqfs /rorootfs || { echo "Problem mounting Squashfs. Dropping to DEBUG shell."; DEBUG=1; } + echo "Mounting stage 3.2 as SquashFS" + mount -t squashfs /mnt/$(ls /mnt) /rorootfs || { echo "Problem mounting Squashfs. Dropping to DEBUG shell."; DEBUG=1; } fi -mount -n -t aufs -o br:/dev/shm/uniontmp:/rorootfs=ro none /mnt -mkdir -p /mnt/uniontmp /mnt/tmp -mount -n --move /dev/shm/uniontmp /mnt/uniontmp - if [ $DEBUG -ge 1 ]; then echo "Starting debug shell, CTRL + D will start Stage 3.2." setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1' else #Debug is not set so hide kernel debug output - echo "0 0 0 0" >/proc/sys/kernel/printk + echo "0" >/proc/sys/kernel/printk fi +echo "Building aufs..." +mount -n -t aufs -o br:/dev/shm/uniontmp:/rorootfs=ro none /mnt +mkdir -p /mnt/uniontmp /mnt/tmp +mount -n --move /dev/shm/uniontmp /mnt/uniontmp + for mnt in proc sys run ; do umount -n $mnt done +echo "Switching root...." unset BOOT_IMAGE initrd [ "x$SPLASH" == "x1" -a "x$DEBUG" != "x1" ] && plymouth update-root-fs --new-root-dir=/mnt # new style of pivoting (switch_root or run-init) diff --git a/remote/rootfs/rootfs-stage31/rootfs-stage31.build b/remote/rootfs/rootfs-stage31/rootfs-stage31.build index e660b0ff..9030e972 100644 --- a/remote/rootfs/rootfs-stage31/rootfs-stage31.build +++ b/remote/rootfs/rootfs-stage31/rootfs-stage31.build @@ -21,12 +21,11 @@ build() { post_copy() { generate_rootfs copy_kernel_modules - generate_modules_map_files copy_firmware # copy busybox that has been under /openslx back to / cp -r "${TARGET_BUILD_DIR}"/openslx/* "${TARGET_BUILD_DIR}" - #rm -rf "${TARGET_BUILD_DIR}/openslx" + rm -rf "${TARGET_BUILD_DIR}/openslx" } # @@ -46,75 +45,5 @@ generate_rootfs() { # copy required files tarcopy "${REQUIRED_FILES}" "${TARGET_BUILD_DIR}" - - # copy static data - cp -r "${MODULE_DIR}"/data/* "${TARGET_BUILD_DIR}" -} - -copy_kernel_modules() { - - local MODLIST="stage31_modules_list" - [ -e $MODLIST ] && rm -f $MODLIST - - # process modules list - for MOD in ${REQUIRED_KERNEL_MODULES}; do - local MOD_PATH="/lib/modules/${KERNEL_VERSION}/${MOD}" - if [ ! -e "${MOD_PATH}" ]; then - pwarning "Module $MOD not found. Skipping. (might cause problem on certain clients!)" - continue - else - pdebug "Copying "${MOD_PATH}"" - echo "${MOD_PATH}" >> "${MODLIST}" - fi - done - - if [ -s "$MODLIST" ]; then - local MODLISTCOUNT=$(cat "$MODLIST" | wc -l) - pinfo "Copying $MODLISTCOUNT modules to stage 3.1 target directory." - tarcopy "$(cat "$MODLIST")" "${TARGET_BUILD_DIR}" - fi - rm -rf $MODLIST } -generate_modules_map_files() { - - # first strip modules.order of all the modules we don't use - cat /lib/modules/"${KERNEL_VERSION}"/modules.order | grep -E $(echo ${REQUIRED_KERNEL_MODULES} | tr '\ ' '|') \ - >> "${TARGET_BUILD_DIR}"/lib/modules/"${KERNEL_VERSION}"/modules.order - - # copy list of builtin kernel modules - cp /lib/modules/"${KERNEL_VERSION}"/modules.builtin "${TARGET_BUILD_DIR}"/lib/modules/"${KERNEL_VERSION}" - # with modules.order and modules.builtin, we can run depmod for the rest of the files - depmod -b "${TARGET_BUILD_DIR}" -} - -copy_firmware() { - - local FWLIST="stage31_firmware_list" - [ -e $FWLIST ] && rm -f $FWLIST - - local FW_PATH="/lib/firmware" - - # process firmware list - for FW in ${REQUIRED_FIRMWARE}; do - local FOUND=0 - if [ -e "${FW_PATH}"/"${FW}" ]; then - pdebug "Copying "${FW_PATH}"/"${FW}"" - echo "${FW_PATH}"/"${FW}" >> "$FWLIST" - FOUND=1 - fi - if [ -e "${FW_PATH}"/"${KERNEL_VERSION}"/"${FW}" ]; then - pdebug "Copying "${FW_PATH}"/"${KERNEL_VERSION}"/"${FW}"" - echo "${FW_PATH}"/"${KERNEL_VERSION}"/"${FW}" >> "$FWLIST" - FOUND=1 - fi - [ $FOUND -ne 1 ] && pwarning "Neither "${FW_PATH}"/"${FW}" nor "${FW_PATH}"/"${KERNEL_VERSION}"/"${FW}" found on the system." - done - - if [ -s "${FWLIST}" ]; then - local FWLISTCOUNT=$(cat "$FWLIST"|wc -l) - pinfo "Copying $FWLISTCOUNT firmware to stage 3.1 target directory." - tarcopy "$(cat "$FWLIST")" "${TARGET_BUILD_DIR}" - fi - rm -f $FWLIST -} diff --git a/remote/rootfs/rootfs-stage31/rootfs-stage31.conf b/remote/rootfs/rootfs-stage31/rootfs-stage31.conf index eb97a472..bb365d5f 100644 --- a/remote/rootfs/rootfs-stage31/rootfs-stage31.conf +++ b/remote/rootfs/rootfs-stage31/rootfs-stage31.conf @@ -1,6 +1,6 @@ REQUIRED_MODULES=" busybox" -REQUIRED_DEPENDENCIES="" -REQUIRED_BINARIES=" v86d" +#REQUIRED_DEPENDENCIES=" v86d" +#REQUIRED_BINARIES=" v86d" REQUIRED_KERNEL_MODULES=" kernel/drivers/video/sis/sisfb.ko kernel/drivers/video/via/viafb.ko kernel/drivers/video/uvesafb.ko @@ -23,6 +23,9 @@ REQUIRED_KERNEL_MODULES=" kernel/drivers/video/sis/sisfb.ko kernel/drivers/gpu/drm/r128/r128.ko kernel/drivers/gpu/drm/vmwgfx/vmwgfx.ko kernel/drivers/i2c/algos/i2c-algo-bit.ko + kernel/drivers/i2c/i2c-core.ko + kernel/drivers/usb/usb-common.ko + kernel/drivers/usb/core/usbcore.ko kernel/drivers/net/netconsole.ko kernel/drivers/net/ethernet/realtek/8139too.ko kernel/drivers/net/ethernet/realtek/r8169.ko @@ -50,10 +53,12 @@ REQUIRED_KERNEL_MODULES=" kernel/drivers/video/sis/sisfb.ko kernel/fs/fscache/fscache.ko kernel/fs/lockd/lockd.ko kernel/fs/squashfs/squashfs.ko + kernel/fs/xfs/xfs.ko kernel/net/sunrpc/sunrpc.ko kernel/net/sunrpc/auth_gss/auth_rpcgss.ko kernel/net/802/stp.ko kernel/net/bridge/bridge.ko + kernel/ubuntu/aufs/aufs.ko kernel/fs/aufs/aufs.ko" REQUIRED_FIRMWARE=" 3com/ e100/ diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.build b/remote/rootfs/rootfs-stage32/rootfs-stage32.build index c704752b..a14bdfa4 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.build +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.build @@ -8,18 +8,19 @@ build() { FILELIST="list_binaries_and_files" [ -e "${FILELIST}" ] && rm "${FILELIST}" + pinfo "Searching binaries from config file in system..." for BIN in ${REQUIRED_BINARIES} do BIN_LOCATION=$(which ${BIN}) if [ ! -z ${BIN_LOCATION} -a -e ${BIN_LOCATION} ]; then - pdebug "Processing $BIN at $BIN_LOCATION ..." get_link_chain ${BIN_LOCATION} >> "${FILELIST}" else perror "${BIN} not found on the system! Please install it." fi done + pinfo "Searching libraries from config file in system... (could take some time)" for LIB in ${REQUIRED_LIBRARIES} do for LIB_LOCATION in $(find /lib/ -name "${LIB}.so*") @@ -27,7 +28,7 @@ build() { get_link_chain "${LIB_LOCATION}" >> "${FILELIST}" done done - + for FILE in ${REQUIRED_DIRECTORIES} do [ ! -d ${FILE} ] && perror "Missing required directory $FILE" @@ -66,7 +67,10 @@ post_copy() { echo "# no configuration" >> "${TARGET_BUILD_DIR}/etc/fstab" # link /etc/mtab, needed for systemd - [ ! -e ${TARGET_BUILD_DIR}/etc/mtab ] && ln -s /proc/self/mounts ${TARGET_BUILD_DIR}/etc/mtab + [ ! -e "${TARGET_BUILD_DIR}/etc/mtab" ] && ln -s "/proc/self/mounts" "${TARGET_BUILD_DIR}/etc/mtab" + + # need a /bin/sh + [ ! -e "$TARGET_BUILD_DIR/bin/sh" ] && ln -s "bash" "$TARGET_BUILD_DIR/bin/sh" # passwd, group, shadow init_users_and_groups @@ -80,21 +84,18 @@ post_copy() { mkdir -p ${TARGET_BUILD_DIR}/root echo "minilinux-$(hostname)" > "${TARGET_BUILD_DIR}/etc/hostname" - #check for kernel modules, if not present copy from system - if [ ! -d ${TARGET_BUILD_DIR}/lib/modules ]; - then - pinfo "Copying modules for kernel $(uname -r)..." - mkdir -p "${TARGET_BUILD_DIR}/lib/modules" || perror "Cannot create '${TARGET_BUILD_DIR}/lib/modules'" - cp -r "/lib/modules/$(uname -r)" "${TARGET_BUILD_DIR}/lib/modules/" || perror "Cannot copy kernel modules from '/lib/modules/$(uname -r)' '${TARGET_BUILD_DIR}/lib/modules/'" + # check for kernel modules, if not present copy from system + if [ ! -d ${TARGET_BUILD_DIR}/lib/modules ]; then + pinfo "Copying modules for kernel ${KERNEL_VERSION}..." + copy_kernel_modules else - pinfo "Not copying kernel modules from system, as '${TARGET_BUILD_DIR}/lib/modules/' already exists." + pinfo "Not copying kernel modules from system, as '${TARGET_BUILD_DIR}/lib/modules' already exists." fi - #check for firmware, if not present copy from system - if [ ! -d ${TARGET_BUILD_DIR}/lib/firmware ]; - then - pinfo "Copying firmware for kernel $(uname -r)..." - cp -r "/lib/firmware" "${TARGET_BUILD_DIR}/lib/" || perror "Cannot copy kernel modules from '/lib/firmware' '${TARGET_BUILD_DIR}/lib/'" + # check for firmware, if not present copy from system + if [ ! -d ${TARGET_BUILD_DIR}/lib/firmware ]; then + pinfo "Copying firmware for kernel ${KERNEL_VERSION}..." + copy_firmware else pinfo "Not copying firmware from system, as '${TARGET_BUILD_DIR}/lib/firmware' already exists." fi diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf index 9f8f822d..7900ec5c 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf @@ -1,5 +1,8 @@ REQUIRED_DEPENDENCIES="nfs-common aufs-tools squashfs-tools whois" -REQUIRED_BINARIES=" bash +REQUIRED_BINARIES=" sh + bash + more + less agetty cat false @@ -12,13 +15,15 @@ REQUIRED_BINARIES=" bash mount.nfs4 umount.nfs4 mount.aufs + fdisk rm blkid modprobe ps scp ssh - xterm" + xterm + ckbcomp" REQUIRED_LIBRARIES=" libcap libcidn libcom_err @@ -54,4 +59,176 @@ REQUIRED_FILES=" /etc/environment /etc/services /etc/networks /etc/netconfig - /etc/modprobe.d/blacklist.conf" + /etc/modprobe.d/blacklist.conf + /etc/fonts/fonts.conf" +REQUIRED_KERNEL_MODULES=" kernel/drivers/cpufreq + kernel/drivers/memstick + kernel/drivers/mfd + kernel/drivers/gpio + kernel/drivers/block + kernel/drivers/uwb + kernel/drivers/w1 + kernel/drivers/regulator + kernel/drivers/leds + kernel/drivers/firmware + kernel/drivers/watchdog + kernel/drivers/media/rc + kernel/drivers/media/video + kernel/drivers/media/common + kernel/drivers/mmc + kernel/drivers/staging + kernel/drivers/firewire + kernel/drivers/bluetooth + kernel/drivers/power + kernel/drivers/video + kernel/drivers/uio + kernel/drivers/md + kernel/drivers/virtio + kernel/drivers/pci + kernel/drivers/acpi + kernel/drivers/input + kernel/drivers/ssb + kernel/drivers/spi + kernel/drivers/crypto + kernel/drivers/bcma + kernel/drivers/nfc + kernel/drivers/usb + kernel/drivers/char + kernel/drivers/vhost + kernel/drivers/i2c + kernel/drivers/ata + kernel/drivers/tty + kernel/drivers/parport + kernel/drivers/misc + kernel/drivers/scsi + kernel/drivers/auxdisplay + kernel/drivers/target + kernel/drivers/dca + kernel/drivers/dma + kernel/drivers/rtc + kernel/drivers/pps + kernel/drivers/hid + kernel/drivers/atm + kernel/drivers/platform + kernel/drivers/edac + kernel/drivers/hv + kernel/drivers/idle + kernel/drivers/xen + kernel/ubuntu/aufs + kernel/arch + kernel/lib + kernel/fs + kernel/crypto + kernel/net + kernel/sound" +REQUIRED_FIRMWARE=" 3com + acenic + adaptec + advansys + ar3k + asihpi + av7110 + bnx2 + bnx2x + brcm + cis + cpia2 + cxgb3 + cxgb4 + dabusb + dsp56k + e100 + ea + edgeport + emi26 + emi62 + ene-ub6250 + ess + hp + isci + kaweth + keyspan + keyspan_pda + korg + libertas + matrox + mrvl + mwl8k + ositech + r128 + radeon + RTL8192E + RTL8192SE + rtl_nic + sb16 + scripts + slicoss + sun + sxg + tehuti + ti-connectivity + tigon + ttusb-budget + ueagle-atm + usbdux + vicam + vxge + yam + yamaha + agere_ap_fw.bin + agere_sta_fw.bin + aic94xx-seq.fw + ath3k-1.fw + atmel_at76c502_3com.bin + atmel_at76c502.bin + atmel_at76c502d.bin + atmel_at76c502e.bin + atmel_at76c504_2958.bin + atmel_at76c504a_2958.bin + atmel_at76c504.bin + atmel_at76c506.bin + atmsar11.fw + carl9170-1.fw + f2255usb.bin + GPL-3 + htc_7010.fw + htc_9271.fw + i2400m-fw-usb-1.4.sbcf + i2400m-fw-usb-1.5.sbcf + i6050-fw-usb-1.5.sbcf + intelliport2.bin + lbtf_usb.bin + lgs8g75.fw + mts_cdma.fw + mts_edge.fw + mts_gsm.fw + mts_mt9234mu.fw + mts_mt9234zba.fw + mwl8335_duplex.fw + NPE-B + NPE-C + phanfw.bin + rt2561.bin + rt2561s.bin + rt2661.bin + rt2860.bin + rt2870.bin + rt3070.bin + rt3071.bin + rt3090.bin + rt73.bin + s2250.fw + s2250_loader.fw + TDA7706_OM_v2.5.1_boot.txt + TDA7706_OM_v3.0.2_boot.txt + ti_3410.fw + ti_5052.fw + tlg2300_firmware.bin + tr_smctr.bin + usbduxfast_firmware.bin + usbdux_firmware.bin + usbduxsigma_firmware.bin + vntwusb.fw + WHENCE.ubuntu + whiteheat.fw + whiteheat_loader.fw" diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper index 084bff5c..02fb3b4b 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper @@ -39,7 +39,8 @@ REQUIRED_LIBRARIES=" libcap libresolv libau" REQUIRED_DIRECTORIES=" /etc/pam.d - /etc/security" + /etc/security + /lib/security" REQUIRED_FILES=" /etc/environment /etc/pam.conf /etc/issue @@ -54,3 +55,175 @@ REQUIRED_FILES=" /etc/environment /etc/services /etc/networks /etc/netconfig" +REQUIRED_KERNEL_MODULES=" kernel/drivers/cpufreq + kernel/drivers/memstick + kernel/drivers/mfd + kernel/drivers/gpio + kernel/drivers/block + kernel/drivers/uwb + kernel/drivers/w1 + kernel/drivers/regulator + kernel/drivers/leds + kernel/drivers/firmware + kernel/drivers/watchdog + kernel/drivers/media/rc + kernel/drivers/media/video + kernel/drivers/media/common + kernel/drivers/mmc + kernel/drivers/staging + kernel/drivers/firewire + kernel/drivers/bluetooth + kernel/drivers/power + kernel/drivers/video + kernel/drivers/uio + kernel/drivers/md + kernel/drivers/virtio + kernel/drivers/pci + kernel/drivers/acpi + kernel/drivers/input + kernel/drivers/ssb + kernel/drivers/spi + kernel/drivers/crypto + kernel/drivers/bcma + kernel/drivers/nfc + kernel/drivers/usb + kernel/drivers/char + kernel/drivers/vhost + kernel/drivers/i2c + kernel/drivers/ata + kernel/drivers/tty + kernel/drivers/parport + kernel/drivers/misc + kernel/drivers/scsi + kernel/drivers/auxdisplay + kernel/drivers/target + kernel/drivers/dca + kernel/drivers/dma + kernel/drivers/rtc + kernel/drivers/pps + kernel/drivers/hid + kernel/drivers/atm + kernel/drivers/platform + kernel/drivers/edac + kernel/drivers/hv + kernel/drivers/idle + kernel/drivers/xen + kernel/ubuntu/aufs + kernel/arch + kernel/lib + kernel/fs + kernel/crypto + kernel/net + kernel/sound" +REQUIRED_FIRMWARE=" 3com + acenic + adaptec + advansys + ar3k + asihpi + av7110 + bnx2 + bnx2x + brcm + cis + cpia2 + cxgb3 + cxgb4 + dabusb + dsp56k + e100 + ea + edgeport + emi26 + emi62 + ene-ub6250 + ess + hp + isci + kaweth + keyspan + keyspan_pda + korg + libertas + matrox + mrvl + mwl8k + ositech + r128 + radeon + RTL8192E + RTL8192SE + rtl_nic + sb16 + scripts + slicoss + sun + sxg + tehuti + ti-connectivity + tigon + ttusb-budget + ueagle-atm + usbdux + vicam + vxge + yam + yamaha + agere_ap_fw.bin + agere_sta_fw.bin + aic94xx-seq.fw + ath3k-1.fw + atmel_at76c502_3com.bin + atmel_at76c502.bin + atmel_at76c502d.bin + atmel_at76c502e.bin + atmel_at76c504_2958.bin + atmel_at76c504a_2958.bin + atmel_at76c504.bin + atmel_at76c506.bin + atmsar11.fw + carl9170-1.fw + f2255usb.bin + GPL-3 + htc_7010.fw + htc_9271.fw + i2400m-fw-usb-1.4.sbcf + i2400m-fw-usb-1.5.sbcf + i6050-fw-usb-1.5.sbcf + intelliport2.bin + lbtf_usb.bin + lgs8g75.fw + mts_cdma.fw + mts_edge.fw + mts_gsm.fw + mts_mt9234mu.fw + mts_mt9234zba.fw + mwl8335_duplex.fw + NPE-B + NPE-C + phanfw.bin + rt2561.bin + rt2561s.bin + rt2661.bin + rt2860.bin + rt2870.bin + rt3070.bin + rt3071.bin + rt3090.bin + rt73.bin + s2250.fw + s2250_loader.fw + TDA7706_OM_v2.5.1_boot.txt + TDA7706_OM_v3.0.2_boot.txt + ti_3410.fw + ti_5052.fw + tlg2300_firmware.bin + tr_smctr.bin + usbduxfast_firmware.bin + usbdux_firmware.bin + usbduxsigma_firmware.bin + vntwusb.fw + WHENCE.ubuntu + whiteheat.fw + whiteheat_loader.fw" + diff --git a/remote/setup_target b/remote/setup_target index e7370b1b..ade57c8b 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -19,22 +19,6 @@ initial_checks () { } -copy_kernel() { - - local KERNEL_VER="vmlinuz-$(uname -r)" - [ -e "${KERNEL_DIR}/${KERNEL_VER}" ] && return - - local TOOL_STR="$TOOL_STR copy_kernel:" - - [ ! -d "${KERNEL_DIR}" ] && mkdir -p ${KERNEL_DIR} - - pinfo "New kernel found. Copying '${KERNEL_VER}' to '${KERNEL_DIR}'." - pinfo "You may want to update your systems firmware/modules to match the current kernel." - - cp "/boot/${KERNEL_VER}" "${KERNEL_DIR}" || perror "Cannot copy kernel from '/boot/${KERNEL_VER}' to '${KERNEL_DIR}'" - -} - read_config () { # unset previous variables from other config files @@ -44,14 +28,12 @@ read_config () { local MODULE_CONFIG="${MODULE_DIR}/${MODULE}.conf" + # otherwise, use the generic one + [ ! -e "${MODULE_CONFIG}" ] && perror "Config for '$MODULE' not found." + . "${MODULE_CONFIG}" || perror "Sourcing '${MODULE_CONFIG}' failed." if [ -e "${MODULE_CONFIG}.${PACKET_MANAGER}" ]; then - # a specific tool.conf seems to exist, try to use that one - # TODO: Maybe move this down right after loading the generic one, to allow "overloading".... but might be a bit confusing + # a specific tool.conf seems to exist, use it to override certain vars . "${MODULE_CONFIG}.${PACKET_MANAGER}" || perror "Sourcing '${MODULE_CONFIG}.${PACKET_MANAGER}' failed." - else - # otherwise, use the generic one - [ ! -e "${MODULE_CONFIG}" ] && perror "Config for '$MODULE' not found." - . "${MODULE_CONFIG}" || perror "Sourcing '${MODULE_CONFIG}' failed." fi } @@ -77,25 +59,31 @@ copy_files_with_deps () { for FILENAME in ${REQUIRED_BINARIES} do local FILE_CANDIDATES=$( find . -name "${FILENAME}" -a \( -type f -o -type l \) ) - pdebug "Candidates for $FILENAME are: $FILE_CANDIDATES" - local FINAL_LIST="" - for FILE in $FILE_CANDIDATES; do - local TESTFILE="$(readlink -f "$FILE")" - pdebug " $FILE leads to $TESTFILE" - [ -f "$TESTFILE" -a -x "$TESTFILE" ] && [ "x$(grep -l -E '^(.ELF|#!)' "$TESTFILE")" != "x" ] && FINAL_LIST="$FINAL_LIST $FILE" - done - FINAL_LIST=$(trim "$FINAL_LIST") - pdebug " Final list is $FINAL_LIST" - if [ -z "$FINAL_LIST" ]; then - pwarning "\tNo Binary found for ${FILENAME}. Skipping." - continue - fi - if [[ "$FINAL_LIST" == *" "* ]]; then - pwarning "Found more than one match for required file '$FILENAME': $FINAL_LIST" + # only do if more than one candidate found + if [ $(echo $FILE_CANDIDATES | wc -w) -gt 1 ]; then + pdebug "Candidates for $FILENAME are: $(echo $FILE_CANDIDATES)" + local FINAL_LIST="" + for FILE in $FILE_CANDIDATES; do + local TESTFILE="$(readlink -f "$FILE")" + pdebug " $FILE leads to $TESTFILE" + [ -f "$TESTFILE" -a -x "$TESTFILE" ] && [ "x$(grep -l -E '^(.ELF|#!)' "$TESTFILE")" != "x" ] && FINAL_LIST="$FINAL_LIST $FILE" + done + FINAL_LIST=$(trim "$FINAL_LIST") + if [ -z "$FINAL_LIST" ]; then + pwarning "\tNo Binary found for ${FILENAME}. Skipping." + continue + fi + if [[ "$FINAL_LIST" == *" "* ]]; then + pwarning "Found more than one match for required file '$FILENAME': $FINAL_LIST" + else + pdebug "\tFound ${FILENAME} at ${FILE}" + fi else - pdebug "\tFound ${FILENAME} at ${FILE}" + # one candidate + FINAL_LIST=${FILE_CANDIDATES} fi for FILE in $FINAL_LIST; do + pdebug "* $FILE" strip $FILE || pwarning "Could not strip '${FILE}'" get_link_chain "${MODULE_BUILD_DIR}/${FILE}" "${MODULE_BUILD_DIR}" >> "${COPYFILES_LIST}" get_dynamic_dependencies -l "${MODULE_BUILD_DIR}" "${FILE}" >> "${COPYFILES_LIST}" @@ -118,11 +106,11 @@ copy_files_with_deps () { local CURRENT_PWD=$(pwd) # Prevent calling pwd 50000 times inside the loop below for ENTRY in ${REQUIRED_DIRECTORIES} do - pdebug "* ./$ENTRY" + pdebug "* .$ENTRY" echo "./${ENTRY}" >> "${COPYFILES_LIST}" - for BIN in $(find "./${ENTRY}" -type f -not -name '*.a' | xargs grep -l '^.ELF') + for BIN in $(find ".${ENTRY}" -type f -not -name '*.a' | xargs grep -l '^.ELF') do - pdebug " Searching libs for ${BIN}..." + #pdebug "\tSearching libs for ${BIN}..." get_link_chain "${MODULE_BUILD_DIR}/${BIN}" "${MODULE_BUILD_DIR}" >> "${COPYFILES_LIST}" get_dynamic_dependencies -l "${MODULE_BUILD_DIR}" "${BIN}" >> "${COPYFILES_LIST}" done @@ -137,7 +125,7 @@ copy_files_with_deps () { #copy to initramfsdir - pdebug "[stage32] File list generated at ${MODULE_BUILD_DIR}/${COPYFILES_LIST}." + pdebug "File list generated at ${MODULE_BUILD_DIR}/${COPYFILES_LIST}." if [ -s "$COPYFILES_LIST" ]; then local CLISTCOUNT=$(cat "$COPYFILES_LIST" | wc -l) pinfo "Copying $CLISTCOUNT files to '${TARGET_BUILD_DIR}'." @@ -150,9 +138,12 @@ generate_target() { initial_checks copy_kernel - TARGET=$1 + TARGET=$1 && shift TARGET_DIR="${MODE_DIR}/targets/${TARGET}" TARGET_BUILD_DIR="${MODE_DIR}/builds/${TARGET}" + [ -d "$TARGET_BUILD_DIR" ] && TARGET_BUILD_SIZE=$(du -bc "${TARGET_BUILD_DIR}" | awk 'END {print $1}') || TARGET_BUILD_SIZE=0 + [ -e "${ROOT_DIR}/logs/${TARGET}.size" ] && . "${ROOT_DIR}/logs/${TARGET}.size" || echo "declare -A BUILD_SIZE" >> "${ROOT_DIR}/logs/${TARGET}.size" + [ -d $TARGET_DIR ] || perror "Given target directory does not exist: $TARGET_DIR" [[ $TARGET == builds || $TARGET == modules ]] && \ @@ -161,7 +152,7 @@ generate_target() { pinfo "Generating '$TARGET_BUILD_DIR' for '$TARGET'" # if no arguments assume all. - if [ "x$2" = "x" -o "x$2" = "xall" ]; then + if [ "x$1" = "x" -o "x$1" = "xall" ]; then MODULES=$(ls ${TARGET_DIR}) set -- $MODULES else @@ -181,6 +172,7 @@ generate_target() { process_module "$1" shift done + pinfo "Target completed. Total size: $(du -bsh "${TARGET_BUILD_DIR}" | awk 'END {print $1}')" TOOL_STR="" } @@ -219,22 +211,22 @@ process_module() { pinfo "## Installing dependencies" install_dependencies pinfo "## Fetching source" - fetch_source + [ -e "${MODULE_DIR}/.fetched_source" ] || { fetch_source && touch "${MODULE_DIR}/.fetched_source"; } pinfo "## Building" - build + [ -e "${MODULE_DIR}/.built" ] || { build && touch "${MODULE_DIR}/.built"; } # remove *.la files as they might confuse libtool/linker of other tool packages - find "${MODULE_DIR}/build" -name '*.la' -exec rm -f {} \; + find "${MODULE_BUILD_DIR}" -name '*.la' -exec rm -f {} \; pinfo "## Copying files with dependencies" copy_files_with_deps pinfo "## Copying static module files" copy_static_data pinfo "## Post copy" post_copy - # reset pipes #[ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- # TODO - pinfo "Module completed." + calc_size #sets MODULE_BUILD_SIZE and TARGET_BUILD_SIZE + pinfo "Module completed. Total size: ${MODULE_BUILD_SIZE}" else pwarning "Module directory for '$MODULE' not found." fi @@ -278,6 +270,9 @@ clean_module() { if [ -d ${MODULE_DIR}/src ]; then rm -rf "${MODULE_DIR}/src" || perror "Could not delete src path" fi + if [ -e ${MODULE_DIR}/list_dpkg_output ]; then + rm "${MODULE_DIR}/list_dpkg_output" || perror "Could not delete list_dpkg_output" + fi if [ -e ${MODULE_DIR}/list_binaries_and_files ]; then rm "${MODULE_DIR}/list_binaries_and_files" || perror "Could not delete list_binaries_and_files" fi diff --git a/remote/targets/stage31/hwinfo b/remote/targets/stage31/hwinfo deleted file mode 120000 index 6007a018..00000000 --- a/remote/targets/stage31/hwinfo +++ /dev/null @@ -1 +0,0 @@ -../../modules/hwinfo
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/busybox b/remote/targets/stage32-lightdm/busybox new file mode 120000 index 00000000..4f45cedf --- /dev/null +++ b/remote/targets/stage32-lightdm/busybox @@ -0,0 +1 @@ +../../modules/busybox
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/consolekit b/remote/targets/stage32-lightdm/consolekit new file mode 120000 index 00000000..261968c7 --- /dev/null +++ b/remote/targets/stage32-lightdm/consolekit @@ -0,0 +1 @@ +../../modules/consolekit
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/dbus b/remote/targets/stage32-lightdm/dbus new file mode 120000 index 00000000..dd148715 --- /dev/null +++ b/remote/targets/stage32-lightdm/dbus @@ -0,0 +1 @@ +../../modules/dbus
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/debug b/remote/targets/stage32-lightdm/debug new file mode 120000 index 00000000..c05237d6 --- /dev/null +++ b/remote/targets/stage32-lightdm/debug @@ -0,0 +1 @@ +../../modules/debug
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/ldm b/remote/targets/stage32-lightdm/ldm new file mode 120000 index 00000000..0ee07888 --- /dev/null +++ b/remote/targets/stage32-lightdm/ldm @@ -0,0 +1 @@ +../../modules/ldm
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/ldm-gtk-greeter b/remote/targets/stage32-lightdm/ldm-gtk-greeter new file mode 120000 index 00000000..82ef14e4 --- /dev/null +++ b/remote/targets/stage32-lightdm/ldm-gtk-greeter @@ -0,0 +1 @@ +../../modules/ldm-gtk-greeter/
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/plymouth b/remote/targets/stage32-lightdm/plymouth new file mode 120000 index 00000000..66a16832 --- /dev/null +++ b/remote/targets/stage32-lightdm/plymouth @@ -0,0 +1 @@ +../../modules/plymouth
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/policykit b/remote/targets/stage32-lightdm/policykit new file mode 120000 index 00000000..39b77c7f --- /dev/null +++ b/remote/targets/stage32-lightdm/policykit @@ -0,0 +1 @@ +../../modules/policykit
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/rootfs-stage32 b/remote/targets/stage32-lightdm/rootfs-stage32 new file mode 120000 index 00000000..96dcbb86 --- /dev/null +++ b/remote/targets/stage32-lightdm/rootfs-stage32 @@ -0,0 +1 @@ +../../rootfs/rootfs-stage32
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/rsyslogd b/remote/targets/stage32-lightdm/rsyslogd new file mode 120000 index 00000000..339d02f8 --- /dev/null +++ b/remote/targets/stage32-lightdm/rsyslogd @@ -0,0 +1 @@ +../../modules/rsyslogd
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/sshd b/remote/targets/stage32-lightdm/sshd new file mode 120000 index 00000000..56b4e4b5 --- /dev/null +++ b/remote/targets/stage32-lightdm/sshd @@ -0,0 +1 @@ +../../modules/sshd
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/systemd b/remote/targets/stage32-lightdm/systemd new file mode 120000 index 00000000..2dc58bd3 --- /dev/null +++ b/remote/targets/stage32-lightdm/systemd @@ -0,0 +1 @@ +../../modules/systemd
\ No newline at end of file diff --git a/remote/targets/stage32-lightdm/xorg b/remote/targets/stage32-lightdm/xorg new file mode 120000 index 00000000..a9494860 --- /dev/null +++ b/remote/targets/stage32-lightdm/xorg @@ -0,0 +1 @@ +../../modules/xorg
\ No newline at end of file diff --git a/server/export_target b/server/export_target index cb55a55f..587804d9 100755 --- a/server/export_target +++ b/server/export_target @@ -32,19 +32,24 @@ initial_checks() { local TOOL_STR="$TOOL_STR initial_checks:" #check for required tools - for BIN in squashfs-tools + for BIN in mksquashfs do local TEST=$(which ${BIN}) [ -z "${TEST}" ] && pinfo "Installing ${BIN}..." && apt-get install ${BIN} done - #setup link to remote build directory, later this directory will be rsynced or exported to this server... + [ ! -d "${SERVER_BOOT_DIR}" ] && mkdir -p "${SERVER_BOOT_DIR}" +} + +sync_remote() { + + pinfo "Synching 'remote/builds' to 'server/remote_builds'..." + #TODO setup link to remote build directory, later this directory will be rsynced or exported to this server... if [ ! -d "${SERVER_BUILD_DIR}" ]; then - [ ! -d "${REMOTE_BUILD_DIR}" ] && perror "remote 'builds' directory not foud, exiting." + [ ! -d "${REMOTE_BUILD_DIR}" ] && perror "remote 'builds' directory not found, exiting." ln -s "${REMOTE_BUILD_DIR}" "${SERVER_BUILD_DIR}" fi - [ ! -d "${SERVER_BOOT_DIR}" ] && mkdir -p "${SERVER_BOOT_DIR}" } generate_stage32() { @@ -58,7 +63,7 @@ generate_stage32() { generate_stage31() { local TOOL_STR="${TOOL_STR} generate_stage31:" - pinfo "Writing 'initramfs-${BUILD}' to '${SERVER_BOOT_DIR}'" + pinfo "Writing 'initramfs-${TARGET}' to '${SERVER_BOOT_DIR}'" generate_initramfs "${SERVER_BUILD_DIR}/${TARGET}" "." "${SERVER_BOOT_DIR}/initramfs-${TARGET}" } @@ -103,6 +108,6 @@ clean_target() { pinfo "Cleaning '${SERVER_BOOT_DIR}/${TARGET}.sqfs'..." [ -e "${SERVER_BOOT_DIR}/${TARGET}.sqfs" ] && { rm "${SERVER_BOOT_DIR}/${TARGET}.sqfs" || perror "rm failed."; } pinfo "Cleaning '${SERVER_BOOT_DIR}/stage32_dqfs/mnt/${TARGET}.sqfs'..." - [ -e "${SERVER_BOOT_DIR}/stage32_dqfs/mnt/${TARGET}.sqfs" ] && { rm "${SERVER_BOOT_DIR}/stage32_dqfs/mnt/${TARGET}.sqfs" || perror "rm failed."; } + [ -e "${SERVER_BOOT_DIR}/stage32_sqfs/mnt/${TARGET}.sqfs" ] && { rm "${SERVER_BOOT_DIR}/stage32_sqfs/mnt/${TARGET}.sqfs" || perror "rm failed."; } } |
