瀏覽代碼

Beginning of usb client

Bob Mottram 8 年之前
父節點
當前提交
0f7bad4a0b
共有 2 個檔案被更改,包括 81 行新增1 行删除
  1. 4
    1
      src/freedombone-client
  2. 77
    0
      src/freedombone-image-customise

+ 4
- 1
src/freedombone-client 查看文件

@@ -192,8 +192,11 @@ configure_monkeysphere
192 192
 if [[ $MESH_CLIENT_INSTALL == $'yes' || $MESH_CLIENT_INSTALL == $'y' || $MESH_CLIENT_INSTALL == $'on' ]]; then
193 193
     echo $'Installing mesh packages'
194 194
     sudo apt-get -y install avahi-utils avahi-autoipd avahi-dnsconfd
195
-    ${PROJECT_NAME}-mesh-install -f toxic
195
+    sudo ${PROJECT_NAME}-mesh-install -f tox_node
196
+    sudo ${PROJECT_NAME}-mesh-install -f toxic
196 197
     ${PROJECT_NAME}-mesh-install -f qtox
198
+    sudo ${PROJECT_NAME}-mesh-install -f zeronet
199
+
197 200
     ${PROJECT_NAME}-mesh-install -f batman_client
198 201
 fi
199 202
 echo $'Configuration complete'

+ 77
- 0
src/freedombone-image-customise 查看文件

@@ -994,15 +994,92 @@ initialise_mesh() {
994 994
 
995 995
 # User interface for USB drive installs ######################################
996 996
 
997
+function enable_tox_repo {
998
+	chroot "$rootdir" echo 'deb http://download.opensuse.org/repositories/home:/antonbatenev:/tox/Debian_8.0/ /' > /etc/apt/sources.list.d/tox.list
999
+	chroot "$rootdir" wget http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_8.0/Release.key
1000
+	chroot "$rootdir" apt-key add - < Release.key
1001
+	chroot "$rootdir" apt-get update
1002
+	echo "Tox Repository Installed."
1003
+}
1004
+
1005
+function install_syncthing {
1006
+	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
1007
+		return
1008
+	fi
1009
+
1010
+	chroot "$rootdir" apt-get -y install curl
1011
+
1012
+	chroot "$rootdir" curl -s https://syncthing.net/release-key.txt | apt-key add -
1013
+	chroot "$rootdir" echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
1014
+	chroot "$rootdir" apt-get update
1015
+	chroot "$rootdir" apt-get -y install syncthing
1016
+
1017
+	# This probably does need to run as root so that it can access the Sync directories
1018
+	# in each user's home directory
1019
+	chroot "$rootdir" echo '[Unit]' > /etc/systemd/system/syncthing.service
1020
+	chroot "$rootdir" echo 'Description=Syncthing - Open Source Continuous File Synchronization' >> /etc/systemd/system/syncthing.service
1021
+	chroot "$rootdir" echo 'Documentation=man:syncthing(1)' >> /etc/systemd/system/syncthing.service
1022
+	chroot "$rootdir" echo 'After=network.target' >> /etc/systemd/system/syncthing.service
1023
+	chroot "$rootdir" echo 'Wants=syncthing-inotify@.service' >> /etc/systemd/system/syncthing.service
1024
+	chroot "$rootdir" echo '' >> /etc/systemd/system/syncthing.service
1025
+	chroot "$rootdir" echo '[Service]' >> /etc/systemd/system/syncthing.service
1026
+	chroot "$rootdir" echo 'User=root' >> /etc/systemd/system/syncthing.service
1027
+	chroot "$rootdir" echo "Environment='all_proxy=socks5://localhost:9050'" >> /etc/systemd/system/syncthing.service
1028
+	chroot "$rootdir" echo 'ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0' >> /etc/systemd/system/syncthing.service
1029
+	chroot "$rootdir" echo 'Restart=on-failure' >> /etc/systemd/system/syncthing.service
1030
+	chroot "$rootdir" echo 'SuccessExitStatus=3 4' >> /etc/systemd/system/syncthing.service
1031
+	chroot "$rootdir" echo 'RestartForceExitStatus=3 4' >> /etc/systemd/system/syncthing.service
1032
+	chroot "$rootdir" echo '' >> /etc/systemd/system/syncthing.service
1033
+	chroot "$rootdir" echo '[Install]' >> /etc/systemd/system/syncthing.service
1034
+	chroot "$rootdir" echo 'WantedBy=multi-user.target' >> /etc/systemd/system/syncthing.service
1035
+	chroot "$rootdir" systemctl enable syncthing
1036
+	chroot "$rootdir" systemctl daemon-reload
1037
+
1038
+	if ! grep -q "syncthing" $rootdir/etc/crontab; then
1039
+		chroot "$rootdir" echo "*/1            * *   *   *   root /usr/local/bin/freedombone-syncthing > /dev/null" >> /etc/crontab
1040
+		chroot "$rootdir" systemctl restart cron
1041
+	fi
1042
+
1043
+	echo 'install_syncthing'
1044
+}
1045
+
997 1046
 function configure_user_interface {
998 1047
 	if [[ $VARIANT != "meshclient" && $VARIANT != "usb" ]]; then
999 1048
 		return
1000 1049
 	fi
1001 1050
 
1051
+	# desktop
1002 1052
 	chroot "$rootdir" apt-get -y install mate-desktop-environment
1053
+	
1054
+	# browser
1055
+	chroot "$rootdir" apt-get -y install iceweasel
1056
+	
1057
+	# Tox user interface
1058
+	enable_tox_repo
1059
+	chroot "$rootdir" apt-get -y install qtox
1060
+
1061
+	# Syncthing
1062
+	install_syncthing
1003 1063
 
1004 1064
 	if [[ $VARIANT == "usb" ]]; then
1065
+		# tor
1005 1066
 		chroot "$rootdir" apt-get -y install tor
1067
+
1068
+		# xmpp client
1069
+		chroot "$rootdir" echo "deb ftp://ftp.gajim.org/debian unstable main" > /etc/apt/sources.list.d/gajim.list
1070
+		chroot "$rootdir" apt-get update
1071
+		chroot "$rootdir" apt-get -y install gajim-dev-keyring
1072
+		chroot "$rootdir" apt-get -y install git python-dev python-pip gajim-nightly
1073
+		chroot "$rootdir" mkdir /home/$GENERIC_IMAGE_USERNAME/.local/share/gajim/plugins -p
1074
+		chroot "$rootdir" git clone https://github.com/omemo/gajim-omemo /home/$GENERIC_IMAGE_USERNAME/.local/share/gajim/plugins/gajim-omemo
1075
+		chroot "$rootdir" pip install protobuf==2.6.1, python-axolotl==0.1.35
1076
+		chroot "$rootdir" chown -R $GENERIC_IMAGE_USERNAME:$GENERIC_IMAGE_USERNAME /home/$GENERIC_IMAGE_USERNAME/.local
1077
+
1078
+		# IRC client
1079
+		chroot "$rootdir" apt-get -y install hexchat profanity
1080
+
1081
+		# zeronet
1082
+		
1006 1083
 		# TODO
1007 1084
 	fi
1008 1085
 }