summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimon Rettberg2013-02-25 17:39:59 +0100
committerSimon Rettberg2013-02-25 17:39:59 +0100
commit8989b603a3b3478f93980bee008612374ddc0322 (patch)
treee70bc13d4bd880d76ab5421dc2df8c6bbd4608ae /server
parentMerge branch 'master' of ssh://openslx/openslx-ng/tm-scripts (diff)
downloadtm-scripts-8989b603a3b3478f93980bee008612374ddc0322.tar.gz
tm-scripts-8989b603a3b3478f93980bee008612374ddc0322.tar.xz
tm-scripts-8989b603a3b3478f93980bee008612374ddc0322.zip
fix build_core
Diffstat (limited to 'server')
-rwxr-xr-xserver/build_core27
1 files changed, 16 insertions, 11 deletions
diff --git a/server/build_core b/server/build_core
index 6d975984..411036df 100755
--- a/server/build_core
+++ b/server/build_core
@@ -26,16 +26,17 @@ STAGE32_DIR=${ROOT_DIR}/remote/stage3.2
# initial checks
initial_checks() {
- [ -d ${STAGE32_DIR} ] || perror "No stage3.2 directory found. Please run './mltk tools build' first."
+ local TOOL_STR="$TOOL_STR initial_checks:"
+ [ -d "${STAGE32_DIR}" ] || perror "No stage3.2 directory found. Please run './mltk tools build' first."
- [ -e ${STAGE32_DIR}/openslx/bin/busybox ] || perror "Busybox not found, run './mltk tools build busybox' first."
+ [ -e "${STAGE32_DIR}/openslx/bin/busybox" ] || perror "Busybox not found, run './mltk tools build busybox' first."
# shouldn't squashfs-tools be automatically installed as we need them nevertheless!?
# what if it is already on the machine? faster to check with which than the apt-get check?
- if [ -z $(which mksquashfs) ] && perror "mksquashfs not found, please install squashfs-tools first."
+ [ -z $(which mksquashfs) ] && perror "mksquashfs not found, please install squashfs-tools first."
#check for kernel modules, if not present copy from system
- if [ ! -d ${STAGE32_DIR}/lib/modules ];
+ if [ ! -d "${STAGE32_DIR}/lib/modules" ];
then
pinfo "Couldn't find kernel modules in stage3.2."
pinfo "Copying modules for kernel $(uname -r)..."
@@ -49,6 +50,7 @@ initial_checks() {
}
generate_rootfs() {
+ local TOOL_STR="$TOOL_STR generate_rootfs:"
# produce stage3.1
mkdir -p "${STAGE31_DIR}" || perror "Cannot create stage3.1 dir '${STAGE31_DIR}'"
@@ -61,7 +63,7 @@ generate_rootfs() {
"${STAGE31_DIR}"/dev || perror "Cannot copy devices from running system"
# copy busybox, its libs and static data to stage3.1
- cp -r "${STAGE32_DIR}/openslx/*" "${STAGE31_STATIC_DIR}/*" "${STAGE31_DIR}" || perror "Copying busybox, its libs and static data failed."
+ cp -r "${STAGE32_DIR}"/openslx/* "${STAGE31_STATIC_DIR}"/* "${STAGE31_DIR}" || perror "Copying busybox, its libs and static data failed."
# fix for aufs & squashfs modules needed for stage 3.1
mkdir -p "${STAGE31_DIR}/lib/modules.0/" || perror "Creating modules.0 dir for aufs & squashfs in stage 3.1 failed."
@@ -82,18 +84,20 @@ generate_rootfs() {
}
generate_squashfs() {
+ local TOOL_STR="$TOOL_STR generate_squashfs:"
# finalize the initramfs target
[ -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-recovery || perror "mksquashfs failed ($?)."
+ mksquashfs "${STAGE32_DIR}" "${STAGE31_DIR}/mnt/openslx.sqfs" -comp xz -b 1M -no-recovery >&6 || perror "mksquashfs failed ($?)."
}
generate_initramfs() {
+ local TOOL_STR="$TOOL_STR generate_initramfs:"
cd "${STAGE31_DIR}" || perror "Cannot cd to '${STAGE31_DIR}'"
find . | cpio --format="newc" --create | gzip -9 > "${MODULE_DIR}/initramfs"
- local PS=($PIPESTATUS[*])
- [ "x${PS[0]}" != "x0" ] && perror "'find .' failed."
+ local PS=(${PIPESTATUS[*]})
+ [ "x${PS[0]}" != "x0" ] && perror "'find .' in '$(pwd)' failed."
[ "x${PS[1]}" != "x0" ] && perror "cpio create failed."
[ "x${PS[2]}" != "x0" ] && perror "gzip to '${MODULE_DIR}/initramfs' failed."
cd -
@@ -108,13 +112,14 @@ generate_stage31() {
# TODO better kernel copy
cp "/boot/vmlinuz-$(uname -r)" "${MODULE_DIR}/kernel" || perror "Cannot copy kernel from '/boot/vmlinuz-$(uname -r)' to '${MODULE_DIR}/kernel'"
- pinfo "[core] kernel $(uname -r) copied to ${MODULE_DIR}/kernel"
+ pinfo "kernel $(uname -r) copied to ${MODULE_DIR}/kernel"
}
clean_core() {
+ local TOOL_STR="$TOOL_STR clean_core:"
pinfo "Cleaning '${STAGE31_DIR}'..."
- [ -d ${STAGE31_DIR} ] && { rm -rf ${STAGE31_DIR} || perror "rm -rf failed." }
+ [ -d ${STAGE31_DIR} ] && { rm -rf ${STAGE31_DIR} || perror "rm -rf failed."; }
pinfo "Cleaning '${MODULE_DIR}/initramfs'..."
- [ -e ${MODULE_DIR}/initramfs ] && { rm ${MODULE_DIR}/initramfs || perror "rm failed." }
+ [ -e ${MODULE_DIR}/initramfs ] && { rm ${MODULE_DIR}/initramfs || perror "rm failed."; }
}