diff options
| -rwxr-xr-x[-rw-r--r--] | server/build_core | 60 | ||||
| -rwxr-xr-x | server/build_core2 | 68 |
2 files changed, 32 insertions, 96 deletions
diff --git a/server/build_core b/server/build_core index e761eb2e..69687454 100644..100755 --- a/server/build_core +++ b/server/build_core @@ -17,48 +17,52 @@ # /srv/openslx/build # in the future the prefix should be set via slxsettings ... -SLXPREFIX=/srv/openslx -IRTARGET=${SLXPREFIX}/build/$1 + +ROOT_DIR=$(dirname $(readlink -f $0)) +SELF=$(readlink -f $0) + +if [ "x$(whoami)" != "xroot" ]; then + echo "ERROR: You need to have root rights to install packages." + exit 1 +fi # add openslx distro (in)dependent data to the initramfs target DISTRONAME=ubuntu DISTROVER=12.04 -for content in ${SLXPREFIX}/core/base - ${SLXPREFIX}/core/${DISTRONAME}/base - ${SLXPREFIX}/core/${DISTRONAME}/${DISTROVER} ; do - cp -a $content ${IRTARGET} -done - -# add kernel stuff to the initramfs target -KERNELVER= -mkdir -p ${IRTARGET}/lib/modules -cp -a ${SLXPREFIX}/kernel/${KERNELVER}/modules \ - ${IRTARGET}/lib/modules/${KERNELVER} +STAGE31_DIR=${ROOT_DIR}/stage3.1 +STAGE32_DIR=${ROOT_DIR}/../remote/stage3.2 # produce stage3.1 -mkdir -p ${IRTARGET}/stage3.1 +#mkdir -p ${STAGE31_DIR} -# create the base directory structure for stage3.1 -mkdir -p ${IRTARGET}/stage3.1/{bin,dev,proc,run,lib,etc,mnt,sys} -cp -a /dev/{console,kmsg,mem,null,tty,tty0,tty1,tty9,urandom,zero} \ - ${IRTARGET}/stage3.1/dev -cp ${IRTARGET}/openslx/bin/busybox ${IRTARGET}/stage3.1/bin +#Copy Busybox to Stage3.1 +#[ ! -e ${STAGE32_DIR/openslx/bin/busybox} ] && echo "Busybox not found under stage3.2/openslx. Please run setup_tools first." && return + +#cp ${STAGE32_DIR}/openslx/bin/busybox ${STAGE31_DIR}/bin # link the required busybox applets for stage3.1 -for app in insmod modprobe mount mkdir umount sh switch_root ; do - ln -s /bin/busybox ${IRTARGET}/stage3.1/bin/${app} -done +#for app in insmod modprobe mount mkdir umount sh switch_root ; do +# ln -s /bin/busybox ${IRTARGET}/stage3.1/bin/${app} +#done + +# copy stage3.1 base from data directory +[ ! -d ${ROOT_DIR}/../data/stage3.1 ] && echo "No stage3.1 directory found." && exit 1 +cp -a ${ROOT_DIR}/../data/stage3.1 ${ROOT_DIR} -# add the static stuff for stage3.1 -cp -a ${SLXPREFIX}/core/stage3.1 ${IRTARGET}/stage3.1 +# create the base directory structure for stage3.2 +mkdir -p ${STAGE32_DIR}/{bin,dev,proc,run,lib,etc,mnt,sys} +cp -a /dev/{console,kmsg,mem,null,tty,tty0,tty1,tty9,urandom,zero} \ + ${STAGE32_DIR}/dev # finalize the initramfs target -which mksquashfs 2>&1>/dev/null || { echo "Please install SquashFS utilities" ; exit 1 } +which mksquashfs 2>&1>/dev/null || echo "Please install SquashFS utilities" -mksquashfs -ef ${IRTARGET}/stage3.1 ${IRTARGET} \ - ${IRTARGET}/stage3.1/mnt/openslx.sqfs -comp xz -b 1M -no-progress -no-recovery 2>/dev/null +[ ! -d ${STAGE32_DIR} ] && echo "No stage3.2 directory found. Please run setup_tools first." && exit 1 -(cd ${IRTARGET}/stage3.1; find . | cpio --format="newc" --create | gzip -9 > ${IRTARGET}/initramfs) +[ -e ${STAGE31_DIR}/mnt/openslx.sqfs ] && rm ${STAGE31_DIR}/mnt/openslx.sqfs +mksquashfs ${STAGE32_DIR} ${STAGE31_DIR}/mnt/openslx.sqfs -comp xz -b 1M -no-progress -no-recovery 2>/dev/null +cd ${STAGE31_DIR} +find . | cpio --format="newc" --create | gzip -9 > ${ROOT_DIR}/initramfs diff --git a/server/build_core2 b/server/build_core2 deleted file mode 100755 index 5bbc74dc..00000000 --- a/server/build_core2 +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# Copyright (c) 2012 - 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 feedback to feedback@openslx.org -# -# General information about OpenSLX can be found at http://openslx.org -# -# Server side script to generate stage3.1,2 initial ramfses for OpenSLX Linux -# stateless clients -############################################################################# - -# first parameter is a hash pointing to the target directory -# /srv/openslx/build - -# in the future the prefix should be set via slxsettings ... - -ROOT_DIR=$(dirname $(readlink -f $0)) -SELF=$(readlink -f $0) - -if [ "x$(whoami)" != "xroot" ]; then - echo "ERROR: You need to have root rights to install packages." - exit 1 -fi - -# add openslx distro (in)dependent data to the initramfs target -DISTRONAME=ubuntu -DISTROVER=12.04 - -STAGE31_DIR=${ROOT_DIR}/stage3.1 -STAGE32_DIR=${ROOT_DIR}/../remote/stage3.2 - -# produce stage3.1 -#mkdir -p ${STAGE31_DIR} - -# create the base directory structure for stage3.1 -#mkdir -p ${STAGE31_DIR}/{bin,dev,proc,run,lib,etc,mnt,sys} -#cp -a /dev/{console,kmsg,mem,null,tty,tty0,tty1,tty9,urandom,zero} \ -# ${STAGE31_DIR}/dev - -#Copy Busybox to Stage3.1 -#[ ! -e ${STAGE32_DIR/openslx/bin/busybox} ] && echo "Busybox not found under stage3.2/openslx. Please run setup_tools first." && return - -#cp ${STAGE32_DIR}/openslx/bin/busybox ${STAGE31_DIR}/bin - -# link the required busybox applets for stage3.1 -#for app in insmod modprobe mount mkdir umount sh switch_root ; do -# ln -s /bin/busybox ${IRTARGET}/stage3.1/bin/${app} -#done - -# copy stage3.1 base from data directory -[ ! -d ${ROOT_DIR}/../data/stage3.1 ] && echo "No stage3.1 directory found." && exit 1 -cp -a ${ROOT_DIR}/../data/stage3.1 ${ROOT_DIR} - -# finalize the initramfs target -which mksquashfs 2>&1>/dev/null || echo "Please install SquashFS utilities" - -[ ! -d ${STAGE32_DIR} ] && echo "No stage3.2 directory found. Please run setup_tools first." && exit 1 - -[ -e ${STAGE32_DIR}/mnt/openslx.sqfs ] && rm ${STAGE32_DIR}/mnt/openslx.sqfs - -mksquashfs ${STAGE32_DIR} ${STAGE31_DIR}/mnt/openslx.sqfs -comp xz -b 1M -no-progress -no-recovery 2>/dev/null - -cd ${STAGE31_DIR} -find . | cpio --format="newc" --create | gzip -9 > ${ROOT_DIR}/initramfs |
