This commit is contained in:
fred 2022-02-19 17:38:40 +01:00
parent 480937c048
commit 30daa95d44
8 changed files with 28 additions and 27 deletions

View File

@ -23,47 +23,48 @@ NBbillets=6
[[ "$STYLE" == "xbian" ]] && NBbillets=1 ## STYLE=xbian => 1 BILLET
[[ "$STYLE" == "1" ]] && NBbillets=1 && STYLE="" ## 1 BILLET PDF
[[ "$STYLE" == "ticket" ]] && NBbillets=1 && echo "TICKET" ## 1 BILLET JPG
[[ "$STYLE" == "astro" ]] && NBbillets=1
# CHECK IF $STYLE IMAGES EXIST
[[ ! -f ${MY_PATH}/images/fond${STYLE}.jpg ]] && exit 1
[[ ! -f ${MY_PATH}/images/g1${STYLE}.png ]] && exit 1
[[ ! -f ${MY_PATH}/images/logo${STYLE}.png ]] && exit 1
[[ ! -f ${MY_PATH}/images/fond${STYLE}.jpg ]] && echo "missing fond${STYLE}.jpg" && exit 1
[[ ! -f ${MY_PATH}/images/g1${STYLE}.png ]] && echo "missing g1${STYLE}.jpg" && exit 1
[[ ! -f ${MY_PATH}/images/logo${STYLE}.png ]] && echo "missing logo${STYLE}.jpg" && exit 1
# CREATION DE $NBbillets BILLETS DE $MONTANT DU
boucle=0;
while [ $boucle -lt $NBbillets ]
do
boucle=$((boucle+1))
NUMBER=$(${MY_PATH}/diceware.sh 4 | xargs)
SECRET=$(${MY_PATH}/diceware.sh 4 | xargs)
boucle=$((boucle+1))
NUMBER=$(${MY_PATH}/diceware.sh 4 | xargs)
SECRET=$(${MY_PATH}/diceware.sh 4 | xargs)
# CREATION CLEF BILLET
BILLETPUBKEY=$(python3 ${MY_PATH}/key_create_dunikey.py "$NUMBER" "$SECRET")
rm -f /tmp/secret.dunikey
# CREATION CLEF BILLET
BILLETPUBKEY=$(python3 ${MY_PATH}/key_create_dunikey.py "$NUMBER" "$SECRET")
rm -f /tmp/secret.dunikey
mkdir -p "/tmp/g1billet/${UNIQID}"
# CREATION FICHIER IMAGE BILLET
$(${MY_PATH}/MAKE_G1BILLET.sh "${NUMBER}" "${SECRET}" "${MONTANT}" "${BILLETPUBKEY}" "${UNIQID}" "${STYLE}")
# CREATION FICHIER IMAGE BILLET
$(${MY_PATH}/MAKE_G1BILLET.sh "${NUMBER}" "${SECRET}" "${MONTANT}" "${BILLETPUBKEY}" "${UNIQID}" "${STYLE}")
done
if [[ "${STYLE}" == "ticket" || "${STYLE}" == "xbian" ]]
if [[ "${STYLE}" == "ticket" || "${STYLE}" == "xbian" || "${STYLE}" == "astro" ]]
then
cp /tmp/g1billet/${UNIQID}/*.jpg /tmp/g1billet/${UNIQID}.jpg
# CLEANING TEMP FILES
rm -Rf /tmp/g1billet/${UNIQID}
# ALLOWS ANY USER TO DELETE
chmod 777 /tmp/g1billet/${UNIQID}.jpg
cp /tmp/g1billet/${UNIQID}/*.jpg /tmp/g1billet/${UNIQID}.jpg
# CLEANING TEMP FILES
rm -Rf /tmp/g1billet/${UNIQID}
# ALLOWS ANY USER TO DELETE
chmod 777 /tmp/g1billet/${UNIQID}.jpg
else
# MONTAGE DES IMAGES DES BILLETS VERS /tmp/g1billet/${UNIQID}.pdf
montage /tmp/g1billet/${UNIQID}/*.jpg -tile 2x3 -geometry 964x459 /tmp/g1billet/${UNIQID}.pdf
# NB!! if "not autorized" then edit /etc/ImageMagick-6/policy.xml and comment
# <!-- <policy domain="coder" rights="none" pattern="PDF" /> -->
# CLEANING TEMP FILES
rm -Rf /tmp/g1billet/${UNIQID}
# ALLOWS ANY USER TO DELETE
chmod 777 /tmp/g1billet/${UNIQID}.pdf
# MONTAGE DES IMAGES DES BILLETS VERS /tmp/g1billet/${UNIQID}.pdf
montage /tmp/g1billet/${UNIQID}/*.jpg -tile 2x3 -geometry 964x459 /tmp/g1billet/${UNIQID}.pdf
# NB!! if "not autorized" then edit /etc/ImageMagick-6/policy.xml and comment
# <!-- <policy domain="coder" rights="none" pattern="PDF" /> -->
# CLEANING TEMP FILES
rm -Rf /tmp/g1billet/${UNIQID}
# ALLOWS ANY USER TO DELETE
chmod 777 /tmp/g1billet/${UNIQID}.pdf
fi

BIN
images/aaafondastro.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
images/fondastro.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
images/fondjeu (copie).jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
images/fondsaubole.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
images/g1astro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 638 KiB

BIN
images/logoastro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB