diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/image_pregen.sh | 46 | ||||
-rwxr-xr-x | contrib/install-scripts.sh | 35 |
2 files changed, 81 insertions, 0 deletions
diff --git a/contrib/image_pregen.sh b/contrib/image_pregen.sh new file mode 100755 index 0000000..8a89fd6 --- /dev/null +++ b/contrib/image_pregen.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# image_pregen.sh +# +# call with file or dir to pregenerate the file or dir +# if you set first param. to -at, the script will use at to start a job for +# atd, so it runs asychonous in the background +# +# by Onno Kreuzinger, onno_AT_kreuzinger_DOT_biz +# 2004-06-27 a.brachold - remove nocopy method +# 2004-08-14 a.brachold - update for imageplugin.sh version 0.2.0 +# +[ "z$DEBUG" = "zyes" ] && set -xv + +[ "z$1" = "z" ] && echo "start atleast with file or dir as argument, to pregenerate that file or dir." && exit 1 +[ "z$1" = "z-at" ] && echo "starting at job mode.." && echo "$0 $2 $3"|at now && exit 0 +[ "z$2" = "z-at" ] && echo "starting at job mode.." && echo "$0 $1 $3"|at now && exit 0 +[ "z$1" = "z-follow" ] && FOLLOWMODE="true" && shift +[ "z$2" != "z" ] && shift + +CONVERT_SCRIPT="imageplugin.sh" +CACHEFOLDER=${CACHEFOLDER:-"/tmp/image"} + +[ ! -e $CONVERT_SCRIPT ] && echo "Can't find our worker $CONVERT_SCRIPT, please adjust path or variable CONVERT_SCRIPT" && exit 1 + +if [ -d "$1" ] + then + if [ "z$FOLLOWMODE" = "ztrue" ] + then + echo "$0 : recursive dir mode "$1"" + find "$1" -follow -type f \ + -name "*\.[jJbBtTpPmM][pPmMiInN][gGpPeEfFmM]" \ + -exec $CONVERT_SCRIPT "{}" "$CACHEFOLDER{}.pnm" 688 544 0 0 0 \; 2> /dev/null + else + echo "$0 : dir mode "$1"" + find "$1" -maxdepth 1 -follow -type f \ + -name "*\.[jJbBtTpPmM][pPmMiInN][gGpPeEfFmM]" \ + -exec $CONVERT_SCRIPT "{}" "$CACHEFOLDER{}.pnm" 688 544 0 0 0 \; 2> /dev/null + fi +elif [ -e "$1" ] + then + echo "$0 : single file mode "$1"" + $CONVERT_SCRIPT "$1" "$CACHEFOLDER$1.pnm" 688 544 0 0 0 2> /dev/null +else + echo -e "$1 is no file or directory\n syntax: $0 [-at] [-follow] <file|folder>" +fi +echo "done" diff --git a/contrib/install-scripts.sh b/contrib/install-scripts.sh new file mode 100755 index 0000000..8f2d34d --- /dev/null +++ b/contrib/install-scripts.sh @@ -0,0 +1,35 @@ +#!/bin/sh +#set -xv +pushd $(dirname $0) &>/dev/null + +BIN_FILES="../scripts/imageplugin.sh ../contrib/image_pregen.sh" +BIN_DEST="/usr/bin" + +echo -e "Warning: this script will install these files:\n$BIN_FILES\nto $BIN_DEST,\npress CTRL-C to abort, or anykey to begin." +read ANYKEY + +#installing bin files +echo "Installing $BIN_FILES to $BIN_DEST....." +for FILE in $BIN_FILES +do + echo "copying $FILE to $BIN_DEST ..." + rm -f $BIN_DEST/$FILE + cp -f $FILE $BIN_DEST/$FILE;RV=$? + [ $RV -ne 0 ] && echo -e "Errorcode $RV on file: $BIN_DEST/$FILE.\n" +done + +#check and install mount.sh +if $(which mount.sh &>/dev/null) + then + OLD_MOUNT=$(which mount.sh) + echo -e "Should the existing mount.sh ("$OLD_MOUNT")\nbe overwriten? (y/N)" + read -n 1 -t 90 $KEYPRESSED + [ "z$KEYPRESSED" = "zy" -o "z$KEYPRESSED" = "zY" ] && rm -f $OLD_MOUNT && cp -f ../scripts/mount.sh $OLD_MOUNT + else + cp ../scripts/mount.sh $BIN_DEST/mount.sh +fi + +which mount.sh &>/dev/null || echo -e "Error could not execute mount.sh, please check.\n" + +popd &>/dev/null &>/dev/null +echo -e "Remember to copy/create imagesources.conf and imagecmds.conf\nfiles in your plugins config directory." |