#!/usr/bin/perl
+# Taken from http://rasterweb.net/raster/code/crypt.html
+#
+# I needed this for creating shadow passwords under Red Hat Linux 6.1, since
+# passwords are not stored in plain text (that's a good idea) if I remember
+# correctly, Red Hat had broken useradd, or adduser, or whatever the hell they
+# were using at the time...
+
srand (time());
my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
#!/bin/bash
-JPEG_QUALITY=10
+# Numérisation d'un document texte, et conversion en PDF
+
+jpeg_quality=10
+color_mode="Gray"
+resolution="200"
+extension="pdf"
+scan_area="--scan-area Letter"
+PROG_NAME=$(basename $0)
print_usage()
{
- echo "$(basename $0) -- Numérisation image monochrome 8.5\"x11\" en PDF"
- echo "Usage: $(basename $0) [OPTIONS...] FICHIER"
+ echo "${PROG_NAME} -- Numérisation document 8.5\"x11\" en PDF"
+ echo "Usage: ${PROG_NAME} [OPTIONS...] FICHIER"
+ echo
+ echo "Options:"
+ echo " -c numérisation en couleur (défaut = noir et blanc)"
+ echo " -h display this help and exit"
+ echo " -j format de sortie JPEG (défaut = PDF)"
+ echo " -q qualité JPEG (défaut = 10)"
+ echo " 1 = basse qualité"
+ echo " 100 = haute qualité"
+ echo " -r résolution (défaut = 200 DPI)"
+ echo " -p taille photo, 8.5\"x5.5\" (défaut = 8.5\"x11\")"
+ echo
}
-if [ "x${1}" = "x--help" ]; then
- print_usage
+while getopts "chjpq:r:" flag ;do
+ case ${flag} in
+ c)
+ color_mode="Color"
+ ;;
+ j)
+ extension="jpg"
+ ;;
+ h)
+ print_usage
+ exit 0
+ ;;
+ p)
+ scan_area="-l 0 -t 0 -x 215.9 -y 150"
+ ;;
+ q)
+ jpeg_quality=${OPTARG}
+ ;;
+ r)
+ # JPEG resolution
+ resolution=${OPTARG}
+ ;;
+ ?)
+ echo "${PROG_NAME}: Option invalide: ${OPTARG}."
+ echo "Essayez \`${PROG_NAME} -h' pour plus d'informations."
+ exit 1
+ ;;
+ esac
+done
+shift `expr "${OPTIND}" - 1`
+
+# `$#' now represents the number of arguments after the options.
+# `$1' is the first argument, etc.
+if [ $# -gt 1 ]; then
+ echo "${PROG_NAME}: Too many arguments."
+ echo "Essayez \`${PROG_NAME} -h' pour plus d'informations."
exit 1
fi
if [ ${#} -ne 1 ]; then
- print_usage
+ echo "${PROG_NAME}: Nom de fichier manquant."
+ echo "Essayez \`${PROG_NAME} -h' pour plus d'informations."
exit 1
fi
src=${1}
-scanimage --mode Gray --resolution 200 --scan-area Letter | \
- convert - -compress jpeg -quality ${JPEG_QUALITY} ${src}.pdf
+scanimage --mode ${color_mode} --resolution ${resolution} ${scan_area} | \
+ convert - -compress jpeg -quality ${jpeg_quality} ${src}.${extension}
SYSBINDIR="${PREFIX}/sbin"
SYSCONFDIR="/etc"
BIN_UTILITIES="camera-download cd-erase cd-copy cgrep pstopdf distro-backup \
- dos2unix dvd-ram-format fix-avi gztobz2 hv-backup hv-video-dvd \
+ dos2unix fix-avi gztobz2 hv-backup hv-video-dvd \
mail-files mail-if-fail mail-statistics media-write pstopdf \
replace.pl rotatelogs setdate strip-debug-symbols tarbz2 \
tildes-clean vd vs vl flac2ogg flac2mp3 hv-scan"