prepare the main function that will convert the files

pull/10/head
Raphaël Vinot 2013-02-22 17:35:23 +01:00
parent 0fb50fe8ae
commit fa2618e57e
4 changed files with 90 additions and 13 deletions

4
TODO
View File

@ -8,13 +8,13 @@ TODO
* Starting process should be more obfuscated
* strip exif data and leave it in a .txt file next to the image it came from
=> exiftool
* set filesystem of OS in RO (physical switch and/or remount OS)
[Done with remount] set filesystem of OS in RO (physical switch and/or remount OS)
[OK] mount source key in RO and noexec <= also nosuid and nodev
[OK] mount target key with noexec <= also nosuid and nodev
* convert spreadsheets in csv ?
* convert documents (pdfs/*office/...) in images ?
* Have a look at Ghostscript to work on PDFs (.pdf -> .eps -> .png?)
* do not run the conversions as root -> run in chroot
[do everything as user] do not run the conversions as root -> run in chroot
* take eth0 down in /etc/netowrk/interfaces or in the groomer script disable the
interface before anything happens
* hdmi should stay up: solveable by poking the power management timer

View File

@ -1,9 +1,18 @@
DEV_SRC='/dev/sdb'
DEV_DST='/dev/sdc1'
DEV_SRC='/dev/sdf'
DEV_DST='/dev/sdg1'
# User allowed to do the following commands without password
USERNAME='kitten'
HOME="/home/${USERNAME}"
# Paths used in multiple scripts
SRC="${HOME}/src"
DST="${HOME}/dst"
TEMP="${DST}/temp"
ZIPTEMP="${DST}/ziptemp"
LOGS="${DST}/logs"
# commands
SUDO='/usr/bin/sudo'
ID=`/usr/bin/id -u`

View File

@ -0,0 +1,73 @@
#!/bin/bash
source ./constraint.sh
# Plain text
text(){
echo Text file ${1}
}
# Multimedia
audio(){
echo Audio file ${1}
}
image(){
echo Image file ${1}
}
video(){
echo Video file ${1}
}
# Random - Used
application(){
echo App file ${1}
}
# Random - Unused
example(){
echo Example file ${1}
}
message(){
echo Message file ${1}
}
model(){
echo Model file ${1}
}
multipart(){
echo Multipart file ${1}
}
main(){
if [ -z ${1} ]; then
echo "Please specify the destination directory."
exit
fi
# first param is the destination dir
dest=${1}
FILE_COMMAND='file -b --mime-type '
FILE_LIST=`find ${SRC} -type f`
for file in ${FILE_LIST}; do
mime=`$FILE_COMMAND ${file}`
main=`echo ${mime} | cut -f1 -d/`
details=`echo ${mime} | cut -f2 -d/`
case "${main}" in
"text")
text ${file}
;;
*)
echo $mime $main $details
;;
esac
done
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -e
set -x
#set -x
source ./constraint.sh
if ! [ "${ID}" -ge "1000" ]; then
@ -9,14 +9,7 @@ if ! [ "${ID}" -ge "1000" ]; then
exit
fi
SRC="${HOME}/src"
DST="${HOME}/dst"
TEMP="${DST}/temp"
ZIPTEMP="${DST}/ziptemp"
LOGS="${DST}/logs"
source ./functions.sh
clean(){
echo Cleaning.
@ -112,6 +105,8 @@ do
echo "copying to: ${target_dir}"
mkdir -p "${target_dir}"
main ${target_dir}
#if [ $COPYDIRTYPDF -eq 1 ]; then
# pdfCopyDirty ${SRC} $targetDir
#else