From 6de31e562db08f507ca231d7ccf7d049ef8dfc83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Sat, 25 May 2013 00:33:58 +0200 Subject: [PATCH] doc update --- README => NOTES | 46 ---------------------------- README.md | 69 ++++++++++++++++++++++++++++++++++++++++++ copy_to_final.sh | 3 +- prepare_rPI_builder.sh | 13 ++------ proper_chroot.sh | 17 ++++++++--- update_builder.sh | 19 +++++------- 6 files changed, 93 insertions(+), 74 deletions(-) rename README => NOTES (65%) create mode 100644 README.md diff --git a/README b/NOTES similarity index 65% rename from README rename to NOTES index 90bb615..8fbd5bb 100644 --- a/README +++ b/NOTES @@ -1,49 +1,3 @@ -Why/What -======== - -This project aims to be used in case you got an USB key you do not know what is -contains but still want to have a look. - -Work in progress, contributions welcome: - -The content of the first key will be copyed or/and converted to the second key -following theses rules (based on the mime type): -- direct copy of plain text files (mime type: text/*) -- direct copy of audio files (mime type: audio/*) -- direct copy of image files (mime type: image/*) -- direct copy of video files (mime type: video/*) -- direct copy of example files (mime type: example/*) -- direct copy of message files (mime type: message/*) -- direct copy of model files (mime type: model/*) -- direct copy of multipart files (mime type: multipart/*) -- Copying or converting the application files this way (mime type: application/*): - - pdf => HTML - - msword|vnd.openxmlformats-officedocument.*|vnd.ms-*|vnd.oasis.opendocument* => pdf => html - - *xml* => copy as a text file - - x-dosexec (executable) => prepend and append DANGEROUS to the filename - - x-gzip|x-tar|x-7z-compressed => compressed file - - octet-stream => direct copy - -Compressed files (x-gzip|x-tar|x-7z-compressed): -- Unpacking of archives -- Recursively run the rules on the unpacked files - -Usage -===== - -0. Power off the device -1. Plug the untrusted key in the top usb slot of the Raspberry Pi -2. Plug your own key in the bottom usb slot - Note: This key should be bigger than the original one because the archives - will be copyed -3. Optional: connect the HDMI cable to a screen to see what happen -4. Connect the power to the micro USB -5. Wait until you do not see any blinking green light on the board, or if you - connected the HDMI cable, check the screen - it's slow and can take 30-60 minutes depending on how many document - conversions take place -6. Power off the device and disconnect the drives - Notes ===== diff --git a/README.md b/README.md new file mode 100644 index 0000000..06f5463 --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +Why/What +======== + +This project aims to be used in case you got an USB key you do not know what is +contains but still want to have a look. + +Work in progress, contributions welcome: + +The content of the first key will be copyed or/and converted to the second key +following theses rules (based on the mime type): +- direct copy of plain text files (mime type: text/*) +- direct copy of audio files (mime type: audio/*) +- direct copy of image files (mime type: image/*) +- direct copy of video files (mime type: video/*) +- direct copy of example files (mime type: example/*) +- direct copy of message files (mime type: message/*) +- direct copy of model files (mime type: model/*) +- direct copy of multipart files (mime type: multipart/*) +- Copying or converting the application files this way (mime type: application/*): + - pdf => HTML + - msword|vnd.openxmlformats-officedocument.*|vnd.ms-*|vnd.oasis.opendocument* => pdf => html + - *xml* => copy as a text file + - x-dosexec (executable) => prepend and append DANGEROUS to the filename + - x-gzip|x-tar|x-7z-compressed => compressed file + - octet-stream => direct copy + +Compressed files (x-gzip|x-tar|x-7z-compressed): +- Unpacking of archives +- Recursively run the rules on the unpacked files + +Usage +===== + +0. Power off the device +1. Plug the untrusted key in the top usb slot of the Raspberry Pi +2. Plug your own key in the bottom usb slot + Note: This key should be bigger than the original one because the archives + will be copyed +3. Optional: connect the HDMI cable to a screen to see what happen +4. Connect the power to the micro USB +5. Wait until you do not see any blinking green light on the board, or if you + connected the HDMI cable, check the screen + it's slow and can take 30-60 minutes depending on how many document + conversions take place +6. Power off the device and disconnect the drives + +Helper scripts +============== + +You should use them as example when you are creating a new image and probably not +run them blindly as you will most probably have to change constraints accordingly to +your configuration. + +IN ALL CASES, PLEASE READ THE COMMENTS IN THE SCRIPTS AT LEAST ONCE. + +* proper_chroot.sh: uses qemu to chroot into a raspbian instance (.img or SD Card) +* prepare_rPI_builder.sh: update the system, add the repositories and install all + the dependencies needed to compile poppler and pdf2htmlEX on a rPi +* update_builder.sh: compile the latest version of poppler from debian experimental, + pull and compile the latest version of pdf2htmlEX from the git repository +* prepare_rPI.sh: update the system, install the dependencies of poppler and pdf2htmlEX, + install poppler and pdf2htmlEX (the deb packages compiled in the builder) +* create_user.sh: create the user who will run the scripts, assign the proper sudo rights. +* copy_to_final.sh: populate the content of the directory fs/ in the image, + contains a sample of dd command to write the image on the SD card. + *TAKE CARE NOT USING THE WRONG DESTINATION* + + + diff --git a/copy_to_final.sh b/copy_to_final.sh index 3822de6..bb194d4 100755 --- a/copy_to_final.sh +++ b/copy_to_final.sh @@ -18,4 +18,5 @@ tar -xzf backup.tar.gz -C ${CHROOT_PATH}/ # /!\ always try to mount the root partition on the SD, it is usually broken. # if it is, use fdisk to remove the second partition and recreate it (you will -# not lose the data) +# not lose the data). +# See resize_img.md diff --git a/prepare_rPI_builder.sh b/prepare_rPI_builder.sh index 0bed1cf..5428152 100755 --- a/prepare_rPI_builder.sh +++ b/prepare_rPI_builder.sh @@ -1,6 +1,5 @@ #!/bin/bash - # change locales to en_US.UTF-8 dpkg-reconfigure locales @@ -10,7 +9,7 @@ apt-get autoremove echo "deb http://ftp.de.debian.org/debian experimental main" >> /etc/apt/sources.list echo "deb-src http://ftp.de.debian.org/debian experimental main" >> /etc/apt/sources.list -gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553 +gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553 gpg -a --export 8B48AD6246925553 | apt-key add - gpg --keyserver pgpkeys.mit.edu --recv-key AED4B06F473041FA gpg -a --export AED4B06F473041FA | apt-key add - @@ -21,14 +20,8 @@ apt-get update # liblcms2-dev gtk-doc-tools libgirepository1.0-dev gobject-introspection libglib2.0-doc \ # libcairo2-doc apt-get build-dep poppler -apt-get -b source -t experimental poppler -# Note: libpoppler-private-dev is not listed in the dependencies of pdf2htmlEX -# but still needed because of poppler-config.h -dpkg -i libpoppler-dev* libpoppler28* libpoppler-private-dev* -git clone https://github.com/coolwanglu/pdf2htmlEX.git -cd pdf2htmlEX/ -# build Deps +# build dependencies of pdf2htmlEX apt-get install cmake libfontforge-dev libspiro-dev python-dev -dpkg-buildpackage -uc -b +git clone https://github.com/coolwanglu/pdf2htmlEX.git diff --git a/proper_chroot.sh b/proper_chroot.sh index 3b8418d..23e228c 100755 --- a/proper_chroot.sh +++ b/proper_chroot.sh @@ -1,5 +1,10 @@ #!/bin/bash +# Notes: +# - To chroot in an existing SD card, unset IMAGE. Change the paths to the partitions if needed. +# - The offsets are thoses of 2013-02-09-wheezy-raspbian.img. It will change on an other image. +# To get the offsets, use the "file" command. + if [ "$(id -u)" != "0" ]; then echo "This script must be run as root" 1>&2 exit 1 @@ -14,13 +19,14 @@ set -e set -x # If you use a partition... -#PARTITION_ROOTFS='/dev/mmcblk0p2' -#PARTITION_BOOT='/dev/mmcblk0p1' -PARTITION_ROOTFS='/dev/sdd2' -PARTITION_BOOT='/dev/sdd1' +PARTITION_ROOTFS='/dev/mmcblk0p2' +PARTITION_BOOT='/dev/mmcblk0p1' +#PARTITION_ROOTFS='/dev/sdd2' +#PARTITION_BOOT='/dev/sdd1' + # If you use the img ##### Debian -IMAGE='2013-02-09-wheezy-raspbian.img' +#IMAGE='2013-02-09-wheezy-raspbian.img' OFFSET_ROOTFS=$((122880 * 512)) OFFSET_BOOT=$((8192 * 512)) ##### Arch @@ -51,6 +57,7 @@ clean(){ trap clean EXIT TERM INT +# enforce the CPU in order to have the armv6 instructions set (and compile working packages...) export QEMU_CPU=arm1176 #export QEMU_STRACE=1 diff --git a/update_builder.sh b/update_builder.sh index 8978d93..fcff853 100755 --- a/update_builder.sh +++ b/update_builder.sh @@ -1,17 +1,12 @@ #!/bin/bash -# get sources of latest libpoppler from experimental in the debian packages -# Unpack the sources -# unpack the the debian patches in the dir of the sources -# let the dsc file outside of this directory -# Build package -# Take a nap +apt-get -b source -t experimental poppler -cd /root/pdf2htmlEX +# Note: libpoppler-private-dev is not listed in the dependencies of pdf2htmlEX +# but still needed because of poppler-config.h +dpkg -i libpoppler-dev* libpoppler28* libpoppler-private-dev* + +cd pdf2htmlEX/ git pull -dpkg-buildpackage -rfakeroot -uc -b -ls ../*deb -ls /var/cache/apt/archives/libpoppler* - -# Copy libpoppler and pdf2htmlex deb out of the chroot. +dpkg-buildpackage -uc -b