forked from axiom-team/astroport
45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
################################################################################
|
|
# Author: Fred (support@qo-op.com)
|
|
# Version: 1.0
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
################################################################################
|
|
source ./init.sh
|
|
source ./functions.sh
|
|
log "X sms_SETUNIT.sh ($1=phone, $2=unit)"
|
|
|
|
phone="$1"
|
|
unit="$2"
|
|
UNITFILE="/home/$YOU/.zen/g1sms_wallets/$phone/_unit"
|
|
|
|
# Initialise PHONE, PIN, PUBKEY, UNIT, HIST
|
|
sms_INIT_ACCOUNT "$phone" "NOSMS"
|
|
|
|
if [[ $UNKNOWN == "unknown" ]]; then
|
|
sms_ERROR "$phone" "Porte-monnaie inconnu. Envoyez N (suivi de votre Pseudo membre) pour le créer."
|
|
exit
|
|
fi
|
|
|
|
# No unit received
|
|
if [[ $unit == "U" || $unit == "" ]]; then
|
|
if [[ -f "$UNITFILE" ]]; then
|
|
unit=$(cat "$UNITFILE")
|
|
else
|
|
unit="$COIN";
|
|
fi
|
|
fi
|
|
|
|
echo "$unit" > "$UNITFILE"
|
|
|
|
mess="[G1sms+]
|
|
Unité de votre portefeuille: $unit"
|
|
|
|
sms_SEND "$phone" "$mess"
|
|
|
|
[[ -f /home/$YOU/.zen/g1sms_wallets/$phone ]] && [[ $(whoami) == "root" ]] && chown -R $YOU /home/$YOU/.zen/g1sms_wallets/$phone
|
|
|
|
log "END sms_SETUNIT.sh"
|
|
log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
|
|
exit
|