Improvement: commands (7z, unzip, ..) are defined by global variables now. Added checking of command's availablility.

This commit is contained in:
Daniel Schwager 2012-02-03 14:41:08 +01:00
parent 72c8c4b9a9
commit 78d96bffad
2 changed files with 10 additions and 4 deletions

View File

@ -10,6 +10,12 @@
#################### ####################
builder_config() { 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 # Check temp dir
test -d ${TMP_DIR} test -d ${TMP_DIR}
builder_check_error "temp directory not available: $TMP_DIR" builder_check_error "temp directory not available: $TMP_DIR"
@ -232,8 +238,8 @@ builder_package() {
fi fi
# create source- and binary package package # 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_BIN}" = "true" && $CMD_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_SOURCE}" = "true" && $CMD_zip -r ${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}-src.zip ${PRODUCT_DIR}
} }

View File

@ -57,9 +57,9 @@ function process_file() {
if [ "$format" = "cp" ]; then if [ "$format" = "cp" ]; then
cp $src $dst cp $src $dst
elif [ "$format" = "7zip" ]; then elif [ "$format" = "7zip" ]; then
7z x -o$dst $src $CMD_7z x -o$dst $src
elif [ "$format" = "unzip" ]; then elif [ "$format" = "unzip" ]; then
unzip $src -d $dst $CMD_unzip $src -d $dst
else else
fatal_error "Unknown compression format: $format" fatal_error "Unknown compression format: $format"
fi fi