53 lines
1.7 KiB
Bash
Executable File
53 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
################################################################################
|
|
# Author: Fred (support@qo-op.com)
|
|
# Version: 0.1
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
################################################################################
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
ME="${0##*/}"
|
|
################################################################################
|
|
# Create and print 6 G1Billets de $MONTANT DU
|
|
# ${MY_PATH}/G1BILLETS.sh 5 986397643
|
|
################################################################################
|
|
MONTANT="$1"
|
|
UNIQID="$2"
|
|
|
|
[[ $MONTANT == "" ]] && MONTANT="___"
|
|
[[ $UNIQID == "" ]] && UNIQID=$(date -u +%s%N | cut -b1-13)
|
|
|
|
# CREATION DE 6 BILLETS DE $MONTANT DU
|
|
NBbillets=6
|
|
boucle=0;
|
|
while [ $boucle -lt $NBbillets ]
|
|
do
|
|
boucle=$((boucle+1))
|
|
NUMBER=$(${MY_PATH}/diceware.sh 4 | xargs)
|
|
SECRET=$(${MY_PATH}/diceware.sh 4 | xargs)
|
|
|
|
bpath=$(echo $NUMBER | sed 's/ /_/g')
|
|
|
|
# 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}")
|
|
|
|
done
|
|
|
|
# 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
|
|
|
|
exit
|