From: Hugo Villeneuve Date: Mon, 13 May 2013 04:31:45 +0000 (-0400) Subject: Modifications hv-utilities X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=3c0eb5bdc581cd82d305ea4058a750f7ff235b76;p=hvlinux.git Modifications hv-utilities --- diff --git a/stage2/hv-utilities/crypt.pl b/stage2/hv-utilities/crypt.pl index 17f366b..0b67a68 100755 --- a/stage2/hv-utilities/crypt.pl +++ b/stage2/hv-utilities/crypt.pl @@ -1,5 +1,12 @@ #!/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); diff --git a/stage2/hv-utilities/dvd-ram-format b/stage2/hv-utilities/dvd-ram-format deleted file mode 100755 index 44a9a27..0000000 --- a/stage2/hv-utilities/dvd-ram-format +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mkudffs --spartable=2 --media-type=dvdram /dev/dvdram - -exit $? diff --git a/stage2/hv-utilities/hv-scan b/stage2/hv-utilities/hv-scan index 939cf5d..6398599 100755 --- a/stage2/hv-utilities/hv-scan +++ b/stage2/hv-utilities/hv-scan @@ -1,24 +1,77 @@ #!/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} diff --git a/stage2/install-hv-utilities b/stage2/install-hv-utilities index a61afba..e297ca9 100755 --- a/stage2/install-hv-utilities +++ b/stage2/install-hv-utilities @@ -8,7 +8,7 @@ BINDIR="${PREFIX}/bin" 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"