#!/bin/bash ################################################################################ # Author: Fred (support@qo-op.com) # Version: 1.0 # 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 source $MY_PATH/init.sh source $MY_PATH/functions.sh log "X sms_SETUNIT.sh ($1=phone, $2=unit)" phone="$1" unit="$2" UNITFILE="/home/$YOU/.zen/g1sms/$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" [[ -d /home/$YOU/.zen/g1sms/$phone ]] && [[ $(whoami) == "root" ]] && chown -R $YOU /home/$YOU/.zen/g1sms/$phone log "END sms_SETUNIT.sh" log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~" exit