add the possibility to add extra options to the extract process for ex passwort; overwrite; ....

This commit is contained in:
Mario Fetka 2013-03-28 14:38:45 +01:00
parent 5ccde1ef58
commit d1019ad6b3
2 changed files with 11 additions and 8 deletions

View File

@ -202,9 +202,11 @@ builder_create() {
DL_EXTRACT_PATH[$i]=${INST_DIR}/CLIENT_DATA/${DL_ARCH[$i]}/${DL_EXTRACT_TO[$i]} DL_EXTRACT_PATH[$i]=${INST_DIR}/CLIENT_DATA/${DL_ARCH[$i]}/${DL_EXTRACT_TO[$i]}
local format=${DL_EXTRACT_FORMAT[$i]} local format=${DL_EXTRACT_FORMAT[$i]}
if [ -z "$format" ] ; then format="cp"; fi if [ -z "$format" ] ; then format="cp"; fi
local option=${DL_EXTRACT_OPTION[$i]}
if [ -z "$option" ] ; then option=""; fi
mkdir -p ${DL_EXTRACT_PATH[$i]} mkdir -p ${DL_EXTRACT_PATH[$i]}
process_file $format ${DL_DIST_FILE[$i]} ${DL_EXTRACT_PATH[$i]} process_file $format ${DL_DIST_FILE[$i]} ${DL_EXTRACT_PATH[$i]} $option
done done
# create winst variables # create winst variables

View File

@ -55,25 +55,26 @@ function process_file() {
local format=$1 local format=$1
local src=$2 local src=$2
local dst=$3 local dst=$3
local option=$4
log_debug "Compression format: $format" log_debug "Compression format: $format"
if [ "$format" = "cp" ]; then if [ "$format" = "cp" ]; then
cp $src $dst cp $src $dst
elif [ "$format" = "7zip" ]; then elif [ "$format" = "7zip" ]; then
$CMD_7z x -y -o$dst $src $CMD_7z x -y $option -o$dst $src
elif [ "$format" = "unzip" ]; then elif [ "$format" = "unzip" ]; then
$CMD_unzip -o $src -d $dst $CMD_unzip $option -o $src -d $dst
elif [ "$format" = "unrar" ]; then elif [ "$format" = "unrar" ]; then
$CMD_unrar x -y $src $dst $CMD_unrar x -y $option $src $dst
elif [ "$format" = "lha" ]; then elif [ "$format" = "lha" ]; then
$CMD_lha x -w=$dst $src $CMD_lha x $option -w=$dst $src
elif [ "$format" = "targz" ]; then elif [ "$format" = "targz" ]; then
$CMD_tar xzvf $src -C $dst $CMD_tar xzvf $option $src -C $dst
elif [ "$format" = "tarbz2" ]; then elif [ "$format" = "tarbz2" ]; then
$CMD_tar xjvf $src -C $dst $CMD_tar xjvf $option $src -C $dst
elif [ "$format" = "cab" ]; then elif [ "$format" = "cab" ]; then
$CMD_cabextract -d $dst $src $CMD_cabextract $option -d $dst $src
else else
fatal_error "Unknown compression format: $format" fatal_error "Unknown compression format: $format"
fi fi