mirror of https://github.com/CIRCL/Circlean
comment set-x, many updates everywhere, framework ready for the conversions.
parent
fa2618e57e
commit
28c11ada8f
3
TODO
3
TODO
|
@ -25,5 +25,6 @@ TODO
|
|||
* strip back libreoffice to minimum required packages. in particular, if possible,
|
||||
remove libreoffice-java-common package
|
||||
* Write the groomer log on the destination key
|
||||
* use /etc/mime.types and file -b --mime-type <filename> to find out the type of
|
||||
[Done] use /etc/mime.types and file -b --mime-type <filename> to find out the type of
|
||||
the file
|
||||
* Extract metadata from all the files => https://mat.boum.org/
|
||||
|
|
|
@ -2,50 +2,83 @@
|
|||
|
||||
source ./constraint.sh
|
||||
|
||||
copy(){
|
||||
src_file=${1}
|
||||
dst_file=${2}
|
||||
mkdir -p `dirname ${dst_file}`
|
||||
cp ${src_file} ${dst_file}
|
||||
}
|
||||
|
||||
# Plain text
|
||||
text(){
|
||||
echo Text file ${1}
|
||||
copy ${1} ${2}${1##$SRC}
|
||||
}
|
||||
|
||||
# Multimedia
|
||||
## WARNING: They are assumed safe.
|
||||
audio(){
|
||||
echo Audio file ${1}
|
||||
copy ${1} ${2}${1##$SRC}
|
||||
}
|
||||
|
||||
image(){
|
||||
echo Image file ${1}
|
||||
copy ${1} ${2}${1##$SRC}
|
||||
}
|
||||
|
||||
video(){
|
||||
echo Video file ${1}
|
||||
copy ${1} ${2}${1##$SRC}
|
||||
}
|
||||
|
||||
# Random - Used
|
||||
|
||||
application(){
|
||||
echo App file ${1}
|
||||
src_file=${1}
|
||||
dst_file=${2}${1##$SRC}
|
||||
mime_details=${3}
|
||||
case ${mime_details} in
|
||||
"pdf")
|
||||
echo "Got a pdf"
|
||||
# WARNING: This command randomly fails, and loop indefinitely...
|
||||
pdf2ps -dSAFER -sOutputFile="%stdout" ${src_file} | ps2pdfwr - ${dst_file}
|
||||
;;
|
||||
*xml*)
|
||||
echo "Got an XML"
|
||||
text ${1} ${2}
|
||||
;;
|
||||
*)
|
||||
echo "Unknown type."
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
# Random - Unused
|
||||
# Random - Unused?
|
||||
## WARNING: They are assumed safe.
|
||||
|
||||
example(){
|
||||
echo Example file ${1}
|
||||
copy ${1} ${2}${1##$SRC}
|
||||
}
|
||||
|
||||
message(){
|
||||
echo Message file ${1}
|
||||
copy ${1} ${2}${1##$SRC}
|
||||
}
|
||||
|
||||
model(){
|
||||
echo Model file ${1}
|
||||
copy ${1} ${2}${1##$SRC}
|
||||
}
|
||||
|
||||
multipart(){
|
||||
echo Multipart file ${1}
|
||||
copy ${1} ${2}${1##$SRC}
|
||||
}
|
||||
|
||||
|
||||
|
||||
main(){
|
||||
if [ -z ${1} ]; then
|
||||
echo "Please specify the destination directory."
|
||||
|
@ -54,17 +87,43 @@ main(){
|
|||
# first param is the destination dir
|
||||
dest=${1}
|
||||
|
||||
FILE_COMMAND='file -b --mime-type '
|
||||
FILE_COMMAND='file -b --mime-type'
|
||||
FILE_LIST=`find ${SRC} -type f`
|
||||
for file in ${FILE_LIST}; do
|
||||
mime=`$FILE_COMMAND ${file}`
|
||||
echo ${mime}
|
||||
main=`echo ${mime} | cut -f1 -d/`
|
||||
details=`echo ${mime} | cut -f2 -d/`
|
||||
case "${main}" in
|
||||
"text")
|
||||
text ${file}
|
||||
text ${file} ${dest}
|
||||
;;
|
||||
"audio")
|
||||
audio ${file} ${dest}
|
||||
;;
|
||||
"image")
|
||||
image ${file} ${dest}
|
||||
;;
|
||||
"video")
|
||||
video ${file} ${dest}
|
||||
;;
|
||||
"application")
|
||||
application ${file} ${dest} ${details}
|
||||
;;
|
||||
"example")
|
||||
example ${file} ${dest}
|
||||
;;
|
||||
"message")
|
||||
message ${file} ${dest}
|
||||
;;
|
||||
"model")
|
||||
model ${file} ${dest}
|
||||
;;
|
||||
"multipart")
|
||||
multipart ${file} ${dest}
|
||||
;;
|
||||
*)
|
||||
echo "This should never happen... :]"
|
||||
echo $mime $main $details
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -120,6 +120,7 @@ do
|
|||
|
||||
# unpack and process archives
|
||||
#unpackZip ${SRC} $targetDir $TEMP
|
||||
ls -lR "${target_dir}"
|
||||
fi
|
||||
let PARTCOUNT=${PARTCOUNT}+1
|
||||
done
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
#set -x
|
||||
|
||||
source ./constraint.sh
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
#set -x
|
||||
|
||||
if [ $# -eq 3 ]; then
|
||||
if ! [ "${1}" -ge "1000" ] ; then
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
#set -x
|
||||
|
||||
if [ $# -eq 2 ]; then
|
||||
mount -o noexec,nosuid,nodev,ro "${1}" "${2}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
#set -x
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
umount $1
|
||||
|
|
Loading…
Reference in New Issue