mirror of https://github.com/CIRCL/Circlean
prepare the main function that will convert the files
parent
0fb50fe8ae
commit
fa2618e57e
4
TODO
4
TODO
|
@ -8,13 +8,13 @@ TODO
|
||||||
* Starting process should be more obfuscated
|
* Starting process should be more obfuscated
|
||||||
* strip exif data and leave it in a .txt file next to the image it came from
|
* strip exif data and leave it in a .txt file next to the image it came from
|
||||||
=> exiftool
|
=> 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 source key in RO and noexec <= also nosuid and nodev
|
||||||
[OK] mount target key with noexec <= also nosuid and nodev
|
[OK] mount target key with noexec <= also nosuid and nodev
|
||||||
* convert spreadsheets in csv ?
|
* convert spreadsheets in csv ?
|
||||||
* convert documents (pdfs/*office/...) in images ?
|
* convert documents (pdfs/*office/...) in images ?
|
||||||
* Have a look at Ghostscript to work on PDFs (.pdf -> .eps -> .png?)
|
* 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
|
* take eth0 down in /etc/netowrk/interfaces or in the groomer script disable the
|
||||||
interface before anything happens
|
interface before anything happens
|
||||||
* hdmi should stay up: solveable by poking the power management timer
|
* hdmi should stay up: solveable by poking the power management timer
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
DEV_SRC='/dev/sdb'
|
DEV_SRC='/dev/sdf'
|
||||||
DEV_DST='/dev/sdc1'
|
DEV_DST='/dev/sdg1'
|
||||||
# User allowed to do the following commands without password
|
# User allowed to do the following commands without password
|
||||||
USERNAME='kitten'
|
USERNAME='kitten'
|
||||||
HOME="/home/${USERNAME}"
|
HOME="/home/${USERNAME}"
|
||||||
|
|
||||||
|
# Paths used in multiple scripts
|
||||||
|
SRC="${HOME}/src"
|
||||||
|
|
||||||
|
DST="${HOME}/dst"
|
||||||
|
TEMP="${DST}/temp"
|
||||||
|
ZIPTEMP="${DST}/ziptemp"
|
||||||
|
LOGS="${DST}/logs"
|
||||||
|
|
||||||
|
|
||||||
# commands
|
# commands
|
||||||
SUDO='/usr/bin/sudo'
|
SUDO='/usr/bin/sudo'
|
||||||
ID=`/usr/bin/id -u`
|
ID=`/usr/bin/id -u`
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
#set -x
|
||||||
|
|
||||||
source ./constraint.sh
|
source ./constraint.sh
|
||||||
if ! [ "${ID}" -ge "1000" ]; then
|
if ! [ "${ID}" -ge "1000" ]; then
|
||||||
|
@ -9,14 +9,7 @@ if ! [ "${ID}" -ge "1000" ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
source ./functions.sh
|
||||||
SRC="${HOME}/src"
|
|
||||||
DST="${HOME}/dst"
|
|
||||||
|
|
||||||
TEMP="${DST}/temp"
|
|
||||||
ZIPTEMP="${DST}/ziptemp"
|
|
||||||
LOGS="${DST}/logs"
|
|
||||||
|
|
||||||
|
|
||||||
clean(){
|
clean(){
|
||||||
echo Cleaning.
|
echo Cleaning.
|
||||||
|
@ -112,6 +105,8 @@ do
|
||||||
echo "copying to: ${target_dir}"
|
echo "copying to: ${target_dir}"
|
||||||
mkdir -p "${target_dir}"
|
mkdir -p "${target_dir}"
|
||||||
|
|
||||||
|
main ${target_dir}
|
||||||
|
|
||||||
#if [ $COPYDIRTYPDF -eq 1 ]; then
|
#if [ $COPYDIRTYPDF -eq 1 ]; then
|
||||||
# pdfCopyDirty ${SRC} $targetDir
|
# pdfCopyDirty ${SRC} $targetDir
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue