Dockerize paperify
This commit is contained in:
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM archlinux
|
||||
|
||||
|
||||
RUN pacman --noconfirm -Sy qrencode \
|
||||
zbar \
|
||||
imagemagick \
|
||||
git \
|
||||
ttf-roboto \
|
||||
fontconfig \
|
||||
diffutils
|
||||
|
||||
ENV FONT=Roboto-Regular \
|
||||
OUTPUT_DIR=/target/ \
|
||||
INPUT_DIR=/target/
|
||||
|
||||
RUN mkdir /paperify
|
||||
COPY . /paperify
|
||||
WORKDIR /paperify
|
||||
|
||||
ENTRYPOINT ["/paperify/paperify.sh"]
|
||||
|
@@ -1,7 +1,15 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
outputfile="$1"
|
||||
dir="$2"
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Please provide a filename as the first argument"
|
||||
exit 1
|
||||
elif [ "$2" = "" ]; then
|
||||
echo "Please provide the directory of the images as the second argument"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outputfile="$INPUT_DIR$1"
|
||||
dir="$OUTPUT_DIR$2"
|
||||
|
||||
files=$(ls $dir)
|
||||
|
||||
|
25
paperify.sh
25
paperify.sh
@@ -1,16 +1,27 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
while getopts "c:" opt; do
|
||||
case $opt in
|
||||
c) comment=$OPTARG ;; # Handle -c
|
||||
\?) echo "Use -c \"COMMENT\" to add comment to images."; exit ;; # Handle error: unknown option or missing required argument.
|
||||
esac
|
||||
for ((i=1;i<=$#;i++));
|
||||
do
|
||||
|
||||
if [ ${!i} = "-c" ]
|
||||
then ((i++))
|
||||
comment=${!i};
|
||||
else
|
||||
file="$INPUT_DIR${!i}";
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
for file in $@; do :; done
|
||||
if test -f "$file"; then
|
||||
echo "Paperifying $file"
|
||||
else
|
||||
echo "File not found! $file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
filename=$(echo $file | rev | cut -f 1 -d '/' | rev)
|
||||
prefix="$filename-"
|
||||
dir="$filename-qr"
|
||||
dir="$OUTPUT_DIR$filename-qr"
|
||||
|
||||
mkdir -p $dir
|
||||
rm -f $dir/*
|
||||
|
Reference in New Issue
Block a user