better data flow
This commit is contained in:
parent
86eaabc265
commit
75ebf03194
|
@ -225,10 +225,6 @@ if [[ -d /home/${YOU}/.zen/SMS/GUILDES/${guilde}/INPUT ]]; then
|
|||
## CREATION /MadeInZion/${guilde}/${xzuid} dans NEXTCLOUD
|
||||
if [[ -f /var/www/nextcloud/occ ]]; then
|
||||
sudo mkdir -p /var/www/nextcloud/data/${xzuid}/files/MadeInZion/${guilde}/${xzuid}
|
||||
sudo cp /home/${YOU}/.zen/SMS/PHONE/${phonehash}/avatar.jpg /var/www/nextcloud/data/${xzuid}/files/MadeInZion/
|
||||
sudo touch /var/www/nextcloud/data/${xzuid}/files/MadeInZion/$PASS
|
||||
sudo chmod 775 /var/www/nextcloud/data/${xzuid}/files/MadeInZion
|
||||
sudo chown -R www-data:${YOU} /var/www/nextcloud/data/${xzuid}/files/MadeInZion
|
||||
### IDEA !! USE /var/www/nextcloud/data/${xzuid} AS $HOME for SSH access... TODO ?
|
||||
fi
|
||||
|
||||
|
@ -259,37 +255,62 @@ done
|
|||
########################################################################
|
||||
## DOC IMAGE MAGICK https://legacy.imagemagick.org/Usage/layers/#append
|
||||
########################################################################
|
||||
if [[ -e /dev/usb/lp0 && $NEW == 1 ]]; then
|
||||
if [[ $NEW == 1 ]]; then
|
||||
ts=$(date -u +%s%N | cut -b1-13)
|
||||
|
||||
# PRINT LOGO
|
||||
if [[ ! -f /tmp/LOGO.bin ]]; then
|
||||
if [[ ! -f /tmp/LOGO.bin && -e /dev/usb/lp0 ]]; then
|
||||
brother_ql_create --model QL-700 ../img/MadeInZion_G1_ASTROPORT.png --label-size 62 > /tmp/LOGO.bin
|
||||
brother_ql_print /tmp/LOGO.bin /dev/usb/lp0
|
||||
fi
|
||||
sudo cp ../img/MadeInZion_G1_ASTROPORT.png /var/www/nextcloud/data/${xzuid}/files/MadeInZion/
|
||||
|
||||
# PRINT QR.png CREDENTIALS AND QR CODES
|
||||
brother_ql_create --model QL-700 /home/${YOU}/.zen/SMS/PHONE/${phonehash}/QR.png --label-size 62 > /tmp/${ts}_QR.bin
|
||||
brother_ql_print /tmp/${ts}_QR.bin /dev/usb/lp0
|
||||
rm /tmp/${ts}_QR.bin
|
||||
|
||||
if [[ -e /dev/usb/lp0 ]]; then
|
||||
brother_ql_create --model QL-700 /home/${YOU}/.zen/SMS/PHONE/${phonehash}/QR.png --label-size 62 > /tmp/${ts}_QR.bin
|
||||
brother_ql_print /tmp/${ts}_QR.bin /dev/usb/lp0
|
||||
rm /tmp/${ts}_QR.bin
|
||||
else
|
||||
sudo cp /home/${YOU}/.zen/SMS/PHONE/${phonehash}/QR.png /var/www/nextcloud/data/${xzuid}/files/MadeInZion/${G1}_QR.png
|
||||
fi
|
||||
# PRINT ${xzuid} ${phone}
|
||||
convert -background White label:"${xzuid} ${phone}" -append /tmp/${ts}_ID.png
|
||||
brother_ql_create --model QL-700 /tmp/${ts}_ID.png --label-size 62 > /tmp/${ts}_ID.bin
|
||||
brother_ql_print /tmp/${ts}_ID.bin /dev/usb/lp0
|
||||
rm /tmp/${ts}_ID.bin /tmp/${ts}_ID.png
|
||||
|
||||
if [[ -e /dev/usb/lp0 ]]; then
|
||||
brother_ql_create --model QL-700 /tmp/${ts}_ID.png --label-size 62 > /tmp/${ts}_ID.bin
|
||||
brother_ql_print /tmp/${ts}_ID.bin /dev/usb/lp0
|
||||
rm /tmp/${ts}_ID.bin /tmp/${ts}_ID.png
|
||||
else
|
||||
sudo cp /tmp/${ts}_ID.png /var/www/nextcloud/data/${xzuid}/files/MadeInZion/ID_${G1}.png
|
||||
fi
|
||||
|
||||
# PRINT QRSEC.png
|
||||
brother_ql_create --model QL-700 /home/${YOU}/.zen/SMS/PHONE/${phonehash}/QRSEC.png --label-size 62 > /tmp/${ts}_QRSEC.bin
|
||||
brother_ql_print /tmp/${ts}_QRSEC.bin /dev/usb/lp0
|
||||
rm /tmp/${ts}_QRSEC.bin
|
||||
brother_ql_print /tmp/${ts}_QRSEC.bin /dev/usb/lp0; rm /tmp/${ts}_QRSEC.bin
|
||||
sudo cp /home/${YOU}/.zen/SMS/PHONE/${phonehash}/QRSEC.png /var/www/nextcloud/data/${xzuid}/files/MadeInZion/
|
||||
|
||||
# PRINT $PASS
|
||||
convert -background White label:"CODE SECRET : ${PASS} " -append /tmp/${ts}_PASS.png
|
||||
brother_ql_create --model QL-700 /tmp/${ts}_PASS.png --label-size 62 > /tmp/${ts}_PASS.bin
|
||||
brother_ql_print /tmp/${ts}_PASS.bin /dev/usb/lp0
|
||||
rm /tmp/${ts}_PASS.bin /tmp/${ts}_PASS.png
|
||||
if [[ -e /dev/usb/lp0 ]]; then
|
||||
brother_ql_create --model QL-700 /tmp/${ts}_PASS.png --label-size 62 > /tmp/${ts}_PASS.bin
|
||||
brother_ql_print /tmp/${ts}_PASS.bin /dev/usb/lp0
|
||||
rm /tmp/${ts}_PASS.bin /tmp/${ts}_PASS.png
|
||||
else
|
||||
sudo cp /tmp/${ts}_PASS.png /var/www/nextcloud/data/${xzuid}/files/MadeInZion/${PASS}_PASS.png
|
||||
fi
|
||||
else
|
||||
|
||||
## PUT DATA IN NEXTCLOUD FOLDER
|
||||
sudo cp ../img/MadeInZion_G1_ASTROPORT.png /var/www/nextcloud/data/${xzuid}/files/MadeInZion/
|
||||
sudo cp /home/${YOU}/.zen/SMS/PHONE/${phonehash}/avatar.jpg /var/www/nextcloud/data/${xzuid}/files/MadeInZion/
|
||||
sudo cp /home/${YOU}/.zen/SMS/PHONE/${phonehash}/QR.png /var/www/nextcloud/data/${xzuid}/files/MadeInZion/QR_${G1}.png
|
||||
sudo cp /home/${YOU}/.zen/SMS/PHONE/${phonehash}/QRSEC.png /var/www/nextcloud/data/${xzuid}/files/MadeInZion/QRSEC_${G1}.png
|
||||
convert -background White label:"${xzuid} ${phone}" -append /tmp/${ts}_ID.png
|
||||
sudo cp /tmp/${ts}_ID.png /var/www/nextcloud/data/${xzuid}/files/MadeInZion/ID_${G1}.png
|
||||
|
||||
sudo chmod 775 /var/www/nextcloud/data/${xzuid}/files/MadeInZion
|
||||
sudo chown -R www-data:${YOU} /var/www/nextcloud/data/${xzuid}/files/MadeInZion
|
||||
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -45,12 +45,12 @@ TEXT="$SMS_1_TEXT" # gammu-smsd
|
|||
[[ "${TEXT}" == "" ]] && echo "SMS IS EMPTY - EXIT -" && exit 1
|
||||
|
||||
########################################################################
|
||||
# INTERNET CONNEXION NOT OK
|
||||
# INTERNET CONNEXION NOT OK : MAKE REPLAY SCRIPT
|
||||
########################################################################
|
||||
if [[ $GCHANGE == 0 ]]; then
|
||||
echo "GCHANGE UNREACHABLE => CREATING timestamp.replay.sh - EXIT -"
|
||||
echo "#!/bin/bash
|
||||
sudo $MY_PATH/sms_received \"${PHONE}\" \"${TEXT}\"" > /home/${YOU}/.zen/SMS/$(date -u +%s%N | cut -b1-13).replay.sh
|
||||
sudo $MY_PATH/sms_received.sh \"${PHONE}\" \"${TEXT}\"" > /home/${YOU}/.zen/SMS/$(date -u +%s%N | cut -b1-13).replay.sh
|
||||
chmod +x /home/${YOU}/.zen/SMS/*.replay.sh
|
||||
exit 1
|
||||
fi
|
||||
|
@ -107,9 +107,14 @@ esac
|
|||
## SEND A COPY OF INCOMING MESSAGE TO SMSADMIN
|
||||
if [[ "$phone" != "$SMSADMIN" ]]; then
|
||||
adminhash=$(echo $SMSADMIN | sha256sum | cut -d ' ' -f1)
|
||||
phonehash=$(echo $phone | sha256sum | cut -d ' ' -f1)
|
||||
ID=$(cat /home/${YOU}/.zen/SMS/PHONE/${phonehash}/xzuid.txt 2>/dev/null)
|
||||
echo "#!/bin/bash
|
||||
sudo gammu sendsms TEXT \"_PHONE_\" -text \"ADMIN $phone : $TEXT\"" > /home/${YOU}/.zen/SMS/PHONE/${adminhash}/$(date -u +%s%N | cut -b1-13).tosend.sh
|
||||
sudo gammu sendsms TEXT \"_PHONE_\" -text \"> - $phone - $ID - $TEXT\"" > /home/${YOU}/.zen/SMS/PHONE/${adminhash}/$(date -u +%s%N | cut -b1-13).tosend.sh
|
||||
chmod +x /home/${YOU}/.zen/SMS/PHONE/${adminhash}/*.tosend.sh
|
||||
|
||||
## ADD TO GUILDE GUIDE ROOTING : TODO
|
||||
|
||||
fi
|
||||
|
||||
## FILESYSTEM RIGHTS CORRECTION
|
||||
|
|
Loading…
Reference in New Issue