mirror of https://github.com/CIRCL/Circlean
Handle all text/* and office documents the same way
parent
ffa46ffa24
commit
b9cf67e9e2
|
@ -16,6 +16,7 @@ fi
|
||||||
# prepare fs archive
|
# prepare fs archive
|
||||||
tar -cvpzf backup.tar.gz -C fs/ .
|
tar -cvpzf backup.tar.gz -C fs/ .
|
||||||
tar -xzf backup.tar.gz -C ${CHROOT_PATH}/
|
tar -xzf backup.tar.gz -C ${CHROOT_PATH}/
|
||||||
|
chown root:root ${CHROOT_PATH}/etc/sudoers
|
||||||
cp deb/led ${CHROOT_PATH}/usr/sbin/led
|
cp deb/led ${CHROOT_PATH}/usr/sbin/led
|
||||||
cp -rf midi ${CHROOT_PATH}/opt/
|
cp -rf midi ${CHROOT_PATH}/opt/
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,15 @@ error_handler(){
|
||||||
|
|
||||||
trap error_handler ERR TERM INT
|
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(){
|
copy(){
|
||||||
src_file=${1}
|
src_file=${1}
|
||||||
dst_file=${2}
|
dst_file=${2}
|
||||||
|
@ -29,8 +38,7 @@ copy(){
|
||||||
# Plain text
|
# Plain text
|
||||||
text(){
|
text(){
|
||||||
echo Text file ${1}
|
echo Text file ${1}
|
||||||
# XXX: append .txt ?
|
office_n_txt ${1} ${2}
|
||||||
copy ${1} ${2}${1##$CURRENT_SRC}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Multimedia
|
# Multimedia
|
||||||
|
@ -83,15 +91,11 @@ application(){
|
||||||
# https://blogs.msdn.com/b/vsofficedeveloper/archive/2008/05/08/office-2007-open-xml-mime-types.aspx
|
# 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
|
# http://plan-b-for-openoffice.org/glossary/term/mime-type
|
||||||
echo "MS Office or ODF document"
|
echo "MS Office or ODF document"
|
||||||
temp=${2}/temp
|
office_n_txt ${src_file} ${2}
|
||||||
mkdir "${temp}"
|
|
||||||
${LO} --headless --convert-to pdf --outdir "${temp}" "${src_file}"
|
|
||||||
${PDF} --dest-dir "${2}" ${temp}/*.pdf
|
|
||||||
rm -rf "${temp}"
|
|
||||||
;;
|
;;
|
||||||
*xml*)
|
*xml*)
|
||||||
echo "Got an XML"
|
echo "Got an XML"
|
||||||
text ${src_file} ${2}
|
office_n_txt ${src_file} ${2}
|
||||||
;;
|
;;
|
||||||
x-dosexec)
|
x-dosexec)
|
||||||
echo "Win executable"
|
echo "Win executable"
|
||||||
|
@ -177,7 +181,6 @@ main(){
|
||||||
echo -n "Processing ${file} (${mime})... " >> ${LOGFILE}
|
echo -n "Processing ${file} (${mime})... " >> ${LOGFILE}
|
||||||
case "${main_mime}" in
|
case "${main_mime}" in
|
||||||
"text")
|
"text")
|
||||||
|
|
||||||
text ${file} ${dest} || error_handler
|
text ${file} ${dest} || error_handler
|
||||||
;;
|
;;
|
||||||
"audio")
|
"audio")
|
||||||
|
|
Loading…
Reference in New Issue