From 41ce851697361ff2e9faea97970b5443960100a9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 3 Aug 2016 17:06:27 +0100 Subject: [PATCH] Bump qTox commit to include mesh mode and avatars path settings --- src/freedombone-app-tox | 942 ++++++++++++++++++++-------------------- 1 file changed, 471 insertions(+), 471 deletions(-) diff --git a/src/freedombone-app-tox b/src/freedombone-app-tox index 4bab5579..2fb3f383 100755 --- a/src/freedombone-app-tox +++ b/src/freedombone-app-tox @@ -47,634 +47,634 @@ TOXIC_COMMIT='cf16849b374e484a33a4dffa3dfb937b59d537f2' TOXIC_FILE=/usr/local/bin/toxic QTOX_REPO="https://github.com/bashrc/qTox" -QTOX_COMMIT='505c5043828cf0fc43ee3f16279a131e50edc057' +QTOX_COMMIT='e70761bed758b263a263f4e910ae0fd0311e9098' function mesh_install_ffmpeg { - chroot "${rootdir}" apt-get -y remove ffmpeg libav-tools - chroot "${rootdir}" apt-get -y install build-essential - chroot "${rootdir}" apt-get -y install --reinstall libmp3lame-dev libvorbis-dev libtheora-dev libspeex-dev yasm pkg-config libopenjpeg-dev libx264-dev - mkdir -p ${rootdir}$INSTALL_DIR/ffmpeg-release - cd ${rootdir}$INSTALL_DIR - wget http://ffmpeg.org/releases/ffmpeg-3.1.tar.bz2 - tar xvjf ffmpeg-3.1.tar.bz2 - chroot ${rootdir} /bin/bash -x <> $COMPLETION_FILE - fi + OPEN_PORTS+=("Tox $TOX_PORT") + if [ -f $COMPLETION_FILE ]; then + echo 'configure_firewall_for_tox' >> $COMPLETION_FILE + fi } function tox_avahi { - if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then - return - fi - if grep -Fxq "tox_avahi" $COMPLETION_FILE; then - return - fi + if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then + return + fi + if grep -Fxq "tox_avahi" $COMPLETION_FILE; then + return + fi - if [ ! -d /etc/avahi ]; then - echo $'tox_avahi: avahi is not installed' - exit 87359 - fi + if [ ! -d /etc/avahi ]; then + echo $'tox_avahi: avahi is not installed' + exit 87359 + fi - # install a command to obtain the Tox ID - cd $INSTALL_DIR - function_check git_clone - git_clone $TOXID_REPO $INSTALL_DIR/toxid - if [ ! -d $INSTALL_DIR/toxid ]; then - exit 63921 - fi - cd $INSTALL_DIR/toxid - make - if [ ! "$?" = "0" ]; then - exit 58432 - fi - make install + # install a command to obtain the Tox ID + cd $INSTALL_DIR + function_check git_clone + git_clone $TOXID_REPO $INSTALL_DIR/toxid + if [ ! -d $INSTALL_DIR/toxid ]; then + exit 63921 + fi + cd $INSTALL_DIR/toxid + make + if [ ! "$?" = "0" ]; then + exit 58432 + fi + make install - toxavahi + toxavahi - # publish regularly - function_check cron_add_mins - cron_add_mins 1 'toxavahi > /dev/null' + # publish regularly + function_check cron_add_mins + cron_add_mins 1 'toxavahi > /dev/null' - systemctl restart avahi-daemon + systemctl restart avahi-daemon - echo 'tox_avahi' >> $COMPLETION_FILE + echo 'tox_avahi' >> $COMPLETION_FILE } function install_tox_node { - if grep -Fxq "install_tox_node" $COMPLETION_FILE; then - return - fi + if grep -Fxq "install_tox_node" $COMPLETION_FILE; then + return + fi - function_check mesh_tox_node - mesh_tox_node + function_check mesh_tox_node + mesh_tox_node - TOX_ONION_HOSTNAME=$(add_onion_service tox ${TOX_PORT} ${TOX_PORT}) + TOX_ONION_HOSTNAME=$(add_onion_service tox ${TOX_PORT} ${TOX_PORT}) - if ! grep -q "tox onion domain" $COMPLETION_FILE; then - echo "tox onion domain:${TOX_ONION_HOSTNAME}" >> $COMPLETION_FILE - else - sed -i "s|tox onion domain.*|tox onion domain:${TOX_ONION_HOSTNAME}|g" $COMPLETION_FILE - fi + if ! grep -q "tox onion domain" $COMPLETION_FILE; then + echo "tox onion domain:${TOX_ONION_HOSTNAME}" >> $COMPLETION_FILE + else + sed -i "s|tox onion domain.*|tox onion domain:${TOX_ONION_HOSTNAME}|g" $COMPLETION_FILE + fi - systemctl restart tox-bootstrapd.service + systemctl restart tox-bootstrapd.service - TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1) - if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then - echo $'Could not obtain the tox node public key' - exit 6529 - fi + TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1) + if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then + echo $'Could not obtain the tox node public key' + exit 6529 + fi - # save the public key for later reference - echo "$TOX_PUBLIC_KEY" > $TOX_BOOTSTRAP_ID_FILE + # save the public key for later reference + echo "$TOX_PUBLIC_KEY" > $TOX_BOOTSTRAP_ID_FILE - function_check configure_firewall_for_tox - configure_firewall_for_tox + function_check configure_firewall_for_tox + configure_firewall_for_tox - if ! grep -q $"Your Tox node public key is" /home/$MY_USERNAME/README; then - echo '' >> /home/$MY_USERNAME/README - echo '' >> /home/$MY_USERNAME/README - echo 'Tox' >> /home/$MY_USERNAME/README - echo '===' >> /home/$MY_USERNAME/README - echo $"tox onion domain: ${TOX_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README - echo $"Your Tox node public key is: $TOX_PUBLIC_KEY" >> /home/$MY_USERNAME/README - echo $'In the Toxic client you can connect to it with:' >> /home/$MY_USERNAME/README - echo " /connect $DEFAULT_DOMAIN_NAME.local $TOX_PORT $TOX_PUBLIC_KEY" >> /home/$MY_USERNAME/README - chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README - chmod 600 /home/$MY_USERNAME/README - fi + if ! grep -q $"Your Tox node public key is" /home/$MY_USERNAME/README; then + echo '' >> /home/$MY_USERNAME/README + echo '' >> /home/$MY_USERNAME/README + echo 'Tox' >> /home/$MY_USERNAME/README + echo '===' >> /home/$MY_USERNAME/README + echo $"tox onion domain: ${TOX_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README + echo $"Your Tox node public key is: $TOX_PUBLIC_KEY" >> /home/$MY_USERNAME/README + echo $'In the Toxic client you can connect to it with:' >> /home/$MY_USERNAME/README + echo " /connect $DEFAULT_DOMAIN_NAME.local $TOX_PORT $TOX_PUBLIC_KEY" >> /home/$MY_USERNAME/README + chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README + chmod 600 /home/$MY_USERNAME/README + fi - function_check configure_firewall_for_tox - configure_firewall_for_tox - echo 'install_tox_node' >> $COMPLETION_FILE + function_check configure_firewall_for_tox + configure_firewall_for_tox + echo 'install_tox_node' >> $COMPLETION_FILE } function install_tox_client { - if grep -Fxq "install_tox_client" $COMPLETION_FILE; then - return - fi + if grep -Fxq "install_tox_client" $COMPLETION_FILE; then + return + fi - function_check mesh_tox_client - mesh_tox_client + function_check mesh_tox_client + mesh_tox_client - echo 'install_tox_client' >> $COMPLETION_FILE + echo 'install_tox_client' >> $COMPLETION_FILE } function mesh_tox_node { - # obtain commits from the main file - TOXCORE_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}') - if [ ${#TOXCORE_COMMIT_MAIN} -gt 10 ]; then - TOXCORE_COMMIT=$TOXCORE_COMMIT_MAIN - fi - if [ ! $TOXCORE_COMMIT ]; then - echo $'No Tox commit was specified' - exit 76325 - fi + # obtain commits from the main file + TOXCORE_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}') + if [ ${#TOXCORE_COMMIT_MAIN} -gt 10 ]; then + TOXCORE_COMMIT=$TOXCORE_COMMIT_MAIN + fi + if [ ! $TOXCORE_COMMIT ]; then + echo $'No Tox commit was specified' + exit 76325 + fi - TOXID_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}') - if [ ${#TOXID_REPO_MAIN} -gt 5 ]; then - TOXID_REPO=$TOXID_REPO_MAIN - fi - if [ ! $TOXID_REPO ]; then - echo $'No ToxID repo was specified' - exit 78252 - fi + TOXID_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXID_REPO=" | head -n 1 | awk -F '"' '{print $2}') + if [ ${#TOXID_REPO_MAIN} -gt 5 ]; then + TOXID_REPO=$TOXID_REPO_MAIN + fi + if [ ! $TOXID_REPO ]; then + echo $'No ToxID repo was specified' + exit 78252 + fi - TOX_PORT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOX_PORT=" | head -n 1 | awk -F '=' '{print $2}') - if [ ${#TOX_PORT_MAIN} -gt 2 ]; then - TOX_PORT=$TOX_PORT_MAIN - fi - if [ ! $TOX_PORT ]; then - echo $'No Tox port was specified' - exit 32856 - fi + TOX_PORT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOX_PORT=" | head -n 1 | awk -F '=' '{print $2}') + if [ ${#TOX_PORT_MAIN} -gt 2 ]; then + TOX_PORT=$TOX_PORT_MAIN + fi + if [ ! $TOX_PORT ]; then + echo $'No Tox port was specified' + exit 32856 + fi - TOXCORE_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_REPO=" | head -n 1 | awk -F '"' '{print $2}') - if [ ${#TOXCORE_REPO_MAIN} -gt 10 ]; then - TOXCORE_REPO=$TOXCORE_REPO_MAIN - fi - if [ ! $TOXCORE_REPO ]; then - echo $'No Tox repo was specified' - exit 16865 - fi + TOXCORE_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXCORE_REPO=" | head -n 1 | awk -F '"' '{print $2}') + if [ ${#TOXCORE_REPO_MAIN} -gt 10 ]; then + TOXCORE_REPO=$TOXCORE_REPO_MAIN + fi + if [ ! $TOXCORE_REPO ]; then + echo $'No Tox repo was specified' + exit 16865 + fi - if [ ! $TOXCORE_COMMIT ]; then - echo $'No Tox commit was specified' - exit 76325 - fi + if [ ! $TOXCORE_COMMIT ]; then + echo $'No Tox commit was specified' + exit 76325 + fi - if [ ! $TOXCORE_REPO ]; then - echo $'No Tox repo was specified' - exit 16865 - fi + if [ ! $TOXCORE_REPO ]; then + echo $'No Tox repo was specified' + exit 16865 + fi - if [ $rootdir ]; then - chroot ${rootdir} apt-get -y install build-essential libtool autotools-dev - chroot ${rootdir} apt-get -y install automake checkinstall check git yasm - chroot ${rootdir} apt-get -y install libsodium13 libsodium-dev libcap2-bin - chroot ${rootdir} apt-get -y install libconfig9 libconfig-dev autoconf - chroot ${rootdir} apt-get -y install libopus-dev libvpx-dev - else - apt-get -y install build-essential libtool autotools-dev - apt-get -y install automake checkinstall check git yasm - apt-get -y install libsodium13 libsodium-dev libcap2-bin - apt-get -y install libconfig9 libconfig-dev autoconf - apt-get -y install libopus-dev libvpx-dev - fi + if [ $rootdir ]; then + chroot ${rootdir} apt-get -y install build-essential libtool autotools-dev + chroot ${rootdir} apt-get -y install automake checkinstall check git yasm + chroot ${rootdir} apt-get -y install libsodium13 libsodium-dev libcap2-bin + chroot ${rootdir} apt-get -y install libconfig9 libconfig-dev autoconf + chroot ${rootdir} apt-get -y install libopus-dev libvpx-dev + else + apt-get -y install build-essential libtool autotools-dev + apt-get -y install automake checkinstall check git yasm + apt-get -y install libsodium13 libsodium-dev libcap2-bin + apt-get -y install libconfig9 libconfig-dev autoconf + apt-get -y install libopus-dev libvpx-dev + fi - if [ ! -d ${rootdir}${INSTALL_DIR} ]; then - mkdir -p ${rootdir}${INSTALL_DIR} - fi - git clone ${TOXCORE_REPO} ${rootdir}${INSTALL_DIR}/toxcore - if [ ! "$?" = "0" ]; then - exit 429252 - fi - cd ${rootdir}$INSTALL_DIR/toxcore - git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT + if [ ! -d ${rootdir}${INSTALL_DIR} ]; then + mkdir -p ${rootdir}${INSTALL_DIR} + fi + git clone ${TOXCORE_REPO} ${rootdir}${INSTALL_DIR}/toxcore + if [ ! "$?" = "0" ]; then + exit 429252 + fi + cd ${rootdir}$INSTALL_DIR/toxcore + git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT - if [ ${rootdir} ]; then - chroot ${rootdir} /bin/bash -x < $TOX_BOOTSTRAP_CONFIG - echo 'keys_file_path = "/var/lib/tox-bootstrapd/keys"' >> $TOX_BOOTSTRAP_CONFIG - echo 'pid_file_path = "/var/run/tox-bootstrapd/tox-bootstrapd.pid"' >> $TOX_BOOTSTRAP_CONFIG - echo 'enable_ipv6 = true' >> $TOX_BOOTSTRAP_CONFIG - echo 'enable_ipv4_fallback = true' >> $TOX_BOOTSTRAP_CONFIG - echo 'enable_lan_discovery = true' >> $TOX_BOOTSTRAP_CONFIG - echo 'enable_tcp_relay = true' >> $TOX_BOOTSTRAP_CONFIG - echo "tcp_relay_ports = [443, 3389, $TOX_PORT]" >> $TOX_BOOTSTRAP_CONFIG - echo 'enable_motd = true' >> $TOX_BOOTSTRAP_CONFIG - echo 'motd = "tox-bootstrapd"' >> $TOX_BOOTSTRAP_CONFIG + # create configuration file + TOX_BOOTSTRAP_CONFIG=$rootdir/etc/tox-bootstrapd.conf + echo "port = $TOX_PORT" > $TOX_BOOTSTRAP_CONFIG + echo 'keys_file_path = "/var/lib/tox-bootstrapd/keys"' >> $TOX_BOOTSTRAP_CONFIG + echo 'pid_file_path = "/var/run/tox-bootstrapd/tox-bootstrapd.pid"' >> $TOX_BOOTSTRAP_CONFIG + echo 'enable_ipv6 = true' >> $TOX_BOOTSTRAP_CONFIG + echo 'enable_ipv4_fallback = true' >> $TOX_BOOTSTRAP_CONFIG + echo 'enable_lan_discovery = true' >> $TOX_BOOTSTRAP_CONFIG + echo 'enable_tcp_relay = true' >> $TOX_BOOTSTRAP_CONFIG + echo "tcp_relay_ports = [443, 3389, $TOX_PORT]" >> $TOX_BOOTSTRAP_CONFIG + echo 'enable_motd = true' >> $TOX_BOOTSTRAP_CONFIG + echo 'motd = "tox-bootstrapd"' >> $TOX_BOOTSTRAP_CONFIG - if [ $TOX_NODES ]; then - echo 'bootstrap_nodes = (' >> $TOX_BOOTSTRAP_CONFIG - toxcount=0 - while [ "x${TOX_NODES[toxcount]}" != "x" ] - do - toxval_ipv4=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $1}') - toxval_ipv6=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $2}') - toxval_port=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $3}') - toxval_pubkey=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $4}') - toxval_maintainer=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $5}') - echo "{ // $toxval_maintainer" >> $TOX_BOOTSTRAP_CONFIG - if [[ $toxval_ipv6 != 'NONE' ]]; then - echo " address = \"$toxval_ipv6\"" >> $TOX_BOOTSTRAP_CONFIG - else - echo " address = \"$toxval_ipv4\"" >> $TOX_BOOTSTRAP_CONFIG - fi - echo " port = $toxval_port" >> $TOX_BOOTSTRAP_CONFIG - echo " public_key = \"$toxval_pubkey\"" >> $TOX_BOOTSTRAP_CONFIG - toxcount=$(( $toxcount + 1 )) - if [ "x${TOX_NODES[toxcount]}" != "x" ]; then - echo "}," >> $TOX_BOOTSTRAP_CONFIG - else - echo "}" >> $TOX_BOOTSTRAP_CONFIG - fi - done - echo ')' >> $TOX_BOOTSTRAP_CONFIG - fi + if [ $TOX_NODES ]; then + echo 'bootstrap_nodes = (' >> $TOX_BOOTSTRAP_CONFIG + toxcount=0 + while [ "x${TOX_NODES[toxcount]}" != "x" ] + do + toxval_ipv4=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $1}') + toxval_ipv6=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $2}') + toxval_port=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $3}') + toxval_pubkey=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $4}') + toxval_maintainer=$(echo $TOX_NODES[toxcount] | awk -F ',' '{print $5}') + echo "{ // $toxval_maintainer" >> $TOX_BOOTSTRAP_CONFIG + if [[ $toxval_ipv6 != 'NONE' ]]; then + echo " address = \"$toxval_ipv6\"" >> $TOX_BOOTSTRAP_CONFIG + else + echo " address = \"$toxval_ipv4\"" >> $TOX_BOOTSTRAP_CONFIG + fi + echo " port = $toxval_port" >> $TOX_BOOTSTRAP_CONFIG + echo " public_key = \"$toxval_pubkey\"" >> $TOX_BOOTSTRAP_CONFIG + toxcount=$(( $toxcount + 1 )) + if [ "x${TOX_NODES[toxcount]}" != "x" ]; then + echo "}," >> $TOX_BOOTSTRAP_CONFIG + else + echo "}" >> $TOX_BOOTSTRAP_CONFIG + fi + done + echo ')' >> $TOX_BOOTSTRAP_CONFIG + fi } function mesh_tox_avahi { - if [ ! -d $rootdir/etc/avahi ]; then - echo $'tox_avahi: avahi is not installed' - exit 87359 - fi + if [ ! -d $rootdir/etc/avahi ]; then + echo $'tox_avahi: avahi is not installed' + exit 87359 + fi - if [ ! $TOXID_REPO ]; then - echo $'No ToxID repo was specified' - exit 78252 - fi + if [ ! $TOXID_REPO ]; then + echo $'No ToxID repo was specified' + exit 78252 + fi - if [ ! -d ${rootdir}${INSTALL_DIR} ]; then - mkdir -p ${rootdir}${INSTALL_DIR} - fi + if [ ! -d ${rootdir}${INSTALL_DIR} ]; then + mkdir -p ${rootdir}${INSTALL_DIR} + fi - git clone ${TOXID_REPO} ${rootdir}${INSTALL_DIR}/toxid - if [ ! -d ${rootdir}${INSTALL_DIR}/toxid ]; then - echo $'Unable to clone toxid repo' - exit 768352 - fi + git clone ${TOXID_REPO} ${rootdir}${INSTALL_DIR}/toxid + if [ ! -d ${rootdir}${INSTALL_DIR}/toxid ]; then + echo $'Unable to clone toxid repo' + exit 768352 + fi - if [ ${rootdir} ]; then - chroot ${rootdir} /bin/bash -x < /dev/null" >> $rootdir/etc/crontab + if [ ! -f $rootdir/usr/local/bin/toxid ]; then + echo $'toxid not found' + exit 74370 + fi + if [ ! -f $rootdir/usr/local/bin/toxavahi ]; then + exit 3621729 + fi + echo "*/1 * * * * root /usr/local/bin/toxavahi > /dev/null" >> $rootdir/etc/crontab } function mesh_tox_client { - TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}') + TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}') - # obtain commits from the main file - TOXIC_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_COMMIT=" | head -n 1 | awk -F "'" '{print $2}') - if [ ${#TOXIC_COMMIT_MAIN} -gt 10 ]; then - TOXIC_COMMIT=$TOXIC_COMMIT_MAIN - fi + # obtain commits from the main file + TOXIC_COMMIT_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_COMMIT=" | head -n 1 | awk -F "'" '{print $2}') + if [ ${#TOXIC_COMMIT_MAIN} -gt 10 ]; then + TOXIC_COMMIT=$TOXIC_COMMIT_MAIN + fi - TOXIC_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_REPO=" | head -n 1 | awk -F '"' '{print $2}') - if [ ${#TOXIC_REPO_MAIN} -gt 5 ]; then - TOXIC_REPO=$TOXIC_REPO_MAIN - fi + TOXIC_REPO_MAIN=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_REPO=" | head -n 1 | awk -F '"' '{print $2}') + if [ ${#TOXIC_REPO_MAIN} -gt 5 ]; then + TOXIC_REPO=$TOXIC_REPO_MAIN + fi - if [ ${rootdir} ]; then - chroot ${rootdir} apt-get -y install libncursesw5-dev libconfig-dev libqrencode-dev - chroot ${rootdir} apt-get -y install libcurl4-openssl-dev libvpx-dev libopenal-dev - else - apt-get -y install libncursesw5-dev libconfig-dev libqrencode-dev - apt-get -y install libcurl4-openssl-dev libvpx-dev libopenal-dev - fi + if [ ${rootdir} ]; then + chroot ${rootdir} apt-get -y install libncursesw5-dev libconfig-dev libqrencode-dev + chroot ${rootdir} apt-get -y install libcurl4-openssl-dev libvpx-dev libopenal-dev + else + apt-get -y install libncursesw5-dev libconfig-dev libqrencode-dev + apt-get -y install libcurl4-openssl-dev libvpx-dev libopenal-dev + fi - TEMP_SCRIPT_NAME=fbtmp728353.sh - TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME - echo '#!/bin/bash' > $TEMP_SCRIPT - echo "mkdir -p $INSTALL_DIR" >> $TEMP_SCRIPT - echo "git clone $TOXIC_REPO $INSTALL_DIR/toxic" >> $TEMP_SCRIPT - echo "cd $INSTALL_DIR/toxic" >> $TEMP_SCRIPT - echo "git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT" >> $TEMP_SCRIPT - echo 'make' >> $TEMP_SCRIPT - echo 'if [ ! "$?" = "0" ]; then' >> $TEMP_SCRIPT - echo ' exit 1' >> $TEMP_SCRIPT - echo 'fi' >> $TEMP_SCRIPT - echo 'make install' >> $TEMP_SCRIPT - echo 'exit 0' >> $TEMP_SCRIPT - chmod +x $TEMP_SCRIPT - cp $TEMP_SCRIPT $rootdir/root/ + TEMP_SCRIPT_NAME=fbtmp728353.sh + TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME + echo '#!/bin/bash' > $TEMP_SCRIPT + echo "mkdir -p $INSTALL_DIR" >> $TEMP_SCRIPT + echo "git clone $TOXIC_REPO $INSTALL_DIR/toxic" >> $TEMP_SCRIPT + echo "cd $INSTALL_DIR/toxic" >> $TEMP_SCRIPT + echo "git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT" >> $TEMP_SCRIPT + echo 'make' >> $TEMP_SCRIPT + echo 'if [ ! "$?" = "0" ]; then' >> $TEMP_SCRIPT + echo ' exit 1' >> $TEMP_SCRIPT + echo 'fi' >> $TEMP_SCRIPT + echo 'make install' >> $TEMP_SCRIPT + echo 'exit 0' >> $TEMP_SCRIPT + chmod +x $TEMP_SCRIPT + cp $TEMP_SCRIPT $rootdir/root/ - TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}') + TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}') - SECONDS=0 - if [ ${rootdir} ]; then - chroot ${rootdir} /root/$TEMP_SCRIPT_NAME - else - /root/$TEMP_SCRIPT_NAME - fi - if [ ! "$?" = "0" ]; then - duration=$SECONDS - echo $"Toxic client compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed." - echo $'Unable to make tox client' - rm $TEMP_SCRIPT - exit 74872 - fi - rm $TEMP_SCRIPT - if [ ! -f $rootdir$TOXIC_FILE ]; then - echo $"Tox client was not installed to $TOXIC_FILE" - exit 63278 - fi - duration=$SECONDS - echo $"Toxic client compile $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed." + SECONDS=0 + if [ ${rootdir} ]; then + chroot ${rootdir} /root/$TEMP_SCRIPT_NAME + else + /root/$TEMP_SCRIPT_NAME + fi + if [ ! "$?" = "0" ]; then + duration=$SECONDS + echo $"Toxic client compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed." + echo $'Unable to make tox client' + rm $TEMP_SCRIPT + exit 74872 + fi + rm $TEMP_SCRIPT + if [ ! -f $rootdir$TOXIC_FILE ]; then + echo $"Tox client was not installed to $TOXIC_FILE" + exit 63278 + fi + duration=$SECONDS + echo $"Toxic client compile $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed." } function enable_tox_repo { - echo 'deb http://download.opensuse.org/repositories/home:/antonbatenev:/tox/Debian_8.0/ /' > $rootdir/etc/apt/sources.list.d/tox.list + echo 'deb http://download.opensuse.org/repositories/home:/antonbatenev:/tox/Debian_8.0/ /' > $rootdir/etc/apt/sources.list.d/tox.list - chroot "$rootdir" wget -q http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_8.0/Release.key -O- | apt-key add - - chroot "$rootdir" apt-get update - echo "Tox Repository Installed." + chroot "$rootdir" wget -q http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_8.0/Release.key -O- | apt-key add - + chroot "$rootdir" apt-get update + echo "Tox Repository Installed." } function install_tox { - if [ ! $INSTALLING_MESH ]; then - if grep -Fxq "install_tox" $COMPLETION_FILE; then - return - fi - fi + if [ ! $INSTALLING_MESH ]; then + if grep -Fxq "install_tox" $COMPLETION_FILE; then + return + fi + fi - configure_firewall_for_tox + configure_firewall_for_tox - if [ $INSTALLING_MESH ]; then - mesh_tox_node - mesh_tox_avahi - mesh_tox_client - else - install_tox_node - tox_avahi - install_tox_client - fi + if [ $INSTALLING_MESH ]; then + mesh_tox_node + mesh_tox_avahi + mesh_tox_client + else + install_tox_node + tox_avahi + install_tox_client + fi - echo 'install_tox' >> $COMPLETION_FILE + echo 'install_tox' >> $COMPLETION_FILE } # NOTE: deliberately no exit 0