Fix debug/GSM_powerkey.sh do not stop key if is started. Replace by . Add .install/templates/2b/gammu-smsdrc

This commit is contained in:
poka 2019-12-20 19:59:01 +01:00
parent 30e136f3ea
commit 3e8a824d89
21 changed files with 289 additions and 49 deletions

1
.install/.GPATH Normal file
View File

@ -0,0 +1 @@
GPATH=/home/pi/G1sms+

View File

@ -8,7 +8,7 @@
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
stamp=$(date +%s) stamp=$(date +%s)
templates="$MY_PATH/templates/2" templates="$MY_PATH/templates/2a"
####################################### #######################################
# CONFIGURE IPFS for G1sms+ Pi NODES # CONFIGURE IPFS for G1sms+ Pi NODES

View File

@ -0,0 +1,34 @@
#!/bin/bash
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
source $MY_PATH/../.install/.GPATH
## Récupère les données du profile
[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile
## Désactive les processus écoutant le tty1
[[ $(sudo systemctl status getty@tty1.service | grep "loaded") ]] && sudo systemctl stop getty@tty1.service && sudo systemctl disable getty@tty1.service
## Copie et sed de /etc/gammu-smsdrc
[[ -f /etc/gammu-smsdrc ]] && sudo mv /etc/gammu-smsdrc /etc/gammu-smsdrc.old && echo "/etc/gammu-smsdrc a été renommé en /etc/gammu-smsdrc.old"
sudo cp $MY_PATH/templates/2b/gammu-smsdrc /etc/
GPATHS=$(echo $GPATH | sed 's./.\\/.g')
sudo sed -i "s/_GPATH/$GPATHS/g" /etc/gammu-smsdrc
sudo sed -i "s/_PIN/$PIN/g" /etc/gammu-smsdrc
## Configure correctement le UART
[[ ! $(grep enable_uart=1 /boot/config.txt) ]] && echo "enable_uart=1" | sudo tee -a /boot/config.txt
[[ $(grep "console=serial0" /boot/cmdline.txt) ]] && sudo sed -i "s/console=serial0,115200//g" /boot/cmdline.txt
[[ $(grep "console=serial0" /boot/cmdline.txt) ]] && echo -e "${c_red}Attention, console=serial0 est toujours présent dans /boot/cmdline.txt !$c_" && err=1
## Configure rc.local
## Redémarre gammu-smsd
sudo service gammu-smsd restart && echo -e "${c_green}Gammu a été correctement configuré$c_" || echo -e "${c_green}Un problème est survenu lors de la configuration de gammu$c_"
exit 0

14
.install/5-install_rompr.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
source $MY_PATH/../.install/.GPATH
GPATHS=$(echo $GPATH | sed 's./.\\/.g')
sudo cp $MY_PATH/templates/5/youtube-dl.php $GPATH/www/rompr/REC/youtube-dl.php
sudo sed -i "s/_GPATH/$GPATHS/g" $GPATH/www/rompr/REC/youtube-dl.php
## TODO
# Tout les reste ...
exit 0

View File

@ -2,4 +2,5 @@ ADMINPSEUDO=_ADMINPSEUDO
ADMINPHONE=_ADMINPHONE ADMINPHONE=_ADMINPHONE
MASTERPHONE=_MASTERPHONE MASTERPHONE=_MASTERPHONE
ADRESSE="_ADRESSE" ADRESSE="_ADRESSE"
PIN=_PIN
KSMS_DOMAIN= KSMS_DOMAIN=

View File

@ -0,0 +1,26 @@
# Configuration file for Gammu SMS Daemon
[gammu]
port = /dev/ttyS0
synchronizetime = yes
gammucoding = utf8
connection = at
# Debugging
logformat = textall
# SMSD configuration, see gammu-smsdrc(5)
[smsd]
service = files
logfile = /var/log/gammu-smsd.log
PIN = _PIN
# Paths where messages are stored (Not use if service = sql)
inboxpath = /var/spool/gammu/inbox/
outboxpath = /var/spool/gammu/outbox/
sentsmspath = /var/spool/gammu/sent/
errorsmspath = /var/spool/gammu/error/
RunOnReceive = _GPATH/sms_received.sh
#IncludeSMSCFile = _GPATH/debug/smsc.txt
debuglevel = 3

View File

@ -0,0 +1,128 @@
<?php
/*
DONE!!!? WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;"
// ZEEBOX HACK ZONE
var reclink = '/REC/youtube-dl.php?q=REC&artist=' + escape(encodeURIComponent(npinfo.Artist)) + '&title=' + escape(encodeURIComponent(npinfo.Title)) + '&radio='+ escape(encodeURIComponent(npinfo.stream)) +'&maxResults=1';
var zcopylink = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>';
zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>';
lines[0].text += zcopylink;
// ZEEBOX HACK ZONE
*/
// RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST);
$search=$radio=$artist=$title=$lnk=$lnkform=$cmd=$len="";
$search = trim(urldecode($_REQUEST['q']));
$radio = urldecode($_REQUEST['radio']);
$artist = urldecode($_REQUEST['artist']);
$title = urldecode($_REQUEST['title']);
$lnk = trim(urldecode($_REQUEST['lnk']));
$cmd="$radio|$artist|$title";
$len=strlen($artist.$title);
//$result='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>';
$result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>';
if( $radio == "" ) { $radio = "CopyLaRadio"; }
if( $radio == "Nova zz" ) {
$artist = "undefined";
$title = "undefined";
}
// Write request for copy.sh triggering
if( $search == "REC" ) {
///////////////////
$result.='<h2>♫ '.$radio.' ♫</h2>';
// LINK RECEIVED
if ($lnk) {
$artist="";
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Lien reçu."');
// Not making double request
if( ! exec('grep '.escapeshellarg($lnk).' /tmp/ytdl.list') ) {
file_put_contents("/tmp/ytdl.list","CopyLibre||$lnk\n", FILE_APPEND);
}
$result.='<p><a href="'.$lnk.'" target="check">LIEN: '.$lnk.'</a></p>';
///////////////////
// TRACK COPY (not for undefined or local file)
} else if ($radio && $artist != $title && $artist != "undefined" && $title != "undefined" && strlen(explode(".", $title)[1]) != 3 && explode(".", $title)[1] != "opus" ) {
// Not making double request
if( ! exec('grep '.escapeshellarg($cmd).' /tmp/ytdl.list') ) {
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Enregistrement ajouté."');
file_put_contents("/tmp/ytdl.list","$cmd\n", FILE_APPEND);
} else {
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Copie déjà lancée"');
}
$result.='<a style="color:#FFFFFF" href="https://www.youtube.com/results?search_query='.urlencode($artist).'%20'.urlencode($title).'" target="check">
<h4>'.$artist.' / '.$title.'</h4>
</a>';
///////////////////
// RADIO EXTERNAL TRACK SCRAPER
} else if($radio != "" && $artist == "undefined" && $title == "undefined" ){
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Recherche externe pour '.$radio.'"');
file_put_contents("/tmp/youtube-dl.log", "_GPATH/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php".PHP_EOL, FILE_APPEND);
if ( file_exists("_GPATH/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php") ) {
file_put_contents("/tmp/ytdl.list","$radio||".PHP_EOL, FILE_APPEND);
} else {
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Aucun module"');
}
} else {
shell_exec('_GPATH/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"');
}
}
$ytform = '<form action="/REC/youtube-dl.php" method="GET">
<div>
<h3>ARTISTE: <input type="search" id="artist" name="artist" size="17" placeholder="Indiquez un artiste" value="'.$artist.'"></h3>
<h3>TITRE: <input type="search" id="title" name="title" size="20" placeholder="Titre de la chanson" value="'.$title.'"></h3>
</div>
<input type="hidden" id="radio" name="radio" value="'.$radio.'">
<input type="hidden" id="q" name="q" value="REC">
<br>
<input type="submit" value="♫ Copie Youtube ♫">
</form>
';
$lnkform.='<form action="/REC/youtube-dl.php" method="GET">
<a href="https://youtube.com" target="search"><img src="/REC/youtube.png"></a>
<p><h1>youtube-dl</h1>
<a style="color:#FFFFFF" href="https://ytdl-org.github.io/youtube-dl/supportedsites.html" target="_blank">- Sites compatibles -</a>
<input type="search" id="lnk" name="lnk" placeholder="Inscrivez le lien à copier" value="" size="40">
<input type="hidden" id="q" name="q" value="REC">
</p>
<div>
<input type="submit" value="Copie du Lien">
</div>
</form>';
?>
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="fred" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<title><?php echo $search;?> - Recherche YouTube & Copie privée</title>
<link href="/REC/bootstrap.css" rel="stylesheet">
</head>
<body style='background: url("/REC/fond.jpg") no-repeat scroll center center / cover rgb(0, 0, 0); color:#FFFFFF;'>
<section class="content-section text-center">
<div class="container-fluid">
<div class="container" id="result" >
<div class="col-lg-8 col-lg-offset-2 page-scroll">
<ul>
<?php echo $result; ?>
<hr>
</ul>
<ul>
<?php echo $ytform; ?>
<hr>
<?php echo $lnkform; ?>
<hr>
</ul>
</div>
</div>
</div>
</section>
</body>
</html>

View File

@ -4,6 +4,11 @@
# Version: 0.1 # Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL) # License: GPL (http://www.google.com/search?q=GPL)
################################################################## ##################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
source $MY_PATH/.install/.GPATH
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS # Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
function log () { function log () {
# log ($1=text) # log ($1=text)
@ -31,8 +36,7 @@ fi
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
export CHEMIN="/home/$YOU/G1sms+" cd $GPATH
cd $CHEMIN
################################################################## ##################################################################
# Activate logging to /tmp/g1sms.log (YES/NO) # Activate logging to /tmp/g1sms.log (YES/NO)
export DOLOG="YES" export DOLOG="YES"
@ -75,5 +79,5 @@ fi
# TODO Use latest Silkaj from "sudo fredp3 install silkaj" # TODO Use latest Silkaj from "sudo fredp3 install silkaj"
# export SILKAJ="/usr/local/bin/silkaj" # export SILKAJ="/usr/local/bin/silkaj"
source $CHEMIN/shell/init_keys.sh source $GPATH/shell/init_keys.sh

View File

@ -1,10 +0,0 @@
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
while True:
GPIO.output(7, GPIO.LOW)
time.sleep(4)
GPIO.output(7, GPIO.HIGH)
break
GPIO.cleanup()

View File

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
source $MY_PATH/../.install/.GPATH
# Clean /tmp/ytdl.list # Clean /tmp/ytdl.list
#echo > /tmp/ytdl.list #echo > /tmp/ytdl.list
@ -74,9 +78,9 @@ elif [[ "$radio" != "" && "$artist" == "" && "$song" == "" ]]; then
# EXTERNAL PARSER: ADD SCRAPERS IN ./libradio # EXTERNAL PARSER: ADD SCRAPERS IN ./libradio
~/parle.sh "Recherche RADIO ${radio}" ~/parle.sh "Recherche RADIO ${radio}"
echo "External search: ${radio}" >> /tmp/youtube-dl.log 2>&1 echo "External search: ${radio}" >> /tmp/youtube-dl.log 2>&1
if [[ -f /home/pi/G1sms+/_CopyLaRadio/libradio/${radio}.php ]]; then if [[ -f $GPATH/_CopyLaRadio/libradio/${radio}.php ]]; then
~/parle.sh "Module existant" ~/parle.sh "Module existant"
php "/home/pi/G1sms+/_CopyLaRadio/libradio/${radio}.php" php "$GPATH/_CopyLaRadio/libradio/${radio}.php"
else else
~/parle.sh "Aucun module de décodage pour cette radio." ~/parle.sh "Aucun module de décodage pour cette radio."
fi fi

View File

@ -1,9 +1,16 @@
#!/bin/bash #!/bin/bash
MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
if [ ! -e /sys/class/gpio/gpio4 ]; then if [ ! -e /sys/class/gpio/gpio4 ]; then
echo "File exists." echo "File doesn't exists."
echo "4" > /sys/class/gpio/export echo "4" > /sys/class/gpio/export
fi fi
echo "out" > /sys/class/gpio/gpio4/direction echo "out" > /sys/class/gpio/gpio4/direction
echo "0" > /sys/class/gpio/gpio4/value
sleep 2
echo "1" > /sys/class/gpio/gpio4/value echo "1" > /sys/class/gpio/gpio4/value
sleep 3 && $MY_PATH/gammu-restart.sh
exit 0

5
debug/smsc.txt Normal file
View File

@ -0,0 +1,5 @@
+33695000695
+33695000647
+33695000646
+33695000643
+33695000636

View File

@ -6,6 +6,10 @@
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
echo "GPATH=$MY_PATH" > $MY_PATH/.install/.GPATH
source $MY_PATH/.install/.GPATH
init_loc="$MY_PATH/shell/init.sh" init_loc="$MY_PATH/shell/init.sh"
now=$(date +%Y-%m-%d) now=$(date +%Y-%m-%d)
unset err unset err
@ -47,7 +51,7 @@ $MY_PATH/.install/export_colors.sh
if [[ $force_req == "o" || -z $(which ipfs) || -z $(which gammu) ]];then if [[ $force_req == "o" || -z $(which ipfs) || -z $(which gammu) ]];then
echo -e "${c_yellow}IPFS ou gammu n'ont pas été détectés sur votre machine, nous allons installer tous les prérequis...$c_" echo -e "${c_yellow}IPFS ou gammu n'ont pas été détectés sur votre machine, nous allons installer tous les prérequis...$c_"
$MY_PATH/.install/1-install_requirements.sh silkaj ipfs gammu || err+=1 $MY_PATH/.install/1-install_requirements.sh silkaj ipfs gammu || err+=1
$MY_PATH/.install/2-configure_ipfs_layer.sh || err+=1 $MY_PATH/.install/2a-configure_ipfs_layer.sh || err+=1
else else
echo -e "${c_green}IPFS et gammu sont déjà installé !$c_" echo -e "${c_green}IPFS et gammu sont déjà installé !$c_"
fi fi
@ -66,7 +70,10 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
[[ ! $ADRESSE ]] && echo -e "${c_light}L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)$c_" && read ADRESSE [[ ! $ADRESSE ]] && echo -e "${c_light}L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)$c_" && read ADRESSE
echo -e "ADMINPSEUDO: $ADMINPSEUDO\nADMINPHONE: $ADMINPHONE\nMASTERPHONE: $MASTERPHONE\nADRESSE: $ADRESSE" [[ ! $PIN ]] && echo -e "${c_light}Le code PIN de votre carte SIM ? (ex: 1234)$c_" && read PIN
[[ "$PIN" == "" ]] && PIN="1234"
echo -e "ADMINPSEUDO: $ADMINPSEUDO\nADMINPHONE: $ADMINPHONE\nMASTERPHONE: $MASTERPHONE\nADRESSE: $ADRESSE\nPIN: $PIN"
[[ $noask != "o" ]] && echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ? (Editez le fichier .profile si incorrect)$c_" && read [[ $noask != "o" ]] && echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ? (Editez le fichier .profile si incorrect)$c_" && read
[[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old [[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old
@ -83,6 +90,7 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
sed -i s/_ADRESSE/$ADRESSE/g $MY_PATH/.profile sed -i s/_ADRESSE/$ADRESSE/g $MY_PATH/.profile
sed -i s/_ADMINPHONE/$ADMINPHONE/g $MY_PATH/.profile sed -i s/_ADMINPHONE/$ADMINPHONE/g $MY_PATH/.profile
sed -i s/_ADMINPSEUDO/$ADMINPSEUDO/g $MY_PATH/.profile sed -i s/_ADMINPSEUDO/$ADMINPSEUDO/g $MY_PATH/.profile
sed -i s/_PIN/$PIN/g $MY_PATH/.profile
fi fi
else else
@ -91,6 +99,9 @@ else
exit 1 exit 1
fi fi
## Configuration de gammu
$MY_PATH/.install/2b-configure_gammu.sh || err=1
## Installations optionnels ## Installations optionnels
repOld=$repOption repOld=$repOption

4
search
View File

@ -2,7 +2,7 @@
clear clear
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
if [ "$1" == "" ]; then if [ "$1" == "" ]; then
echo " Nothing to search for!" echo " Nothing to search for!"
else else
echo " Searching for "$1" recursively. Please Wait..." echo " Searching for "$1" recursively. Please Wait..."
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
@ -10,7 +10,7 @@ else
fi fi
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
if [ "$2" != "" ]; then if [ "$2" != "" ]; then
echo " To replace \"$1\" whith \"$2\", please run" echo " To replace \"$1\" whith \"$2\", please run"
echo " grep -rl '$1' ./ | xargs sed -i 's/$1/$2/g'" echo " grep -rl '$1' ./ | xargs sed -i 's/$1/$2/g'"
fi fi

View File

@ -7,10 +7,14 @@
# CE FICHIER cron_MINUTE.sh EST EXECUTE TOUTES LES MINUTES # CE FICHIER cron_MINUTE.sh EST EXECUTE TOUTES LES MINUTES
# IL CONSTITUE LE BATEMENT DE COEUR DU SYSTEME # IL CONSTITUE LE BATEMENT DE COEUR DU SYSTEME
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
source $MY_PATH/../.install/.GPATH
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'") IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
CHEMIN="/home/$YOU/G1sms+" cd $GPATH
cd $CHEMIN
source ./shell/init.sh source ./shell/init.sh
source ./shell/functions.sh source ./shell/functions.sh

View File

@ -5,6 +5,11 @@
# License: GPL (http://www.google.com/search?q=GPL) # License: GPL (http://www.google.com/search?q=GPL)
################################################################## ##################################################################
# Adapter les valeurs au contexte spatio-temporel du NODE G1SMS # Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
source $MY_PATH/../.install/.GPATH
function log () { function log () {
# log ($1=text) # log ($1=text)
if [ "$DOLOG" == "YES" ] if [ "$DOLOG" == "YES" ]
@ -31,8 +36,7 @@ fi
export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
export CHEMIN="/home/$YOU/G1sms+" cd $GPATH
cd $CHEMIN
################################################################## ##################################################################
# Activate logging to /tmp/g1sms.log (YES/NO) # Activate logging to /tmp/g1sms.log (YES/NO)
export DOLOG="YES" export DOLOG="YES"
@ -75,5 +79,5 @@ fi
# TODO Use latest Silkaj from "sudo fredp3 install silkaj" # TODO Use latest Silkaj from "sudo fredp3 install silkaj"
# export SILKAJ="/usr/local/bin/silkaj" # export SILKAJ="/usr/local/bin/silkaj"
source $CHEMIN/shell/init_keys.sh source $GPATH/shell/init_keys.sh

View File

@ -6,9 +6,13 @@
################################################################## ##################################################################
# CHECK & WARN | CREATE Keys (gpg encrypt, G1wallet, IPNS publish) # CHECK & WARN | CREATE Keys (gpg encrypt, G1wallet, IPNS publish)
################################################################## ##################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
source $MY_PATH/.install/.GPATH
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
# TODO Make it directory independant. (for now it is tested for pi running ipfs and code in $HOME/G1sms+ # TODO Make it directory independant. (for now it is tested for pi running ipfs and code in $HOME/G1sms+
CHEMIN="/home/$YOU/G1sms+"
################################################################## ##################################################################
# G1sms+ Node KEYS (G1wallet, gpg, IPNS) # G1sms+ Node KEYS (G1wallet, gpg, IPNS)
@ -20,17 +24,17 @@ if [ ! $GPGPASS ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey GPGPASS E
# G1sms+ Swarm KEYS # G1sms+ Swarm KEYS
################################################################## ##################################################################
# G1sms Service - G1Wallet # G1sms Service - G1Wallet
if [[ -f "${CHEMIN}/g1sms.pub.key" && -f "${CHEMIN}/g1sms.priv.key" ]]; then if [[ -f "${GPATH}/g1sms.pub.key" && -f "${GPATH}/g1sms.priv.key" ]]; then
chown root:root ${CHEMIN}/g1sms.priv.key chown root:root ${GPATH}/g1sms.priv.key
chmod 600 ${CHEMIN}/g1sms.priv.key chmod 600 ${GPATH}/g1sms.priv.key
export MASTERPUB=$(cat "${CHEMIN}/g1sms.pub.key") export MASTERPUB=$(cat "${GPATH}/g1sms.pub.key")
export MASTERKEYFILE="${CHEMIN}/g1sms.priv.key" export MASTERKEYFILE="${GPATH}/g1sms.priv.key"
else else
echo "ATTENTION!! Vous devez posséder la clef du G1 Wallet utilisé par le SWARM G1sms!!" echo "ATTENTION!! Vous devez posséder la clef du G1 Wallet utilisé par le SWARM G1sms!!"
./shell/parle.sh "Les clefs du portefeuille essaim G1 SMS sont absente. Au revoir." ./shell/parle.sh "Les clefs du portefeuille essaim G1 SMS sont absente. Au revoir."
echo "Fichiers manquants:" echo "Fichiers manquants:"
echo "${CHEMIN}/g1sms.pub.key" echo "${GPATH}/g1sms.pub.key"
echo "${CHEMIN}/g1sms.priv.key" echo "${GPATH}/g1sms.priv.key"
echo "Contactez nous sur https://g1sms.fr" echo "Contactez nous sur https://g1sms.fr"
gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "Clef de G1Wallet du SWARM g1sms.priv.key manquante! contactez-nous pour la recevoir https://g1sms.fr" 1>&2 gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "Clef de G1Wallet du SWARM g1sms.priv.key manquante! contactez-nous pour la recevoir https://g1sms.fr" 1>&2
exit exit

View File

@ -7,9 +7,10 @@
# sudo apt install ssmtp mpack # sudo apt install ssmtp mpack
# Configure in /etc/ssmtp # Configure in /etc/ssmtp
# Send email with file attachement: mpack -s "Logo G1Tag" /home/pi/G1sms+/G1Tag.png dest@email.ext # Send email with file attachement: mpack -s "Logo G1Tag" /home/pi/G1sms+/G1Tag.png dest@email.ext
source ./shell/init.sh source ./shell/init.sh
source ./shell/functions.sh source ./shell/functions.sh
log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)" log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)"
phone="$1" phone="$1"

View File

@ -27,14 +27,16 @@
# License: GPL (http://www.google.com/search?q=GPL) # License: GPL (http://www.google.com/search?q=GPL)
################################################################################ ################################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
# Execute Kalkun daemon # Execute Kalkun daemon
[[ -f /var/www/kalkun/scripts/daemon.sh ]] && /var/www/kalkun/scripts/daemon.sh [[ -f /var/www/kalkun/scripts/daemon.sh ]] && /var/www/kalkun/scripts/daemon.sh
export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1) export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
export CHEMIN="/home/$YOU/G1sms+" cd $GPATH
cd $CHEMIN source $MY_PATH/shell/init.sh
source ./shell/init.sh source $MY_PATH/shell/functions.sh
source ./shell/functions.sh
################################################################## ##################################################################
# Get global variables from gammu-smsd # Get global variables from gammu-smsd

View File

@ -1,11 +1,11 @@
<?php <?php
/* /*
DONE!!!? WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;" DONE!!!? WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;"
// ZEEBOX HACK ZONE // ZEEBOX HACK ZONE
var reclink = '/REC/youtube-dl.php?q=REC&artist=' + escape(encodeURIComponent(npinfo.Artist)) + '&title=' + escape(encodeURIComponent(npinfo.Title)) + '&radio='+ escape(encodeURIComponent(npinfo.stream)) +'&maxResults=1'; var reclink = '/REC/youtube-dl.php?q=REC&artist=' + escape(encodeURIComponent(npinfo.Artist)) + '&title=' + escape(encodeURIComponent(npinfo.Title)) + '&radio='+ escape(encodeURIComponent(npinfo.stream)) +'&maxResults=1';
var zcopylink = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>'; var zcopylink = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>';
zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>'; zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>';
lines[0].text += zcopylink; lines[0].text += zcopylink;
// ZEEBOX HACK ZONE // ZEEBOX HACK ZONE
*/ */
// RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST); // RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST);
@ -22,7 +22,7 @@ $len=strlen($artist.$title);
//$result='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>'; //$result='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>';
$result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>'; $result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>';
if( $radio == "" ) { $radio = "CopyLaRadio"; } if( $radio == "" ) { $radio = "CopyLaRadio"; }
if( $radio == "Nova zz" ) { if( $radio == "Nova zz" ) {
$artist = "undefined"; $artist = "undefined";
$title = "undefined"; $title = "undefined";
} }
@ -62,7 +62,7 @@ if( $search == "REC" ) {
} else { } else {
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Aucun module"'); shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Aucun module"');
} }
} else { } else {
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"'); shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"');
} }
@ -116,10 +116,10 @@ $lnkform.='<form action="/REC/youtube-dl.php" method="GET">
<ul> <ul>
<?php echo $ytform; ?> <?php echo $ytform; ?>
<hr> <hr>
<?php echo $lnkform; ?> <?php echo $lnkform; ?>
<hr> <hr>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>