- Add 7z archive support,
- Add multi compressor support: zip, rar and 7z, - Fix rar decompression bug !
This commit is contained in:
parent
ba8277c6c9
commit
9f7157dff9
79
nds2rm
79
nds2rm
@ -5,9 +5,9 @@
|
||||
# (C) 2009 Arnaud G. Gibert
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# $RCSfile: nds2rm,v $
|
||||
# $Revision: 1.10 $
|
||||
# $Revision: 1.11 $
|
||||
# $Name: $
|
||||
# $Date: 2009/03/30 23:24:15 $
|
||||
# $Date: 2009/04/03 21:32:14 $
|
||||
# $Author: agibert $
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
# User Config
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# Path Config
|
||||
#NDS_REPOSITORY_IN=/opt/public/nds
|
||||
NDS_REPOSITORY_IN=/opt/public/nds.new
|
||||
#NDS_REPOSITORY_IN=/opt/public/nds.new/nds.old
|
||||
@ -44,6 +45,16 @@ NDS_ROMS_IN=${NDS_REPOSITORY_IN}/roms
|
||||
NDS_ROMS_OUT=${NDS_REPOSITORY_OUT}/roms
|
||||
NDS_XML=${NDS_REPOSITORY_IN}/misc/dsrom.xml
|
||||
|
||||
# Job Parallelisation
|
||||
JOB_NB=8
|
||||
|
||||
# Compressor (zip, rar or 7z)
|
||||
#COMPRESSOR=zip
|
||||
#COMPRESSOR=rar
|
||||
COMPRESSOR=7z
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -54,11 +65,29 @@ STATS_FILE="stats.txt"
|
||||
|
||||
TMP_DIR=$(mktemp -d)
|
||||
|
||||
JOB_NB=8
|
||||
case "${COMPRESSOR}"
|
||||
in
|
||||
(zip)
|
||||
CSFX=zip
|
||||
;;
|
||||
|
||||
(rar)
|
||||
CSFX=rar
|
||||
;;
|
||||
|
||||
(7z)
|
||||
CSFX=7z
|
||||
;;
|
||||
|
||||
(*)
|
||||
echo "Error: unsuported compressor: ${COMPRESSOR} !"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
NDS_VERSION="$Name: $"
|
||||
|
||||
RNFH_REGEX=".... - .* \(.*:.*\) \[..\] \{........} <....>[-]*[0-9]*\.zip$"
|
||||
RNFH_REGEX=".... - .* \(.*:.*\) \[..\] \{........} <....>[-]*[0-9]*\.${CSFX}$"
|
||||
|
||||
reg_tab[0]="E"; # Europe
|
||||
reg_tab[1]="U"; # USA
|
||||
@ -632,9 +661,33 @@ function arc_build()
|
||||
\rm -f "${NDS_ROMS_IN}/${file}"
|
||||
fi
|
||||
|
||||
case "${COMPRESSOR}"
|
||||
in
|
||||
(zip)
|
||||
print_verbose "zipping ${rom} into ${file_name}"
|
||||
|
||||
zip -m9 "${NDS_ROMS_OUT}/${file_name}" "${rom}" >/dev/null 2>&1
|
||||
;;
|
||||
|
||||
(rar)
|
||||
print_verbose "raring ${rom} into ${file_name}"
|
||||
|
||||
rar m -m5 "${NDS_ROMS_OUT}/${file_name}" "${rom}" >/dev/null 2>&1
|
||||
;;
|
||||
|
||||
(7z)
|
||||
print_verbose "7zipping ${rom} into ${file_name}"
|
||||
|
||||
7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on -bd "${NDS_ROMS_OUT}/${file_name}" "${rom}" >/dev/null 2>&1
|
||||
\rm -f "${rom}"
|
||||
;;
|
||||
|
||||
|
||||
(*)
|
||||
echo "arc_build internal error [$COMPRESSOR] !" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
print_verbose "removing ${rom}"
|
||||
|
||||
@ -721,7 +774,13 @@ function rom_extract()
|
||||
(*.rar)
|
||||
print_verbose "extracting ${rom} from ${file}"
|
||||
|
||||
unrar p "${NDS_ROMS_IN}/${file}" > "${rom}"
|
||||
unrar p -inul "${NDS_ROMS_IN}/${file}" > "${rom}"
|
||||
;;
|
||||
|
||||
(*.7z)
|
||||
print_verbose "extracting ${rom} from ${file}"
|
||||
|
||||
7z x -so "${NDS_ROMS_IN}/${file}" > "${rom}" 2>/dev/null
|
||||
;;
|
||||
|
||||
(*.zip)
|
||||
@ -755,7 +814,7 @@ function tmp_mv()
|
||||
do
|
||||
if [[ "${file_src}" != "${NDS_ROMS_OUT}/*.tmp" ]]
|
||||
then
|
||||
file_trg=${file_src/.zip.tmp/.zip}
|
||||
file_trg=${file_src/.${CSFX}.tmp/.${CSFX}}
|
||||
|
||||
print_verbose "move ${file_src} to ${file_trg}"
|
||||
|
||||
@ -1077,7 +1136,7 @@ function suffix_mng()
|
||||
idx_old=${idx}
|
||||
status_old=${status}
|
||||
dup_id=0
|
||||
file_name="${file/) \[*/}) [${status}] {${crc}} <${fp}>.zip"
|
||||
file_name="${file/) \[*/}) [${status}] {${crc}} <${fp}>.${CSFX}"
|
||||
|
||||
dat_fp[${idx}]="${fp}"
|
||||
dat_status[${idx}]="${status}"
|
||||
@ -1090,7 +1149,7 @@ function suffix_mng()
|
||||
fi
|
||||
else
|
||||
dup_id=$((${dup_id} + 1))
|
||||
file_name="${file/) \[*/}) [${status}] {${crc}} <${fp}>-${dup_id}.zip"
|
||||
file_name="${file/) \[*/}) [${status}] {${crc}} <${fp}>-${dup_id}.${CSFX}"
|
||||
|
||||
dup_cnt=$((${dup_cnt} + 1))
|
||||
fi
|
||||
@ -1309,9 +1368,9 @@ function test_correct_mode()
|
||||
{
|
||||
if [[ ${in_place} == "yes" ]]
|
||||
then
|
||||
file_suffix=".zip.tmp"
|
||||
file_suffix=".${CSFX}.tmp"
|
||||
else
|
||||
file_suffix=".zip"
|
||||
file_suffix=".${CSFX}"
|
||||
fi
|
||||
|
||||
# Remove .tmp suffix
|
||||
|
Loading…
Reference in New Issue
Block a user