Skip to content
Snippets Groups Projects
freedombone-image-mesh 53.8 KiB
Newer Older
Bob Mottram's avatar
Bob Mottram committed
#!/bin/bash
Bob Mottram's avatar
Bob Mottram committed
#  _____               _           _
# |   __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
# |   __|  _| -_| -_| . | . |     | . | . |   | -_|
# |__|  |_| |___|___|___|___|_|_|_|___|___|_|_|___|
Bob Mottram's avatar
Bob Mottram committed
#
Bob Mottram's avatar
Bob Mottram committed
#                              Freedom in the Cloud
Bob Mottram's avatar
Bob Mottram committed
#
# This command is run on initial install in order to set up a mesh router
#
# License
# =======
#
# This program is free software: you can redistribute it and/or modify
Bob Mottram's avatar
Bob Mottram committed
# it under the terms of the GNU Affero General Public License as published by
Bob Mottram's avatar
Bob Mottram committed
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Bob Mottram's avatar
Bob Mottram committed
# GNU Affero General Public License for more details.
Bob Mottram's avatar
Bob Mottram committed
#
Bob Mottram's avatar
Bob Mottram committed
# You should have received a copy of the GNU Affero General Public License
Bob Mottram's avatar
Bob Mottram committed
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

PROJECT_NAME='freedombone'

export TEXTDOMAIN=${PROJECT_NAME}-image-mesh
export TEXTDOMAINDIR="/usr/share/locale"

Bob Mottram's avatar
Bob Mottram committed
# The browser application to use
BROWSER=firefox
BROWSER_OPTIONS='-private -url'
Bob Mottram's avatar
Bob Mottram committed
MY_USERNAME='fbone'
Bob Mottram's avatar
Bob Mottram committed
PEER_ID=
INSTALL_DIR=/root/build
INSTALL_LOG=/var/log/${PROJECT_NAME}.log
Bob Mottram's avatar
Bob Mottram committed

DEFAULT_USERNAME=fbone

Bob Mottram's avatar
Bob Mottram committed
TOX_NODES=
#TOX_NODES=(
#  '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
#  '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
#)

Bob Mottram's avatar
Bob Mottram committed
MESH_INSTALL_DIR=/var/lib
MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
MESH_INSTALL_SETUP=/root/.initial_mesh_setup
Bob Mottram's avatar
Bob Mottram committed
MESH_AMNESIC=/root/.amnesic
FIRST_BOOT=/home/$MY_USERNAME/.first_boot
Bob Mottram's avatar
Bob Mottram committed
# Tomb containing logs
Bob Mottram's avatar
Bob Mottram committed
TOMB_LOG_SIZE_MB=10
# tmp directory
TOMB_TMP_SIZE_MB=10

# size of the tomb used to store qtox settings
Bob Mottram's avatar
Bob Mottram committed
TOMB_TOX_SIZE_MB=10
Bob Mottram's avatar
Bob Mottram committed
# Tomb containing tox bootstrap
Bob Mottram's avatar
Bob Mottram committed
TOMB_TOX_BOOTSTRAP_SIZE_MB=10
MESH_INSTALL_DIR=/var/lib
IPFS_PORT=4001

CURRENT_BLOG_INDEX=/home/$MY_USERNAME/.blog-index

OPENVPN_SERVER_NAME="server"
OPENVPN_KEY_FILENAME='client.ovpn'
VPN_COUNTRY_CODE="US"
VPN_AREA="Apparent Free Speech Zone"
VPN_LOCATION="Freedomville"
VPN_ORGANISATION="Freedombone"
VPN_UNIT="Freedombone Unit"
STUNNEL_PORT=3439
VPN_TLS_PORT=553
VPN_MESH_TLS_PORT=653

SCUTTLEBOT_PORT=8010
CRYPTPAD_PORT=9003
CRYPTPAD_DIR=/etc/cryptpad

PEERTUBE_DIR=/etc/peertube

function run_system_query_postgresql {
    query=$1
    cd /etc/postgresql || exit 26
    sudo -u postgres psql -c "$query"
}

function create_password {
Bob Mottram's avatar
Bob Mottram committed
    openssl rand -base64 32 | tr -dc A-Za-z0-9 | head -c "${1}" ; echo -n ''
}

function enable_peertube {
    if [ ! -d $PEERTUBE_DIR ]; then
        return
    fi

    PEERTUBE_ADMIN_PASSWORD="$(create_password 10)"

    if [ -d $PEERTUBE_DIR/videos ]; then
        rm -rf $PEERTUBE_DIR/videos/*
    fi
    if [ -d $PEERTUBE_DIR/thumbnails ]; then
        rm -rf $PEERTUBE_DIR/thumbnails/*
    fi

    systemctl restart postgresql
    run_system_query_postgresql "DROP DATABASE peertube;"
    run_system_query_postgresql "CREATE USER peertube WITH PASSWORD '$PEERTUBE_ADMIN_PASSWORD';"
    run_system_query_postgresql "CREATE DATABASE peertube OWNER peertube;"
    run_system_query_postgresql "GRANT ALL PRIVILEGES ON DATABASE peertube to peertube;"
    run_system_query_postgresql "set statement_timeout to 40000;"

    peertube_config_file=$PEERTUBE_DIR/config/production.yaml
    sed -i "s|hostname:.*|hostname: 'P$PEER_ID.local'|g" $peertube_config_file
    sed -i "s|password:.*|password: '$PEERTUBE_ADMIN_PASSWORD'|g" $peertube_config_file

    peertube_nginx_file=/etc/nginx/sites-available/peertube
    sed -i "s|server_name.*|server_name P$PEER_ID.local;|g" $peertube_nginx_file

    chown -R peertube:peertube $PEERTUBE_DIR

    # Set up the web server
    ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube
    if [ -f /etc/nginx/sites-enabled/default ]; then
        rm /etc/nginx/sites-enabled/default
    fi

    systemctl enable peertube
    systemctl daemon-reload
    systemctl start peertube
}

function enable_cryptpad {
    if [ ! -d $CRYPTPAD_DIR ]; then
        return
    fi

    # Set up the web server
    ln -s /etc/nginx/sites-available/cryptpad /etc/nginx/sites-enabled/cryptpad
    if [ -f /etc/nginx/sites-enabled/default ]; then
        rm /etc/nginx/sites-enabled/default
    fi
    if [ ! -d $CRYPTPAD_DIR/customize/api ]; then
        mkdir -p $CRYPTPAD_DIR/customize/api
    fi
Bob Mottram's avatar
Bob Mottram committed
    if [ -f $CRYPTPAD_DIR/config.js ]; then
        sed -i "s|myDomain:.*|myDomain: 'http://P${PEER_ID}.local',|g" $CRYPTPAD_DIR/config.js
    fi
    wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config
    if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then
        echo $'Unable to wget api/config'
    fi
    chown -R cryptpad:cryptpad $CRYPTPAD_DIR
}

# Debian stretch has a problem where the formerly predictable wlan0 and eth0
# device names get assigned random names. This is a hacky workaround.
# Also adding net.ifnames=0 to kernel options on bootloader may work.
function enable_predictable_device_names {
    ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
    update-initramfs -u
}

function create_avahi_mesh_service {
Bob Mottram's avatar
Bob Mottram committed
    service_name=$1
    service_type=$2
    service_protocol=$3
    service_port=$4
    service_description="$5"

    if [ ! -d /etc/avahi ]; then
        echo $'create_avahi_mesh_service: avahi was not installed'
Bob Mottram's avatar
Bob Mottram committed
    fi

Bob Mottram's avatar
Bob Mottram committed
    { echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->';
      echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">';
      echo '<service-group>';
      echo "  <name replace-wildcards=\"yes\">%h ${service_type}</name>";
      echo '  <service>';
      echo "    <type>_${service_type}._${service_protocol}</type>";
      echo "    <port>${service_port}</port>";
      echo "    <txt-record>$service_description</txt-record>";
      echo '  </service>';
      echo '</service-group>'; } > "/etc/avahi/services/${service_name}.service"
Bob Mottram's avatar
Bob Mottram committed
}

Bob Mottram's avatar
Bob Mottram committed
function create_ram_disk {
    ramdisk_size_mb=$1
    if [ ! -d /mnt/ramdisk ]; then
        mkdir -p /mnt/ramdisk
    fi
    if ! grep -q "ramdisk" /etc/fstab; then
Bob Mottram's avatar
Bob Mottram committed
        mount -t tmpfs -o size="${ramdisk_size_mb}m" tmpfs /mnt/ramdisk
        echo "tmpfs       /mnt/ramdisk tmpfs   nodev,nosuid,noexec,nodiratime,size=${ramdisk_size_mb}M   0 0" >> /etc/fstab
        echo $"${ramdisk_size_mb}M ramdisk created for /tmp" >> $INSTALL_LOG
Bob Mottram's avatar
Bob Mottram committed
}

function make_root_read_only {
    if [ ! -d /home/$MY_USERNAME/Desktop ]; then
Bob Mottram's avatar
Bob Mottram committed
        if ! grep -q 'ro,subvol=@' /etc/fstab; then
            sed -i 's|subvol=@|ro,subvol=@|g' /etc/fstab
            echo $'Root filesystem set to read only' >> $INSTALL_LOG
function tmp_ram_disk {
    ramdisk_size_mb=$1
    if [ ! -d /tmp ]; then
        mkdir -p /tmp
    fi
    if ! grep -q '/tmp' /etc/fstab; then
Bob Mottram's avatar
Bob Mottram committed
        mount -t tmpfs -o size="${ramdisk_size_mb}m" tmpfs /tmp
        echo "tmpfs       /tmp tmpfs   nodev,nosuid,noexec,nodiratime,size=${ramdisk_size_mb}M   0 0" >> /etc/fstab
    fi
}

function set_hostname {
    DEFAULT_DOMAIN_NAME="$1"
    echo "$DEFAULT_DOMAIN_NAME" > /etc/hostname
Bob Mottram's avatar
Bob Mottram committed
    hostname "$DEFAULT_DOMAIN_NAME"
    if grep -q "127.0.1.1" /etc/hosts; then
        sed -i "s/127.0.1.1.*/127.0.1.1       $DEFAULT_DOMAIN_NAME/g" /etc/hosts
    else
        echo "127.0.1.1  $DEFAULT_DOMAIN_NAME" >> /etc/hosts
    fi
Bob Mottram's avatar
Bob Mottram committed
function change_avahi_name {
    decarray=( 1 2 3 4 5 6 7 8 9 0 )
    PEER_ID=${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}
    sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
    sed -i "s|host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
Bob Mottram's avatar
Bob Mottram committed
    set_hostname "P$PEER_ID"
    systemctl restart avahi-daemon

    echo "New avahi name for this peer is P$PEER_ID"
    echo $"avahi name changed to P${PEER_ID}.local" >> $INSTALL_LOG
Bob Mottram's avatar
Bob Mottram committed
}

function configure_toxcore {
    echo $'Configuring toxcore' >> $INSTALL_LOG

Bob Mottram's avatar
Bob Mottram committed
    TOXIC_FILE=$(grep "TOXIC_FILE=" "/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox" | head -n 1 | awk -F '=' '{print $2}')

    if [ -f $MESH_AMNESIC ]; then
        # change to the amnesic mount
        sed -i 's|/var/lib/tox-bootstrapd|/media/tox-bootstrapd|g' /etc/tox-bootstrapd.conf
        systemctl stop tox-bootstrapd.service
        sed -i 's|WorkingDirectory=.*|WorkingDirectory=/media/tox-bootstrapd|g' /etc/systemd/system/tox-bootstrapd.service
        systemctl daemon-reload
        userdel -r tox-bootstrapd
        useradd --home-dir /media/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
        chmod 700 /media/tox-bootstrapd
    fi

    echo $'Enabling toxcore daemon' >> $INSTALL_LOG
Bob Mottram's avatar
Bob Mottram committed
    chmod +x /etc/systemd/system/tox-bootstrapd.service
    systemctl enable tox-bootstrapd.service

    echo $'Regenerating Tox bootstrap node keys' >> $INSTALL_LOG
    systemctl stop tox-bootstrapd.service
    if [ -f /var/lib/tox-bootstrapd/keys ]; then
        rm /var/lib/tox-bootstrapd/keys
    fi
    systemctl start tox-bootstrapd.service
    # sleep for a while so that the tox keys can be generated
    sleep 30
    TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
    if [ -f $MESH_AMNESIC ]; then
        TOX_BOOTSTRAP_ID_FILE=/media/tox-bootstrapd/pubkey.txt
    fi
Bob Mottram's avatar
Bob Mottram committed
    TOX_PUBLIC_KEY=$(grep tox /var/log/syslog | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1)
    if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then
        echo $'WARNING: Could not obtain the tox node public key' >> $INSTALL_LOG
    fi

    # save the public key for later reference
    echo "$TOX_PUBLIC_KEY" > $TOX_BOOTSTRAP_ID_FILE
    echo $'Configured toxcore' >> $INSTALL_LOG
Bob Mottram's avatar
Bob Mottram committed
}

Bob Mottram's avatar
Bob Mottram committed
function create_tox_user {
    # remove any existing user
    if [ -f /home/${MY_USERNAME}/.config/tox/data.tox ]; then
        rm -f /home/${MY_USERNAME}/.config/tox/data*
    fi
    if [ -d /home/${MY_USERNAME}/.config/tox/avatars ]; then
        rm -rf /home/${MY_USERNAME}/.config/tox/avatars
    if [ ! -f /home/${MY_USERNAME}/.first_boot ]; then
        touch /home/${MY_USERNAME}/.first_boot
    fi

    if [ ! -d /home/$MY_USERNAME/Desktop ]; then
        return
    fi

    toxid -u $MY_USERNAME -n data
    chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config/tox

    chmod +x /home/$MY_USERNAME/Desktop/*.desktop
    chown ${MY_USERNAME}:${MY_USERNAME} /home/$MY_USERNAME/Desktop/*
    echo $'Created Tox user' >> $INSTALL_LOG
Bob Mottram's avatar
Bob Mottram committed
function desktop_wifi_menu {
    menu_title_str=$'Wifi'
    ssid_title_str=$'Change Wifi SSID'
Bob Mottram's avatar
Bob Mottram committed
    ssid_change_str=$'You may want to make your mesh SSID similar to other\\nSSIDs in order to not stand out from the crowd\\n\\nPlease be aware that other peers will also need to change\\ntheir SSID to the same name in order to be able to\\ncommunicate with them.\\n'
Bob Mottram's avatar
Bob Mottram committed
    option1_str=$"Set wifi SSID"
    option2_str=$"Run wifi monitor"

    { echo '#!/bin/bash';
Bob Mottram's avatar
Bob Mottram committed
      echo "result=\$(zenity  --list  --text \"$menu_title_str\" --radiolist  --column \"\" --column \"\" TRUE \"$option2_str\" FALSE \"$option1_str\" --width 400 --height 200)";
Bob Mottram's avatar
Bob Mottram committed
      echo "case \"\$result\" in";
Bob Mottram's avatar
Bob Mottram committed
      echo "  \"$option2_str\")";
      echo "    mate-terminal --full-screen -e \"sudo batman monitor\"";
      echo '    ;;';
Bob Mottram's avatar
Bob Mottram committed
      echo "  \"$option1_str\")";
Bob Mottram's avatar
Bob Mottram committed
      echo "    WIFI_SSID='mesh'";
      echo "    if [ -f /home/fbone/ssid.txt ]; then";
      echo "      WIFI_SSID=\$(cat /home/fbone/ssid.txt)";
      echo "    fi";
      echo "    NEW_WIFI_SSID=\$(zenity --entry --title=\"$ssid_title_str\" --text=\"$ssid_change_str\" --entry-text \"$WIFI_SSID\")";
      echo "    if [ \"\$NEW_WIFI_SSID\" ]; then";
      echo "      if [ \${#NEW_WIFI_SSID} -gt 2 ]; then";
      echo "        if [[ \"\$NEW_WIFI_SSID\" != \"WIFI_SSID\" ]]; then";
Bob Mottram's avatar
Bob Mottram committed
      echo "          echo -n \"\$NEW_WIFI_SSID\" > /home/fbone/ssid.txt";
Bob Mottram's avatar
Bob Mottram committed
      echo "          mate-terminal --full-screen -e \"sudo batman restart\"";
      echo '        fi';
      echo '      fi';
      echo '    fi';
      echo '    ;;';
      echo 'esac'; } > /usr/bin/wifi-menu
    chmod +x /usr/bin/wifi-menu
}

function show_desktop_icons {
    if [ ! -d /home/$MY_USERNAME/Desktop ]; then
        return
    fi

Bob Mottram's avatar
Bob Mottram committed
    echo '#!/bin/bash' > /home/$MY_USERNAME/.showhelp
    echo "pkill $BROWSER" >> /home/$MY_USERNAME/.showhelp
    echo "$BROWSER $BROWSER_OPTIONS /home/$MY_USERNAME/help/mesh.html" >> /home/$MY_USERNAME/.showhelp
    chmod +x /home/$MY_USERNAME/.showhelp
    chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.showhelp

Bob Mottram's avatar
Bob Mottram committed
    { echo '[Desktop Entry]';
      echo 'Version=1.0';
      echo 'Name=Help';
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[el]=";
      echo "Name[ar]=";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[ca]=Ajuda";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[hi]=";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[fr]=Aidez-moi";
      echo "Name[de]=Hilfe";
      echo "Name[es]=Ayuda";
      echo "Name[it]=Aiuto";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[ru]=";
      echo "Name[zh]=";
Bob Mottram's avatar
Bob Mottram committed
      echo 'Type=Application';
      echo 'Comment=Show help';
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[el]= ";
      echo "Comment[ar]= ";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[ca]=Mostra ajuda";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[hi]= ";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[fr]=Afficher l'aide";
      echo "Comment[de]=Zeig Hilfe";
      echo "Comment[es]=Mostrar ayuda";
      echo "Comment[it]=Mostra aiuto";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[ru]= ";
      echo "Comment[zh]=";
Bob Mottram's avatar
Bob Mottram committed
      echo "Exec=bash -c /home/$MY_USERNAME/.showhelp";
      echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_help.png";
      echo 'Terminal=false';
      echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/help.desktop"

    { echo '[Desktop Entry]';
      echo 'Version=1.0';
      echo 'Name=Wifi';
      echo "Name[el]=Wifi";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[ar]= ";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[ca]=Wifi";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[hi]= - ";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[fr]=Wifi";
      echo "Name[de]=W-lan";
      echo "Name[es]=Wifi";
      echo "Name[it]=Wi-Fi";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[ru]=-";
      echo "Name[zh]=";
Bob Mottram's avatar
Bob Mottram committed
      echo 'Type=Application';
      echo 'Comment=Check wifi status';
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[el]=   wifi";
      echo "Comment[ar]=    ";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[ca]=Comprova l'estat de wifi";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[hi]=    ";
      echo "Comment[fr]=Vrifier l'tat du wifi";
      echo "Comment[de]=WLAN-Status berprfen";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[es]=Verificar el estado del wifi";
      echo "Comment[it]=Controllare lo stato wifi";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[ru]=  wifi";
      echo "Comment[zh]=wifi";
Bob Mottram's avatar
Bob Mottram committed
      echo 'Exec=bash -c /usr/bin/wifi-menu';
Bob Mottram's avatar
Bob Mottram committed
      echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_wifi.png";
      echo 'Terminal=false';
      echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/wifi.desktop"

    { echo '[Desktop Entry]';
      echo 'Version=1.0';
      echo 'Name=Network Restart';
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[el]= ";
      echo "Name[ar]=  ";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[ca]=Reinicia la xarxa";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[hi]=  ";
      echo "Name[fr]=Redmarrage du rseau";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[de]=Netzwerk Neustart";
      echo "Name[es]=Reinicio de red";
      echo "Name[it]=Riavvia rete";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[ru]= ";
      echo "Name[zh]=";
Bob Mottram's avatar
Bob Mottram committed
      echo 'Type=Application';
      echo 'Comment=Restart the mesh network daemon';
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[el]=      ";
      echo "Comment[ar]=    ";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[ca]=Reinicia el dimoni de la xarxa de malla";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[hi]=     ";
      echo "Comment[fr]=Redmarrez le dmon rseau maill";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[de]=Starten Sie den Mesh-Netzwerk-Daemon neu.";
      echo "Comment[es]=Reinicie el daemon de red de malla";
      echo "Comment[it]=Riavviare il daemon della rete mesh";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[ru]=   ";
      echo "Comment[zh]=";
Bob Mottram's avatar
Bob Mottram committed
      echo 'Exec=mate-terminal -e "sudo batman restart 2> /dev/null"';
      echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_restart_network.png";
      echo 'Terminal=false';
      echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/restart.desktop"

    { echo '[Desktop Entry]';
      echo 'Version=1.0';
      echo 'Name=New Identity';
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[el]= ";
      echo "Name[ar]= ";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[ca]=Nova identitat";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[hi]= ";
      echo "Name[fr]=Nouvelle identit";
      echo "Name[de]=Neue Identitt";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[es]=Nueva identidad";
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[it]=Nuova Identit";
      echo "Name[ru]= ";
      echo "Name[zh]=";
Bob Mottram's avatar
Bob Mottram committed
      echo 'Type=Application';
      echo 'Comment=Create a new identity';
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[el]=   ";
      echo "Comment[ar]=  ";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[ca]=Crea una nova identitat";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[hi]=   ";
      echo "Comment[fr]=Crer une nouvelle identit";
      echo "Comment[de]=Erstellen Sie eine neue Identitt";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[es]=Crea una nueva identidad";
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[it]=Crea una nuova identit";
      echo "Comment[ru]=   ";
      echo "Comment[zh]=";
Bob Mottram's avatar
Bob Mottram committed
      echo "Exec=${PROJECT_NAME}-mesh-reset";
      echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_new_identity.png";
      echo 'Terminal=false';
      echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/new_identity.desktop"

    cp "/root/${PROJECT_NAME}/img/icon_kdenlive.png" "/usr/share/${PROJECT_NAME}/avatars/icon_kdenlive.png"

    { echo '#!/usr/bin/env xdg-open';
      echo '# KDE Config File';
      echo '';
      echo '[Desktop Entry]';
      echo 'Name=Video Editor';
      echo 'Name[ast]=Kdenlive';
      echo 'Name[bs]=Kdenlive';
      echo 'Name[ca]=Kdenlive';
      echo 'Name[ca@valencia]=Kdenlive';
      echo 'Name[cs]=Kdenlive';
      echo 'Name[da]=Kdenlive';
      echo 'Name[de]=Kdenlive';
      echo 'Name[el]=Kdenlive';
      echo 'Name[en_GB]=Video Editor';
      echo 'Name[es]=Kdenlive';
      echo 'Name[et]=Kdenlive';
      echo 'Name[fi]=Kdenlive';
      echo 'Name[fr]=Kdenlive';
      echo 'Name[ga]=Kdenlive';
      echo 'Name[gl]=Kdenlive';
      echo 'Name[hu]=Kdenlive';
      echo 'Name[it]=Kdenlive';
      echo 'Name[ja]=Kdenlive';
      echo 'Name[km]=Kdenlive';
      echo 'Name[lt]=Kdenlive';
      echo 'Name[lv]=Kdenlive';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[mr]=--';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[nb]=Kdenlive';
      echo 'Name[nds]=Kdenlive';
      echo 'Name[nl]=Kdenlive';
      echo 'Name[nn]=Kdenlive';
      echo 'Name[pl]=Kdenlive';
      echo 'Name[pt]=Kdenlive';
      echo 'Name[pt_BR]=Kdenlive';
      echo 'Name[ro]=Kdenlive';
      echo 'Name[ru]=Kdenlive';
      echo 'Name[sk]=Kdenlive';
      echo 'Name[sl]=Kdenlive';
      echo 'Name[sv]=Kdenlive';
      echo 'Name[tr]=Kdenlive';
      echo 'Name[ug]=Kdenlive';
      echo 'Name[uk]=Kdenlive';
      echo 'Name[x-test]=xxKdenlivexx';
      echo 'Name[zh_CN]=Kdenlive';
      echo 'Name[zh_TW]=Kdenlive';
      echo 'GenericName=Video Editor';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ar]= ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ast]=Editor de videu';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[bs]=Video ureiva';
      echo 'GenericName[ca]=Editor de vdeo';
      echo 'GenericName[ca@valencia]=Editor de vdeo';
      echo 'GenericName[cs]=Editor vide';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[da]=Videoredigering';
      echo 'GenericName[de]=Video-Editor';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[el]= ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[en_GB]=Video Editor';
      echo 'GenericName[es]=Editor de video';
      echo 'GenericName[et]=Videoredaktor';
      echo 'GenericName[fi]=Videomuokkain';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[fr]=diteur vido';
      echo 'GenericName[ga]=Eagarthir Fse';
      echo 'GenericName[gl]=Editor de vdeo';
      echo 'GenericName[hu]=Videoszerkeszt';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[it]=Editor video';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ja]=';
      echo 'GenericName[km]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[lt]=Video redaktorius';
      echo 'GenericName[lv]=Video redaktors';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[mr]= ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[nb]=Videoredigeringsprogram';
      echo 'GenericName[nl]=Video-bewerker';
      echo 'GenericName[nn]=Videoredigering';
      echo 'GenericName[pl]=Edytor wideo';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[pt]=Editor de Vde';
      echo 'GenericName[pt_BR]=Editor de Vdeo';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ro]=Redactor de imagini';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ru]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[sk]=Editor videa';
      echo 'GenericName[sl]=Urejevalnik videa';
      echo 'GenericName[sv]=Videoeditor';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[tr]=Video Dzenleyici';
      echo 'GenericName[uk]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[x-test]=xxVideo Editorxx';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[zh_CN]=';
      echo 'GenericName[zh_TW]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment=Nonlinear video editor for KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[ar]=    ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[ast]=Editor de videu non llinial pa KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[bs]=Nelinearni video ureiva za KDE';
      echo 'Comment[ca]=Editor de vdeo no lineal per al KDE';
      echo 'Comment[ca@valencia]=Editor de vdeo no lineal per al KDE';
      echo 'Comment[cs]=Nelinern editor vide pro KDE';
      echo 'Comment[da]=Ikke-liner videoredigering til KDE';
      echo 'Comment[de]=Nichtlinearer Video-Editor fr KDE';
      echo 'Comment[el]=      KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[en_GB]=Nonlinear video editor for KDE';
      echo 'Comment[es]=Editor no lineal de video para KDE';
      echo 'Comment[et]=KDE mittelineaarne videoredaktor';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[fi]=Eplineaarinen videomuokkain KDE:lle';
      echo 'Comment[fr]=diteur vido non linaire pour KDE';
      echo 'Comment[gl]=Editor de vdeo non linear para KDE';
      echo 'Comment[hu]=Nemlineris videoszerkeszt a KDE-hez';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[it]=Editor di video non lineare per KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[ja]=KDE ';
      echo 'Comment[km]= KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[lt]=Nelinijinis veido redaktorius skirtas KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[lv]=Nelinerais video redaktors KDE videi';
      echo 'Comment[mr]=    ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[nb]=Videoredigeringsprogram for KDE med dataklipping';
      echo 'Comment[nl]=Niet-lineaire video-bewerker voor KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[nn]=Program for ikkje-liner videoredigering';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[pl]=Nieliniowy edytor wideo dla KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[pt]=Editor de vdeo no-linear para o KDE';
      echo 'Comment[pt_BR]=Editor de vdeo no-linear para o KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[ro]=Redactor de imagini neliniar pentru KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[ru]=   KDE';
      echo 'Comment[sk]=Nelinerny editor videa pre KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[sl]=Ne-linearni urejevalnik videa za KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[sv]=Icke-linjr videoeditor fr KDE';
      echo 'Comment[tr]=KDE iin dorusal olmayan video dzenleyici';
      echo 'Comment[ug]=KDE    ';
      echo 'Comment[uk]=    KDE';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[x-test]=xxNonlinear video editor for KDExx';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[zh_CN]=KDE ';
      echo 'Comment[zh_TW]=KDE ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Type=Application';
      echo 'Exec=kdenlive %U';
      echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_kdenlive.png";
      echo 'X-DocPath=kdenlive/index.html';
      echo 'X-DocPath[cs]=http://cs.wikibooks.org/wiki/Kdenlive';
      echo 'Terminal=false';
      echo 'MimeType=application/x-kdenlive;';
      echo 'Categories=Qt;KDE;AudioVideo;AudioVideoEditing;';
      echo 'Keywords=editing;video;audio;mlt;kde;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[ca]=edici;vdeo;udio;mlt;kde;';
      echo 'Keywords[ca@valencia]=edici;vdeo;udio;mlt;kde;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[da]=redigering;video;lyd;mlt;kde;';
      echo 'Keywords[de]=Editing;Bearbeitung;Schnitt;Videoschnitt;Video;Audio;MLT;';
      echo 'Keywords[en_GB]=editing;video;audio;mlt;kde;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[es]=edicin;video;audio;mlt;kde;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[et]=redigeerimine;muutmine;video;audio;heli;mlt;kde;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[fi]=editing;video;audio;mlt;kde;editointi;ni;';
      echo 'Keywords[fr]=montage;vido;audio;mlt;kde;';
      echo 'Keywords[gl]=editing;edicin;video;vdeo;audio;son;mlt;kde;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[it]=editing;video;audio;mlt;kde;';
      echo 'Keywords[nl]=bewerken;video;audio;mlt;kde;';
      echo 'Keywords[nn]=redigering;video;lyd;mlt;kde;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[pl]=edytowanie;video;wideo;filmy;audio;dwik;mlt;kde;';
      echo 'Keywords[pt]=edio;vdeo;udio;MLT;kde;';
      echo 'Keywords[pt_BR]=edio;vdeo;udio;mlt;kde;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[sk]=editovanie;video;audio;mlt;kde;';
      echo 'Keywords[sl]=urejanje;video;zvok;mlt;kde;';
      echo 'Keywords[sv]=redigering;video;ljud;mlt;kde;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[uk]=editing;video;audio;mlt;kde;;;;;;;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[x-test]=xxeditingxx;xxvideoxx;xxaudioxx;xxmltxx;xxkdexx;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[zh_CN]=editing;video;audio;mlt;kde;;;;';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Keywords[zh_TW]=editing;video;audio;mlt;kde;';
      echo 'X-DBUS-ServiceName=org.kde.kdenlive'; } > "/home/$MY_USERNAME/Desktop/kdenlive.desktop"

    cp "/root/${PROJECT_NAME}/img/icon_photos.png" "/usr/share/${PROJECT_NAME}/avatars/icon_photos.png"

    { echo '#!/usr/bin/env xdg-open';
      echo '[Desktop Entry]';
      echo 'Version=1.0';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[ar]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[as]=Photos';
      echo 'Name[bn_IN]=Shotwell';
      echo 'Name[bs]=Shotwell';
      echo 'Name[ca]=Shotwell';
      echo 'Name[cs]=Shotwell';
      echo 'Name[da]=Shotwell';
      echo 'Name[de]=Shotwell';
      echo 'Name[el]=Shotwell';
      echo 'Name[en_GB]=Photos';
      echo 'Name[es]=Shotwell';
      echo 'Name[et]=Shotwell';
      echo 'Name[eu]=Shotwell';
      echo 'Name[fi]=Shotwell';
      echo 'Name[fr]=Shotwell';
      echo 'Name[gd]=Shotwell';
      echo 'Name[gl]=Shotwell';
      echo 'Name[gu]=Shotwell';
      echo 'Name[he]=Shotwell';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[hi]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[hr]=Shotwell';
      echo 'Name[hu]=Shotwell';
      echo 'Name[id]=Shotwell';
      echo 'Name[it]=Shotwell';
      echo 'Name[ja]=Shotwell';
      echo 'Name[kk]=Shotwell';
      echo 'Name[kn]=Shotwell';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[ko]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[lt]=Shotwell';
      echo 'Name[lv]=Shotwell';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[ml]=';
      echo 'Name[mr]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[nb]=Shotwell';
      echo 'Name[nl]=Shotwell';
      echo 'Name[oc]=Shotwell';
      echo 'Name[or]=Shotwell';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[pa]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[pl]=Shotwell';
      echo 'Name[pt]=Shotwell';
      echo 'Name[pt_BR]=Shotwell';
      echo 'Name[ro]=Shotwell';
      echo 'Name[ru]=Shotwell';
      echo 'Name[sk]=Shotwell';
      echo 'Name[sl]=Shotwell';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[sr]=-';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[sr@latin]=Foto-bunar';
      echo 'Name[sv]=Shotwell';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[ta]=';
      echo 'Name[te]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[tr]=Shotwell';
      echo 'Name[uk]=Shotwell';
      echo 'Name[vi]=Shotwell';
      echo 'Name[zh_CN]=Shotwell';
      echo 'Name[zh_HK]=Shotwell';
      echo 'Name[zh_TW]=Shotwell';
      echo 'Name=Photos';
      echo 'GenericName[af]=Foto Organiseerder';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ar]= ';
      echo "GenericName[as]=' ";
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ast]=Xestor de semeyes';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[bg]=  ';
      echo 'GenericName[bn]= ';
      echo 'GenericName[bn_IN]=  ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[bs]=Organizator Slika';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ca]=Gestor fotogrfic';
      echo 'GenericName[cs]=Sprvce fotografi';
      echo 'GenericName[da]=Billedhndtering';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[de]=Fotoverwaltung';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[el]= ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[en_GB]=Photo Manager';
      echo 'GenericName[es]=Gestor de fotos';
      echo 'GenericName[et]=Fotohaldur';
      echo 'GenericName[eu]=Argazki-kudeatzailea';
      echo 'GenericName[fi]=Valokuvien hallinta';
      echo 'GenericName[fr]=Gestionnaire de photos';
      echo 'GenericName[gd]=Manaidsear dhealbhan';
      echo 'GenericName[gl]=Xestor de fotos';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[gu]= ';
      echo 'GenericName[he]= ';
      echo 'GenericName[hi]= ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[hr]=Upravitelj fotografija';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[hu]=Fnykpkezel';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ia]=Administrator de photos';
      echo 'GenericName[id]=Manajer Foto';
      echo 'GenericName[it]=Gestore di fotografie';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ja]=Shotwell ';
      echo 'GenericName[kk]=  ';
      echo 'GenericName[km]=';
      echo 'GenericName[kn]= ';
      echo 'GenericName[ko]= ';
      echo 'GenericName[ky]= ';
      echo 'GenericName[lt]=Nuotrauk tvarkytuv';
      echo 'GenericName[lv]=Fotogrfiju prvaldnieks';
      echo 'GenericName[mk]=  ';
      echo 'GenericName[ml]= ';
      echo 'GenericName[mr]= ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[nb]=Fotobehandler';
      echo 'GenericName[nl]=Fotobeheerder';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[oc]=Gestionari de ftos';
      echo 'GenericName[or]= ';
      echo 'GenericName[pa]= ';
      echo 'GenericName[pl]=Meneder zdj';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[pt]=Gestor de fotografias';
      echo 'GenericName[pt_BR]=Organizador de fotos';
      echo 'GenericName[ro]=Administrator de fotografii';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ru]= ';
      echo 'GenericName[sk]=Sprvca fotografi';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[sl]=Upravljalnik fotografij';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[sr]= ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[sr@latin]=Upravnik fotografija';
      echo 'GenericName[sv]=Bildhanterare';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName[ta]= ';
      echo 'GenericName[te]= ';
      echo 'GenericName[th]=';
      echo 'GenericName[tr]=Fotoraf Yneticisi';
      echo 'GenericName[uk]= ';
      echo 'GenericName[vi]=Trnh qun l nh';
      echo 'GenericName[zh_CN]=';
      echo 'GenericName[zh_HK]=';
      echo 'GenericName[zh_TW]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'GenericName=Photo Manager';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[cs]=Roztite si sv fotografie';
      echo 'Comment[da]=Organisr dine billeder';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[de]=Ihre Fotos organisieren';
      echo 'Comment[es]=Organice sus fotos';
      echo 'Comment[fi]=Hallitse kuviasi';
      echo 'Comment[gd]=Cuir rian air na dealbhan agad';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[he]=  ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[hr]=Organizirajte svoje fotografije';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[hu]=Rendszerezze a fnykpeit';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[id]=Organisasikan foto Anda';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[kk]= ';
      echo 'Comment[kn]=   ';
      echo 'Comment[ko]= .';
      echo 'Comment[lv]=Organiz savas fotogrfijas';
      echo 'Comment[pl]=Organizowanie zdj';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[pt]=Organize as suas fotografias';
      echo 'Comment[pt_BR]=Organize suas fotos';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[sk]=Organizuje vae fotografie';
      echo 'Comment[sr]=  ';
      echo 'Comment[sr@latin]=Organizujte vae fotografije';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[sv]=Organisera dina bilder';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[uk]=  ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment=Organize your photos';
      echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_photos.png";
      echo 'Exec=shotwell %U';
      echo 'Terminal=false';
      echo 'Type=Application';
      echo 'MimeType=x-content/image-dcf;';
      echo 'Categories=Graphics;Photography;GNOME;GTK;';
      echo 'X-GIO-NoFuse=true';
      echo 'X-GNOME-Gettext-Domain=shotwell';
      echo 'X-GNOME-FullName=Shotwell Photo Manager'; } > "/home/$MY_USERNAME/Desktop/photos.desktop"

    { echo '[Desktop Entry]';
      echo 'Type=Application';
      echo 'Name=Routing Protocol';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[el]= ';
      echo 'Name[ar]= ';
Bob Mottram's avatar
Bob Mottram committed
      echo "Name[ca]=Protocol d'enrutament";
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[hi]= ';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[fr]=Protocole de routage';
      echo 'Name[de]=Routingprotokoll';
      echo 'Name[es]=Protocolo de enrutamiento';
      echo 'Name[it]=Protocollo di routing';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Name[ru]= ';
      echo 'Name[zh]=';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment=Select the mesh routing protocol';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[el]=    ';
      echo 'Comment[ar]=   ';
Bob Mottram's avatar
Bob Mottram committed
      echo "Comment[ca]=Seleccioneu el protocol d'enrutament de malles";
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[hi]=     ';
      echo 'Comment[fr]=Slectionnez le protocole de routage de maillage';
      echo 'Comment[de]=Whlen Sie das Mesh-Routing-Protokoll';
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[es]=Seleccione el protocolo de enrutamiento de malla';
      echo "Comment[it]=Seleziona il protocollo di instradamento della mesh";
Bob Mottram's avatar
Bob Mottram committed
      echo 'Comment[ru]=   ';
      echo 'Comment[zh]=';
Bob Mottram's avatar
Bob Mottram committed
      echo "Exec=mate-terminal -e \"/usr/local/bin/${PROJECT_NAME}-mesh-routing\"";
      echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_routing.png";
      echo 'Terminal=false';
      echo 'Categories=Application'; } > "/home/$MY_USERNAME/Desktop/routing.desktop"
    # set permissions
Bob Mottram's avatar
Bob Mottram committed
    chmod +x /home/$MY_USERNAME/Desktop/*.desktop
Bob Mottram's avatar
Bob Mottram committed
    chown "${MY_USERNAME}":"${MY_USERNAME}" "/home/$MY_USERNAME/Desktop/"*
Bob Mottram's avatar
Bob Mottram committed
    chown "${MY_USERNAME}":"${MY_USERNAME}" "/home/$MY_USERNAME/.config"
    chown -R "${MY_USERNAME}":"${MY_USERNAME}" "/home/$MY_USERNAME/.config/tox"
    chown -R "${MY_USERNAME}":"${MY_USERNAME}" "/home/$MY_USERNAME/.config/autostart"
Bob Mottram's avatar
Bob Mottram committed
    chown "${MY_USERNAME}":"${MY_USERNAME}" /home/$MY_USERNAME/*.sh
    # link to Tahoe-LAFS Magic folder
    #ln -s /home/${MY_USERNAME}/Desktop/${TAHOELAFS_SHARED_DIR} /home/${MY_USERNAME}/${TAHOELAFS_SHARED_DIR}
    # restart caja
    killall caja
    killall mate-panel
Bob Mottram's avatar
Bob Mottram committed
}

Bob Mottram's avatar
Bob Mottram committed
function enable_batman_daemon {
    systemctl enable batman
    systemctl daemon-reload
Bob Mottram's avatar
Bob Mottram committed
function mesh_amnesic {
    if [ ! -f $MESH_AMNESIC ]; then
        return
    fi

Bob Mottram's avatar
Bob Mottram committed
    { echo '#!/bin/bash';
      echo '';
      echo "MY_USERNAME=\$1";
      echo 'tomb slam all';
      echo "if [ -f /home/${MY_USERNAME}/.bash_history ]; then";
Bob Mottram's avatar
Bob Mottram committed
      echo "    rm /home/${MY_USERNAME}/.bash_history";
Bob Mottram's avatar
Bob Mottram committed
      echo 'fi';
      echo "if [ -f /home/${MY_USERNAME}/.xsession-errors ]; then";
Bob Mottram's avatar
Bob Mottram committed
      echo "    rm /home/${MY_USERNAME}/.xsession-errors";
Bob Mottram's avatar
Bob Mottram committed
      echo 'fi';
      echo '';
      echo 'exit 0'; } > /usr/bin/amnesic
    chmod +x /usr/bin/amnesic

    if [ ! -f /etc/systemd/system/amnesic.service ]; then
Bob Mottram's avatar
Bob Mottram committed
        { echo '[Unit]';
          echo 'Description=Amnesic Mesh';
          echo '';
          echo '[Service]';
          echo 'User=root';
          echo 'Group=root';
          echo 'Type=oneshot';
          echo 'RemainAfterExit=true';
          echo 'ExecStart=/bin/true';
          echo "ExecStop=/usr/bin/amnesic $MY_USERNAME";
          echo '';
          echo '[Install]';
          echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/amnesic.service
Bob Mottram's avatar
Bob Mottram committed
        chmod +x /etc/systemd/system/amnesic.service
        systemctl daemon-reload
    fi
    systemctl enable amnesic
    systemctl start amnesic
Bob Mottram's avatar
Bob Mottram committed
function mesh_restart_daemons {
    systemctl restart avahi-daemon
    systemctl restart tox-bootstrapd
    systemctl restart nginx
    echo $'Daemons restarted' >> $INSTALL_LOG
Bob Mottram's avatar
Bob Mottram committed
function create_tomb {
    tomb_name=$1
    tomb_size=$2

Bob Mottram's avatar
Bob Mottram committed
    if [ -f "/tmp/${tomb_name}.tomb" ]; then
        tomb slam "/tmp/${tomb_name}.tomb"
    fi

    # make a temporary password
Bob Mottram's avatar
Bob Mottram committed
    tomb dig -s "${tomb_size}" "/tmp/${tomb_name}.tomb"
    if [ ! -f "/tmp/${tomb_name}.tomb" ]; then
        echo "WARNING: ${tomb_name} tomb did not install properly" >> /var/log/${PROJECT_NAME}.log
        tomb >> /var/log/${PROJECT_NAME}.log
    fi
Bob Mottram's avatar
Bob Mottram committed
    TOMB_TEMP_PASSWORD=$(openssl rand -base64 64 | tr -dc A-Za-z0-9 | head -c 30)

Bob Mottram's avatar
Bob Mottram committed
    tomb forge "/mnt/ramdisk/${tomb_name}.tomb.key" --tomb-pwd "${TOMB_TEMP_PASSWORD}" --unsafe
    tomb lock "/tmp/${tomb_name}.tomb" -k "/mnt/ramdisk/${tomb_name}.tomb.key" --tomb-pwd "${TOMB_TEMP_PASSWORD}" --unsafe
    tomb open "/tmp/${tomb_name}.tomb" -k "/mnt/ramdisk/${tomb_name}.tomb.key" --tomb-pwd "${TOMB_TEMP_PASSWORD}" --unsafe
    # stop stuff from popping up
    pkill caja

    # clear the temporary password
    TOMB_TEMP_PASSWORD=
}

function setup_amnesic_data {
    if [ ! -f $MESH_AMNESIC ]; then
        return
    fi
    if [ ! -d /mnt/ramdisk ]; then
        return
    fi

    # clear crypttab
    if [ -f /etc/crypttab ]; then
Bob Mottram's avatar
Bob Mottram committed
        rm /etc/crypttab
        touch /etc/crypttab
    fi

    tomb_name=log
    create_tomb ${tomb_name} $TOMB_LOG_SIZE_MB
    if [ -d /media/${tomb_name} ]; then
        if [ -d /var/log ]; then
            if [ ! -d /var/log_base ]; then
                mv /var/log /var/log_base
            fi
        fi
        ln -s /media/${tomb_name} /var/log
        if [ -d /var/log_base ]; then
            cp -rp /var/log_base/* /media/${tomb_name}
        fi
        echo "${tomb_name} tomb created" >> $INSTALL_LOG
    else
        echo "WARNING: ${tomb_name} tomb not found" >> $INSTALL_LOG
    fi

    tomb_name=tox-bootstrapd
    if [ -f /etc/systemd/system/${tomb_name}.service ]; then
        systemctl stop ${tomb_name}
    fi
    create_tomb ${tomb_name} $TOMB_TOX_BOOTSTRAP_SIZE_MB
    if [ -d /media/${tomb_name} ]; then
        if [ -d /var/lib/tox-bootstrapd ]; then
            if [ ! -d /var/lib/tox-bootstrapd_base ]; then
                mv /var/lib/tox-bootstrapd /var/lib/tox-bootstrapd_base
            fi
        fi
        if [ -d /var/lib/tox-bootstrapd ]; then
            rm -rf /var/lib/tox-bootstrapd
        fi
        ln -s /media/${tomb_name} /var/lib/tox-bootstrapd
        if [ -d /var/lib/tox-bootstrapd_base ]; then
            cp -rp /var/lib/tox-bootstrapd_base/* /media/${tomb_name}
        fi
        echo "${tomb_name} tomb created" >> $INSTALL_LOG
    else
        echo "WARNING: ${tomb_name} tomb not found" >> $INSTALL_LOG
    fi

    tomb_name=tox
    create_tomb ${tomb_name} $TOMB_TOX_SIZE_MB
    if [ -d /media/${tomb_name} ]; then
        if [ ! -d /home/${MY_USERNAME}/.config ]; then
            mkdir -p /home/${MY_USERNAME}/.config
            chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config
        fi
        if [ -d /home/${MY_USERNAME}/.config/${tomb_name} ]; then
            rm -rf /home/${MY_USERNAME}/.config/${tomb_name}
        fi
        ln -s /media/${tomb_name} /home/${MY_USERNAME}/.config/${tomb_name}
        chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config/${tomb_name}
        chown -R ${MY_USERNAME}:${MY_USERNAME} /media/${tomb_name}
        echo "${tomb_name} tomb created" >> $INSTALL_LOG
    else