From 0f7bad4a0b933b3aae1806aa1dec8662595f1238 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 8 Jun 2016 22:14:19 +0100 Subject: [PATCH] Beginning of usb client --- src/freedombone-client | 5 ++- src/freedombone-image-customise | 77 +++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/src/freedombone-client b/src/freedombone-client index 17b09fc5..55787cd7 100755 --- a/src/freedombone-client +++ b/src/freedombone-client @@ -192,8 +192,11 @@ configure_monkeysphere if [[ $MESH_CLIENT_INSTALL == $'yes' || $MESH_CLIENT_INSTALL == $'y' || $MESH_CLIENT_INSTALL == $'on' ]]; then echo $'Installing mesh packages' sudo apt-get -y install avahi-utils avahi-autoipd avahi-dnsconfd - ${PROJECT_NAME}-mesh-install -f toxic + sudo ${PROJECT_NAME}-mesh-install -f tox_node + sudo ${PROJECT_NAME}-mesh-install -f toxic ${PROJECT_NAME}-mesh-install -f qtox + sudo ${PROJECT_NAME}-mesh-install -f zeronet + ${PROJECT_NAME}-mesh-install -f batman_client fi echo $'Configuration complete' diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 507721f4..706bc831 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -994,15 +994,92 @@ initialise_mesh() { # User interface for USB drive installs ###################################### +function enable_tox_repo { + chroot "$rootdir" echo 'deb http://download.opensuse.org/repositories/home:/antonbatenev:/tox/Debian_8.0/ /' > /etc/apt/sources.list.d/tox.list + chroot "$rootdir" wget http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_8.0/Release.key + chroot "$rootdir" apt-key add - < Release.key + chroot "$rootdir" apt-get update + echo "Tox Repository Installed." +} + +function install_syncthing { + if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" ]]; then + return + fi + + chroot "$rootdir" apt-get -y install curl + + chroot "$rootdir" curl -s https://syncthing.net/release-key.txt | apt-key add - + chroot "$rootdir" echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list + chroot "$rootdir" apt-get update + chroot "$rootdir" apt-get -y install syncthing + + # This probably does need to run as root so that it can access the Sync directories + # in each user's home directory + chroot "$rootdir" echo '[Unit]' > /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'Description=Syncthing - Open Source Continuous File Synchronization' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'Documentation=man:syncthing(1)' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'After=network.target' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'Wants=syncthing-inotify@.service' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo '' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo '[Service]' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'User=root' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo "Environment='all_proxy=socks5://localhost:9050'" >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'Restart=on-failure' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'SuccessExitStatus=3 4' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'RestartForceExitStatus=3 4' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo '' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo '[Install]' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" echo 'WantedBy=multi-user.target' >> /etc/systemd/system/syncthing.service + chroot "$rootdir" systemctl enable syncthing + chroot "$rootdir" systemctl daemon-reload + + if ! grep -q "syncthing" $rootdir/etc/crontab; then + chroot "$rootdir" echo "*/1 * * * * root /usr/local/bin/freedombone-syncthing > /dev/null" >> /etc/crontab + chroot "$rootdir" systemctl restart cron + fi + + echo 'install_syncthing' +} + function configure_user_interface { if [[ $VARIANT != "meshclient" && $VARIANT != "usb" ]]; then return fi + # desktop chroot "$rootdir" apt-get -y install mate-desktop-environment + + # browser + chroot "$rootdir" apt-get -y install iceweasel + + # Tox user interface + enable_tox_repo + chroot "$rootdir" apt-get -y install qtox + + # Syncthing + install_syncthing if [[ $VARIANT == "usb" ]]; then + # tor chroot "$rootdir" apt-get -y install tor + + # xmpp client + chroot "$rootdir" echo "deb ftp://ftp.gajim.org/debian unstable main" > /etc/apt/sources.list.d/gajim.list + chroot "$rootdir" apt-get update + chroot "$rootdir" apt-get -y install gajim-dev-keyring + chroot "$rootdir" apt-get -y install git python-dev python-pip gajim-nightly + chroot "$rootdir" mkdir /home/$GENERIC_IMAGE_USERNAME/.local/share/gajim/plugins -p + chroot "$rootdir" git clone https://github.com/omemo/gajim-omemo /home/$GENERIC_IMAGE_USERNAME/.local/share/gajim/plugins/gajim-omemo + chroot "$rootdir" pip install protobuf==2.6.1, python-axolotl==0.1.35 + chroot "$rootdir" chown -R $GENERIC_IMAGE_USERNAME:$GENERIC_IMAGE_USERNAME /home/$GENERIC_IMAGE_USERNAME/.local + + # IRC client + chroot "$rootdir" apt-get -y install hexchat profanity + + # zeronet + # TODO fi }