Move install.sh to folder, fix and improvment
This commit is contained in:
parent
5fd9b873be
commit
9757e61f98
83
install.sh
83
install.sh
|
@ -1,83 +0,0 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
# LE Freaking LOL Hackathon de Noël https://framadate.org/sviOUlP6JLyWq5D2XLEdcKY9/admin
|
||||
#
|
||||
now=$(date -u +%Y-%m-%d)
|
||||
|
||||
echo "Bonjour $USER, je vous souhaite bon jour ($now)"
|
||||
echo "Ce script va installer / mettre à jour votre noeud G1sms dans /home/$USER/G1sms+"
|
||||
echo "ATTENTION! Vous devez avoir installé la couche ipfs & mpd au préalable!!! ./install_ipfs_layer.sh"
|
||||
IPFS=$(ps auxf --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1);
|
||||
echo "Quel est l'utilisateur du système IPFS (détecté: $IPFS)?"
|
||||
read YOU
|
||||
if [[ "$YOU" == "" ]]; then YOU=$IPFS; fi
|
||||
|
||||
cd /home/$USER
|
||||
echo "Déplacement dans /home/$USER/"
|
||||
echo "... Téléchargement de la dernière version du CODE G1sms+ (ipfs = $YOU)"
|
||||
|
||||
# CODE is there?? Get it from ipns
|
||||
ipfs get --output=./ /ipns/QmZHTne3bjtMgaXWRqSbdKchJbgq2NaAeVSzFUN7ceYpif
|
||||
|
||||
if [ ! -d ./G1sms+ ]; then
|
||||
|
||||
echo "RECHERCHE ET INSTALLATION DU CODE : G1sms+.latest.tgz "
|
||||
if [[ -f "./CODE/G1sms+.latest.tgz" ]]; then
|
||||
tar xzf ./CODE/G1sms+.latest.tgz
|
||||
fi
|
||||
|
||||
echo "VOULEZ VOUS CONFIGURER VOTRE NODE G1sms+ ? ^C"
|
||||
echo "Les paramètres se trouvent dans /home/$YOU/G1sms+/shell/init.sh"
|
||||
read
|
||||
|
||||
echo "Votre PSEUDO? Celui de votre compte membre Duniter. (defaut: Fred)"
|
||||
read ADMINPSEUDO
|
||||
if [[ "$ADMINPSEUDO" == "" ]]; then ADMINPSEUDO="Fred"; fi
|
||||
|
||||
echo "Le Numéro de téléphone SMS Admin? Votre numéro de portable (defaut: +33647683646)"
|
||||
read ADMINPHONE
|
||||
if [[ "$ADMINPHONE" == "" ]]; then ADMINPHONE="+33647683646"; fi
|
||||
|
||||
echo "Le numéro de la carte SIM, du module SMS. AUCUNE liaison SMS? Laissez vide (défaut: +33600000000)"
|
||||
read MASTERPHONE
|
||||
if [[ "$MASTERPHONE" == "" ]]; then MASTERPHONE="+33600000000"; fi
|
||||
|
||||
# TODO ASK for GeoPoint
|
||||
echo "L'adresse où se trouve votre G1Node pour indiquer où venir chercher les G1Tag imprimés (ex: au G1FabLab de Toulouse)"
|
||||
read ADRESSE
|
||||
z
|
||||
cp /home/$YOU/G1sms+/shell/init.sh.template /home/$YOU/G1sms+/shell/init.sh
|
||||
sed -i s/pi/$YOU/g /home/$YOU/G1sms+/shell/init.sh
|
||||
sed -i s/+33600000000/$MASTERPHONE/g /home/$YOU/G1sms+/shell/init.sh
|
||||
sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g /home/$YOU/G1sms+/shell/init.sh
|
||||
sed -i s/+33647683646/$ADMINPHONE/g /home/$YOU/G1sms+/shell/init.sh
|
||||
sed -i s/Fred/$ADMINPSEUDO/g /home/$YOU/G1sms+/shell/init.sh
|
||||
|
||||
echo "========================================="
|
||||
echo "VERIFIEZ QUE LES PARAMETRES SONT BONS... "
|
||||
echo "========================================="
|
||||
cat /home/$YOU/G1sms+/shell/init.sh
|
||||
echo "========================================="
|
||||
echo "CONFIG: vi /home/$YOU/G1sms+/shell/init.sh "
|
||||
echo "========================================="
|
||||
|
||||
else
|
||||
echo "VOUS AVEZ UNE VERSION de G1sms+ DEJA INSTALLEE. MISE A JOUR..."
|
||||
tar xzf CODE/G1sms+.latest.tgz
|
||||
|
||||
cd G1sms+
|
||||
# TODO
|
||||
# sudo chown -R $YOU ./TAG
|
||||
# sudo chown -R $YOU ./wallets
|
||||
echo "PREPARE rompr access from nginx"
|
||||
mkdir -p ./www/rompr/prefs
|
||||
mkdir -p ./www/rompr/albumarts
|
||||
chmod 777 ./www/rompr/prefs
|
||||
chmod 777 ./www/rompr/albumarts
|
||||
|
||||
echo "Version installée ($now):: IPFS chain :: $(cat ./_chain)"
|
||||
fi
|
|
@ -1,179 +0,0 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
###########################################################################################
|
||||
#######################################
|
||||
# INSTALL IPFS on G1sms+ Pi NODES
|
||||
#######################################
|
||||
echo "DEFAULT INSTALL SCRIPT. VALIDATED ON RASPBERRYPI, SHOULD BE ADAPTED IF NOT ARM ARCH SYSTEM.
|
||||
You are going to download and install ipfs daemon environement for running G1sms+ NODE.
|
||||
TODO: TEST TEST TEST TEST + MANAGE DIFFERENT ARCH
|
||||
Ready?"
|
||||
read
|
||||
|
||||
if [[ "$USER" == "root" ]]; then echo "Better run by 'pi', please create non-root user and become that user before launching ipfs install..."; exit;
|
||||
else echo "$USER, let's go!";
|
||||
fi
|
||||
|
||||
echo "GET ipfs-update"
|
||||
cd /usr/src/
|
||||
sudo wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz
|
||||
|
||||
echo "INSTALL ipfs-update"
|
||||
sudo tar xvzf ipfs-update_v1.5.2_linux-arm.tar.gz
|
||||
cd ipfs-update
|
||||
sudo ./install.sh
|
||||
|
||||
echo "INSTALL latest ipfs"
|
||||
sudo ipfs-update install latest
|
||||
|
||||
echo "CREATE SYSTEMD ipfs SERVICE"
|
||||
sudo cat > /etc/systemd/system/ipfs.service << EOF
|
||||
[Unit]
|
||||
Description=IPFS daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=$USER
|
||||
ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --enable-gc
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable ipfs
|
||||
|
||||
################
|
||||
# BECOME $USER
|
||||
# INIT ipfs
|
||||
ipfs init -p lowpower
|
||||
|
||||
# ACTIVATE CONFIG OPTIONS
|
||||
# PUBSUB
|
||||
ipfs config Pubsub.Router gossipsub
|
||||
# MAXSTORAGE
|
||||
ipfs config Datastore.StorageMax 12GB
|
||||
## PORT FORWARD (SSH)
|
||||
ipfs config --json Experimental.Libp2pStreamMounting true
|
||||
|
||||
######### UPDATE BOOTSTRAP LIST ###########
|
||||
ipfs bootstrap rm --all
|
||||
### fred@onelove.madeinzion.org ###
|
||||
# ID: QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh
|
||||
ipfs bootstrap add /ip6/fe80::207:cbff:fe0b:75bb/tcp/4001/ipfs/QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh
|
||||
ipfs bootstrap add /ip4/51.15.2.211/tcp/4001/ipfs/QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh
|
||||
### ADD NEW SWARM LEADERS SERVER HERE ###
|
||||
|
||||
# ALLOW REMOTE SSH CONNECTION FROM rec OR onelove (For swarm.key & keystore exchange )
|
||||
# ADD SSH ADMIN/SUPPORT USERS $(cat .ssh/id_rsa.pub)
|
||||
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs6oXRmPukaX7u2tDcFF1cecsDSEA30YyUqDaXSrw+yWQ8G79ktZ7BN0bPYBgfxO59FU8l5Jg1SPPG9kj81jfoCwGJpYdbczmMuP/iqw3aNoGv66swxwxzrqzbHrFFCXgn+6B2spDjn87tFB8JvQQTb2Kc4/sAZ9E6eY61pFiNpqbQehXdqSV5UemV9dkSQrnmJTl1PjUQ474AKQwFPzpdKHD/3VvqQS4i7ZLVeXS65euOP/YY8Bx9HvhsmhJ3h78OOK+D6GFfyv010xXBoG6kCSYR8LYMCEexpPGYV+Mduf/tUHjHP4GuWZAhd+wLRl0uPy6Tv7wHFfLyN01m/9vl fred@rec" >> ~/.ssh/authorized_keys
|
||||
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFthQ3FggJlz/+ZglZJjVJzYs6ehx/iB7f89KY396K+7ai4ETqFhq6ANVp9xeQ4dLU26w0bFBELcnh9rn5QDSrXjsIptoWXErkSdZOeXqofnLtJEOhZO/I328y0C1vQRwtMMXKLLnqPe14h+zJenc7KJbL5cvB3Hd7nfQ+Q0uEnIsKb0f5wcKagySHIFdmY/FqaGz5g4MXGq7nlX/31hvfTFhF0g+k3mhvTTVQ368Op9qZZIozYhBoojWWvK5mwAovxdS9QT1hKrFXHfjov/aKQxLAy0a0oxFvHKoYN/l4ffGibFMAmedljTxf1VSDBv/k/RN53UU6RufW3qqBjY0b fred@onelove" >> ~/.ssh/authorized_keys
|
||||
|
||||
# START ipfs
|
||||
sudo systemctl start ipfs
|
||||
|
||||
##################################
|
||||
## INSTALL TOOLS
|
||||
######## YOUTUBE-DL ##########
|
||||
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
|
||||
sudo chmod a+rx /usr/local/bin/youtube-dl
|
||||
sudo apt install libid3-tools mpd mpc lame -y
|
||||
|
||||
## CONFIG MPD
|
||||
sudo cat > /etc/mpd.conf << EOF
|
||||
music_directory "/home/$USER/music"
|
||||
playlist_directory "/home/$USER/playlists"
|
||||
user "$USER"
|
||||
bind_to_address "any"
|
||||
auto_update "yes"
|
||||
zeroconf_enabled "yes"
|
||||
zeroconf_name "CopyLaRadio Music Recorder"
|
||||
|
||||
filesystem_charset "UTF-8"
|
||||
id3v1_encoding "UTF-8"
|
||||
###############################
|
||||
|
||||
audio_output {
|
||||
type "pulse"
|
||||
name "My Pulse Output"
|
||||
server "127.0.0.1"
|
||||
}
|
||||
|
||||
audio_output {
|
||||
type "httpd"
|
||||
name "CopyLaRadio HTTP Stream"
|
||||
encoder "lame"
|
||||
port "8000"
|
||||
quality "5.0"
|
||||
# bitrate "128"
|
||||
format "44100:16:1"
|
||||
}
|
||||
EOF
|
||||
|
||||
sudo chown -R $USER /var/lib/mpd/ /var/run/mpd /run/mpd /var/log/mpd
|
||||
sudo service mpd restart
|
||||
|
||||
sudo apt-get install nginx php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm sqlite -y
|
||||
sudo apt-get install lame sox libsox-fmt-mp3 eyed3 python-chardet libav-tools imagemagick curl -y
|
||||
sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc libid3-tools espeak mpg321 fuse libttspico-utils atomicparsley -y
|
||||
|
||||
# CONFIG NGINX
|
||||
sudo cat > /etc/nginx/sites-available/default << EOF
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
root /home/$USER/G1sms+/www/rompr;
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
|
||||
server_name _;
|
||||
|
||||
location /g1tag {
|
||||
proxy_pass http://127.0.0.1:81;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||
}
|
||||
|
||||
location /code/ {
|
||||
proxy_pass http://127.0.0.1:8080/ipns/QmZHTne3bjtMgaXWRqSbdKchJbgq2NaAeVSzFUN7ceYpif/;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /ipfs {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||
}
|
||||
|
||||
location /ipns {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
sudo systemctl restart nginx
|
||||
|
||||
#################################
|
||||
## Get _CopyLaRadio distrib
|
||||
# ipfs get Qm.... > /tmp/copylaradio.zip
|
||||
|
||||
# Add CopyLaRadio to system PATH
|
||||
#export PATH=$PATH:/home/$USER/_CopyLaRadio
|
||||
# etc....
|
||||
|
||||
# INSTALL ROMPR WebSite LINKs
|
||||
#sudo ln -s /home/$USER/_CopyLaRadio/www/rompr /var/www/rompr
|
||||
#sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/albumart
|
||||
#sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/prefs
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
sudo -s
|
||||
|
||||
# Silkaj + Duniterpy
|
||||
apt install python3-pip
|
||||
apt install libsodium18
|
||||
apt install libsodium23
|
||||
pip3 install silkaj
|
||||
|
||||
|
||||
|
@ -17,7 +16,7 @@ cd ipfs-update
|
|||
ipfs-update install latest
|
||||
|
||||
# Install gammu
|
||||
apt install ppp screen git python3-pip minicom gammu gammu-smsd
|
||||
apt install ppp screen git minicom gammu gammu-smsd
|
||||
usermod -aG gammu pi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue