Handle all text/* and office documents the same way

pull/10/head
Raphaël Vinot 2013-12-09 14:47:03 +01:00
parent ffa46ffa24
commit b9cf67e9e2
2 changed files with 13 additions and 9 deletions

View File

@ -16,6 +16,7 @@ fi
# prepare fs archive
tar -cvpzf backup.tar.gz -C fs/ .
tar -xzf backup.tar.gz -C ${CHROOT_PATH}/
chown root:root ${CHROOT_PATH}/etc/sudoers
cp deb/led ${CHROOT_PATH}/usr/sbin/led
cp -rf midi ${CHROOT_PATH}/opt/

View File

@ -19,6 +19,15 @@ error_handler(){
trap error_handler ERR TERM INT
office_n_txt(){
src_file=${1}
dst_file=${2}${1##$CURRENT_SRC}.html
temp=${2}/temp
${LO} --headless --convert-to pdf --outdir "${temp}" "${src_file}"
${PDF} --dest-dir=/ ${temp}/*.pdf ${dst_file}
rm -rf "${temp}"
}
copy(){
src_file=${1}
dst_file=${2}
@ -29,8 +38,7 @@ copy(){
# Plain text
text(){
echo Text file ${1}
# XXX: append .txt ?
copy ${1} ${2}${1##$CURRENT_SRC}
office_n_txt ${1} ${2}
}
# Multimedia
@ -83,15 +91,11 @@ application(){
# https://blogs.msdn.com/b/vsofficedeveloper/archive/2008/05/08/office-2007-open-xml-mime-types.aspx
# http://plan-b-for-openoffice.org/glossary/term/mime-type
echo "MS Office or ODF document"
temp=${2}/temp
mkdir "${temp}"
${LO} --headless --convert-to pdf --outdir "${temp}" "${src_file}"
${PDF} --dest-dir "${2}" ${temp}/*.pdf
rm -rf "${temp}"
office_n_txt ${src_file} ${2}
;;
*xml*)
echo "Got an XML"
text ${src_file} ${2}
office_n_txt ${src_file} ${2}
;;
x-dosexec)
echo "Win executable"
@ -177,7 +181,6 @@ main(){
echo -n "Processing ${file} (${mime})... " >> ${LOGFILE}
case "${main_mime}" in
"text")
text ${file} ${dest} || error_handler
;;
"audio")