From 78d96bffad10463f31db57a9543d6a533c69b529 Mon Sep 17 00:00:00 2001 From: Daniel Schwager Date: Fri, 3 Feb 2012 14:41:08 +0100 Subject: [PATCH] Improvement: commands (7z, unzip, ..) are defined by global variables now. Added checking of command's availablility. --- lib/builder-targets.sh | 10 ++++++++-- lib/builder-utils.sh | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/builder-targets.sh b/lib/builder-targets.sh index 8082a9d..ede1de1 100644 --- a/lib/builder-targets.sh +++ b/lib/builder-targets.sh @@ -10,6 +10,12 @@ #################### builder_config() { + # Define commands + CMD_7z="`which 7z`" ; builder_check_error "No 7z installed" + CMD_unzip="`which unzip`" ; builder_check_error "No unzip installed" + CMD_zip="`which zip`" ; builder_check_error "No zip installed" + + # Check temp dir test -d ${TMP_DIR} builder_check_error "temp directory not available: $TMP_DIR" @@ -232,8 +238,8 @@ builder_package() { fi # create source- and binary package package - test "${OPSI_REPOS_UPLOAD_BIN}" = "true" && zip -r ${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}.zip $INST_DIR - test "${OPSI_REPOS_UPLOAD_SOURCE}" = "true" && zip -r ${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}-src.zip ${PRODUCT_DIR} + test "${OPSI_REPOS_UPLOAD_BIN}" = "true" && $CMD_zip -r ${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}.zip $INST_DIR + test "${OPSI_REPOS_UPLOAD_SOURCE}" = "true" && $CMD_zip -r ${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}-src.zip ${PRODUCT_DIR} } diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index fc791a9..ba62596 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -57,9 +57,9 @@ function process_file() { if [ "$format" = "cp" ]; then cp $src $dst elif [ "$format" = "7zip" ]; then - 7z x -o$dst $src + $CMD_7z x -o$dst $src elif [ "$format" = "unzip" ]; then - unzip $src -d $dst + $CMD_unzip $src -d $dst else fatal_error "Unknown compression format: $format" fi