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,
|
* strip back libreoffice to minimum required packages. in particular, if possible,
|
||||||
remove libreoffice-java-common package
|
remove libreoffice-java-common package
|
||||||
* Write the groomer log on the destination key
|
* 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
|
the file
|
||||||
|
* Extract metadata from all the files => https://mat.boum.org/
|
||||||
|
|
|
@ -2,50 +2,83 @@
|
||||||
|
|
||||||
source ./constraint.sh
|
source ./constraint.sh
|
||||||
|
|
||||||
|
copy(){
|
||||||
|
src_file=${1}
|
||||||
|
dst_file=${2}
|
||||||
|
mkdir -p `dirname ${dst_file}`
|
||||||
|
cp ${src_file} ${dst_file}
|
||||||
|
}
|
||||||
|
|
||||||
# Plain text
|
# Plain text
|
||||||
text(){
|
text(){
|
||||||
echo Text file ${1}
|
echo Text file ${1}
|
||||||
|
copy ${1} ${2}${1##$SRC}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Multimedia
|
# Multimedia
|
||||||
|
## WARNING: They are assumed safe.
|
||||||
audio(){
|
audio(){
|
||||||
echo Audio file ${1}
|
echo Audio file ${1}
|
||||||
|
copy ${1} ${2}${1##$SRC}
|
||||||
}
|
}
|
||||||
|
|
||||||
image(){
|
image(){
|
||||||
echo Image file ${1}
|
echo Image file ${1}
|
||||||
|
copy ${1} ${2}${1##$SRC}
|
||||||
}
|
}
|
||||||
|
|
||||||
video(){
|
video(){
|
||||||
echo Video file ${1}
|
echo Video file ${1}
|
||||||
|
copy ${1} ${2}${1##$SRC}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Random - Used
|
# Random - Used
|
||||||
|
|
||||||
application(){
|
application(){
|
||||||
echo App file ${1}
|
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(){
|
example(){
|
||||||
echo Example file ${1}
|
echo Example file ${1}
|
||||||
|
copy ${1} ${2}${1##$SRC}
|
||||||
}
|
}
|
||||||
|
|
||||||
message(){
|
message(){
|
||||||
echo Message file ${1}
|
echo Message file ${1}
|
||||||
|
copy ${1} ${2}${1##$SRC}
|
||||||
}
|
}
|
||||||
|
|
||||||
model(){
|
model(){
|
||||||
echo Model file ${1}
|
echo Model file ${1}
|
||||||
|
copy ${1} ${2}${1##$SRC}
|
||||||
}
|
}
|
||||||
|
|
||||||
multipart(){
|
multipart(){
|
||||||
echo Multipart file ${1}
|
echo Multipart file ${1}
|
||||||
|
copy ${1} ${2}${1##$SRC}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
main(){
|
main(){
|
||||||
if [ -z ${1} ]; then
|
if [ -z ${1} ]; then
|
||||||
echo "Please specify the destination directory."
|
echo "Please specify the destination directory."
|
||||||
|
@ -54,17 +87,43 @@ main(){
|
||||||
# first param is the destination dir
|
# first param is the destination dir
|
||||||
dest=${1}
|
dest=${1}
|
||||||
|
|
||||||
FILE_COMMAND='file -b --mime-type '
|
FILE_COMMAND='file -b --mime-type'
|
||||||
FILE_LIST=`find ${SRC} -type f`
|
FILE_LIST=`find ${SRC} -type f`
|
||||||
for file in ${FILE_LIST}; do
|
for file in ${FILE_LIST}; do
|
||||||
mime=`$FILE_COMMAND ${file}`
|
mime=`$FILE_COMMAND ${file}`
|
||||||
|
echo ${mime}
|
||||||
main=`echo ${mime} | cut -f1 -d/`
|
main=`echo ${mime} | cut -f1 -d/`
|
||||||
details=`echo ${mime} | cut -f2 -d/`
|
details=`echo ${mime} | cut -f2 -d/`
|
||||||
case "${main}" in
|
case "${main}" in
|
||||||
"text")
|
"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
|
echo $mime $main $details
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -120,6 +120,7 @@ do
|
||||||
|
|
||||||
# unpack and process archives
|
# unpack and process archives
|
||||||
#unpackZip ${SRC} $targetDir $TEMP
|
#unpackZip ${SRC} $targetDir $TEMP
|
||||||
|
ls -lR "${target_dir}"
|
||||||
fi
|
fi
|
||||||
let PARTCOUNT=${PARTCOUNT}+1
|
let PARTCOUNT=${PARTCOUNT}+1
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
#set -x
|
||||||
|
|
||||||
source ./constraint.sh
|
source ./constraint.sh
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
#set -x
|
||||||
|
|
||||||
if [ $# -eq 3 ]; then
|
if [ $# -eq 3 ]; then
|
||||||
if ! [ "${1}" -ge "1000" ] ; then
|
if ! [ "${1}" -ge "1000" ] ; then
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
#set -x
|
||||||
|
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
mount -o noexec,nosuid,nodev,ro "${1}" "${2}"
|
mount -o noexec,nosuid,nodev,ro "${1}" "${2}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
#set -x
|
||||||
|
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
umount $1
|
umount $1
|
||||||
|
|
Loading…
Reference in New Issue