freedombone-image-mesh 53KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517
  1. #!/bin/bash
  2. # _____ _ _
  3. # | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
  4. # | __| _| -_| -_| . | . | | . | . | | -_|
  5. # |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
  6. #
  7. # Freedom in the Cloud
  8. #
  9. # This command is run on initial install in order to set up a mesh router
  10. #
  11. # License
  12. # =======
  13. #
  14. # This program is free software: you can redistribute it and/or modify
  15. # it under the terms of the GNU Affero General Public License as published by
  16. # the Free Software Foundation, either version 3 of the License, or
  17. # (at your option) any later version.
  18. #
  19. # This program is distributed in the hope that it will be useful,
  20. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU Affero General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU Affero General Public License
  25. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. PROJECT_NAME='freedombone'
  27. export TEXTDOMAIN=${PROJECT_NAME}-image-mesh
  28. export TEXTDOMAINDIR="/usr/share/locale"
  29. # The browser application to use
  30. BROWSER=firefox
  31. BROWSER_OPTIONS='-private -url'
  32. MY_USERNAME='fbone'
  33. PEER_ID=
  34. INSTALL_DIR=/root/build
  35. INSTALL_LOG=/var/log/${PROJECT_NAME}.log
  36. DEFAULT_USERNAME=fbone
  37. TOX_NODES=
  38. #TOX_NODES=(
  39. # '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
  40. # '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
  41. #)
  42. MESH_INSTALL_DIR=/var/lib
  43. MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
  44. MESH_INSTALL_SETUP=/root/.initial_mesh_setup
  45. MESH_AMNESIC=/root/.amnesic
  46. FIRST_BOOT=/home/$MY_USERNAME/.first_boot
  47. # Tomb containing logs
  48. TOMB_LOG_SIZE_MB=10
  49. # tmp directory
  50. TOMB_TMP_SIZE_MB=10
  51. # size of the tomb used to store qtox settings
  52. TOMB_TOX_SIZE_MB=10
  53. # Tomb containing tox bootstrap
  54. TOMB_TOX_BOOTSTRAP_SIZE_MB=10
  55. MESH_INSTALL_DIR=/var/lib
  56. IPFS_PORT=4001
  57. CURRENT_BLOG_INDEX=/home/$MY_USERNAME/.blog-index
  58. OPENVPN_SERVER_NAME="server"
  59. OPENVPN_KEY_FILENAME='client.ovpn'
  60. VPN_COUNTRY_CODE="US"
  61. VPN_AREA="Apparent Free Speech Zone"
  62. VPN_LOCATION="Freedomville"
  63. VPN_ORGANISATION="Freedombone"
  64. VPN_UNIT="Freedombone Unit"
  65. STUNNEL_PORT=3439
  66. VPN_TLS_PORT=553
  67. VPN_MESH_TLS_PORT=653
  68. SCUTTLEBOT_PORT=8010
  69. CRYPTPAD_PORT=9003
  70. CRYPTPAD_DIR=/etc/cryptpad
  71. PEERTUBE_DIR=/etc/peertube
  72. function run_system_query_postgresql {
  73. query=$1
  74. cd /etc/postgresql || exit 2648246824
  75. sudo -u postgres psql -c "$query"
  76. }
  77. function create_password {
  78. openssl rand -base64 32 | tr -dc A-Za-z0-9 | head -c "${1}" ; echo -n ''
  79. }
  80. function enable_peertube {
  81. if [ ! -d $PEERTUBE_DIR ]; then
  82. return
  83. fi
  84. PEERTUBE_ADMIN_PASSWORD="$(create_password 10)"
  85. if [ -d $PEERTUBE_DIR/videos ]; then
  86. rm -rf $PEERTUBE_DIR/videos/*
  87. fi
  88. if [ -d $PEERTUBE_DIR/thumbnails ]; then
  89. rm -rf $PEERTUBE_DIR/thumbnails/*
  90. fi
  91. systemctl restart postgresql
  92. run_system_query_postgresql "DROP DATABASE peertube;"
  93. run_system_query_postgresql "CREATE USER peertube WITH PASSWORD '$PEERTUBE_ADMIN_PASSWORD';"
  94. run_system_query_postgresql "CREATE DATABASE peertube OWNER peertube;"
  95. run_system_query_postgresql "GRANT ALL PRIVILEGES ON DATABASE peertube to peertube;"
  96. run_system_query_postgresql "set statement_timeout to 40000;"
  97. peertube_config_file=$PEERTUBE_DIR/config/production.yaml
  98. sed -i "s|hostname:.*|hostname: 'P$PEER_ID.local'|g" $peertube_config_file
  99. sed -i "s|password:.*|password: '$PEERTUBE_ADMIN_PASSWORD'|g" $peertube_config_file
  100. peertube_nginx_file=/etc/nginx/sites-available/peertube
  101. sed -i "s|server_name.*|server_name P$PEER_ID.local;|g" $peertube_nginx_file
  102. chown -R peertube:peertube $PEERTUBE_DIR
  103. # Set up the web server
  104. ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube
  105. if [ -f /etc/nginx/sites-enabled/default ]; then
  106. rm /etc/nginx/sites-enabled/default
  107. fi
  108. systemctl enable peertube
  109. systemctl daemon-reload
  110. systemctl start peertube
  111. }
  112. function enable_cryptpad {
  113. if [ ! -d $CRYPTPAD_DIR ]; then
  114. return
  115. fi
  116. # Set up the web server
  117. ln -s /etc/nginx/sites-available/cryptpad /etc/nginx/sites-enabled/cryptpad
  118. if [ -f /etc/nginx/sites-enabled/default ]; then
  119. rm /etc/nginx/sites-enabled/default
  120. fi
  121. if [ ! -d $CRYPTPAD_DIR/customize/api ]; then
  122. mkdir -p $CRYPTPAD_DIR/customize/api
  123. fi
  124. if [ -f $CRYPTPAD_DIR/config.js ]; then
  125. sed -i "s|myDomain:.*|myDomain: 'http://P${PEER_ID}.local',|g" $CRYPTPAD_DIR/config.js
  126. fi
  127. wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config
  128. if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then
  129. echo $'Unable to wget api/config'
  130. exit 89252
  131. fi
  132. chown -R cryptpad:cryptpad $CRYPTPAD_DIR
  133. }
  134. # Debian stretch has a problem where the formerly predictable wlan0 and eth0
  135. # device names get assigned random names. This is a hacky workaround.
  136. # Also adding net.ifnames=0 to kernel options on bootloader may work.
  137. function enable_predictable_device_names {
  138. ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
  139. update-initramfs -u
  140. }
  141. function create_avahi_mesh_service {
  142. service_name=$1
  143. service_type=$2
  144. service_protocol=$3
  145. service_port=$4
  146. service_description="$5"
  147. if [ ! -d /etc/avahi ]; then
  148. echo $'create_avahi_mesh_service: avahi was not installed'
  149. exit 52925
  150. fi
  151. { echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->';
  152. echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">';
  153. echo '<service-group>';
  154. echo " <name replace-wildcards=\"yes\">%h ${service_type}</name>";
  155. echo ' <service>';
  156. echo " <type>_${service_type}._${service_protocol}</type>";
  157. echo " <port>${service_port}</port>";
  158. echo " <txt-record>$service_description</txt-record>";
  159. echo ' </service>';
  160. echo '</service-group>'; } > "/etc/avahi/services/${service_name}.service"
  161. }
  162. function create_ram_disk {
  163. ramdisk_size_mb=$1
  164. if [ ! -d /mnt/ramdisk ]; then
  165. mkdir -p /mnt/ramdisk
  166. fi
  167. if ! grep -q "ramdisk" /etc/fstab; then
  168. mount -t tmpfs -o size="${ramdisk_size_mb}m" tmpfs /mnt/ramdisk
  169. echo "tmpfs /mnt/ramdisk tmpfs nodev,nosuid,noexec,nodiratime,size=${ramdisk_size_mb}M 0 0" >> /etc/fstab
  170. echo $"${ramdisk_size_mb}M ramdisk created for /tmp" >> $INSTALL_LOG
  171. fi
  172. }
  173. function make_root_read_only {
  174. if [ ! -d /home/$MY_USERNAME/Desktop ]; then
  175. if ! grep -q 'ro,subvol=@' /etc/fstab; then
  176. sed -i 's|subvol=@|ro,subvol=@|g' /etc/fstab
  177. echo $'Root filesystem set to read only' >> $INSTALL_LOG
  178. fi
  179. fi
  180. }
  181. function tmp_ram_disk {
  182. ramdisk_size_mb=$1
  183. if [ ! -d /tmp ]; then
  184. mkdir -p /tmp
  185. fi
  186. if ! grep -q '/tmp' /etc/fstab; then
  187. mount -t tmpfs -o size="${ramdisk_size_mb}m" tmpfs /tmp
  188. echo "tmpfs /tmp tmpfs nodev,nosuid,noexec,nodiratime,size=${ramdisk_size_mb}M 0 0" >> /etc/fstab
  189. fi
  190. }
  191. function set_hostname {
  192. DEFAULT_DOMAIN_NAME="$1"
  193. echo "$DEFAULT_DOMAIN_NAME" > /etc/hostname
  194. echo "$DEFAULT_DOMAIN_NAME" > /etc/mailname
  195. hostname "$DEFAULT_DOMAIN_NAME"
  196. if grep -q "127.0.1.1" /etc/hosts; then
  197. sed -i "s/127.0.1.1.*/127.0.1.1 $DEFAULT_DOMAIN_NAME/g" /etc/hosts
  198. else
  199. echo "127.0.1.1 $DEFAULT_DOMAIN_NAME" >> /etc/hosts
  200. fi
  201. }
  202. function change_avahi_name {
  203. decarray=( 1 2 3 4 5 6 7 8 9 0 )
  204. 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]}
  205. sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
  206. sed -i "s|host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
  207. set_hostname "P$PEER_ID"
  208. systemctl restart avahi-daemon
  209. echo "New avahi name for this peer is P$PEER_ID"
  210. echo $"avahi name changed to P${PEER_ID}.local" >> $INSTALL_LOG
  211. }
  212. function configure_toxcore {
  213. echo $'Configuring toxcore' >> $INSTALL_LOG
  214. TOXIC_FILE=$(grep "TOXIC_FILE=" "/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox" | head -n 1 | awk -F '=' '{print $2}')
  215. if [ -f $MESH_AMNESIC ]; then
  216. # change to the amnesic mount
  217. sed -i 's|/var/lib/tox-bootstrapd|/media/tox-bootstrapd|g' /etc/tox-bootstrapd.conf
  218. systemctl stop tox-bootstrapd.service
  219. sed -i 's|WorkingDirectory=.*|WorkingDirectory=/media/tox-bootstrapd|g' /etc/systemd/system/tox-bootstrapd.service
  220. systemctl daemon-reload
  221. userdel -r tox-bootstrapd
  222. 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
  223. chmod 700 /media/tox-bootstrapd
  224. fi
  225. echo $'Enabling toxcore daemon' >> $INSTALL_LOG
  226. chmod +x /etc/systemd/system/tox-bootstrapd.service
  227. systemctl enable tox-bootstrapd.service
  228. echo $'Regenerating Tox bootstrap node keys' >> $INSTALL_LOG
  229. systemctl stop tox-bootstrapd.service
  230. if [ -f /var/lib/tox-bootstrapd/keys ]; then
  231. rm /var/lib/tox-bootstrapd/keys
  232. fi
  233. systemctl start tox-bootstrapd.service
  234. # sleep for a while so that the tox keys can be generated
  235. sleep 30
  236. TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
  237. if [ -f $MESH_AMNESIC ]; then
  238. TOX_BOOTSTRAP_ID_FILE=/media/tox-bootstrapd/pubkey.txt
  239. fi
  240. TOX_PUBLIC_KEY=$(grep tox /var/log/syslog | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1)
  241. if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then
  242. echo $'WARNING: Could not obtain the tox node public key' >> $INSTALL_LOG
  243. exit 46362
  244. fi
  245. # save the public key for later reference
  246. echo "$TOX_PUBLIC_KEY" > $TOX_BOOTSTRAP_ID_FILE
  247. echo $'Configured toxcore' >> $INSTALL_LOG
  248. }
  249. function create_tox_user {
  250. # remove any existing user
  251. if [ -f /home/${MY_USERNAME}/.config/tox/data.tox ]; then
  252. rm -f /home/${MY_USERNAME}/.config/tox/data*
  253. fi
  254. if [ -d /home/${MY_USERNAME}/.config/tox/avatars ]; then
  255. rm -rf /home/${MY_USERNAME}/.config/tox/avatars
  256. fi
  257. if [ ! -f /home/${MY_USERNAME}/.first_boot ]; then
  258. touch /home/${MY_USERNAME}/.first_boot
  259. fi
  260. if [ ! -d /home/$MY_USERNAME/Desktop ]; then
  261. return
  262. fi
  263. toxid -u $MY_USERNAME -n data
  264. chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config/tox
  265. chmod +x /home/$MY_USERNAME/Desktop/*.desktop
  266. chown ${MY_USERNAME}:${MY_USERNAME} /home/$MY_USERNAME/Desktop/*
  267. echo $'Created Tox user' >> $INSTALL_LOG
  268. }
  269. function show_desktop_icons {
  270. if [ ! -d /home/$MY_USERNAME/Desktop ]; then
  271. return
  272. fi
  273. echo '#!/bin/bash' > /home/$MY_USERNAME/.showhelp
  274. echo "pkill $BROWSER" >> /home/$MY_USERNAME/.showhelp
  275. echo "$BROWSER $BROWSER_OPTIONS /home/$MY_USERNAME/help/mesh.html" >> /home/$MY_USERNAME/.showhelp
  276. chmod +x /home/$MY_USERNAME/.showhelp
  277. chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.showhelp
  278. { echo '[Desktop Entry]';
  279. echo 'Version=1.0';
  280. echo 'Name=Help';
  281. echo "Name[el]=";
  282. echo "Name[ar]=";
  283. echo "Name[ca]=Ajuda";
  284. echo "Name[hi]=";
  285. echo "Name[fr]=Aidez-moi";
  286. echo "Name[de]=Hilfe";
  287. echo "Name[es]=Ayuda";
  288. echo "Name[it]=Aiuto";
  289. echo "Name[ru]=";
  290. echo "Name[zh]=";
  291. echo 'Type=Application';
  292. echo 'Comment=Show help';
  293. echo "Comment[el]= ";
  294. echo "Comment[ar]= ";
  295. echo "Comment[ca]=Mostra ajuda";
  296. echo "Comment[hi]= ";
  297. echo "Comment[fr]=Afficher l'aide";
  298. echo "Comment[de]=Zeig Hilfe";
  299. echo "Comment[es]=Mostrar ayuda";
  300. echo "Comment[it]=Mostra aiuto";
  301. echo "Comment[ru]= ";
  302. echo "Comment[zh]=";
  303. echo "Exec=bash -c /home/$MY_USERNAME/.showhelp";
  304. echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_help.png";
  305. echo 'Terminal=false';
  306. echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/help.desktop"
  307. { echo '[Desktop Entry]';
  308. echo 'Version=1.0';
  309. echo 'Name=Wifi';
  310. echo "Name[el]=Wifi";
  311. echo "Name[ar]= ";
  312. echo "Name[ca]=Wifi";
  313. echo "Name[hi]= - ";
  314. echo "Name[fr]=Wifi";
  315. echo "Name[de]=W-lan";
  316. echo "Name[es]=Wifi";
  317. echo "Name[it]=Wi-Fi";
  318. echo "Name[ru]=-";
  319. echo "Name[zh]=";
  320. echo 'Type=Application';
  321. echo 'Comment=Check wifi status';
  322. echo "Comment[el]= wifi";
  323. echo "Comment[ar]= ";
  324. echo "Comment[ca]=Comprova l'estat de wifi";
  325. echo "Comment[hi]= ";
  326. echo "Comment[fr]=Vrifier l'tat du wifi";
  327. echo "Comment[de]=WLAN-Status berprfen";
  328. echo "Comment[es]=Verificar el estado del wifi";
  329. echo "Comment[it]=Controllare lo stato wifi";
  330. echo "Comment[ru]= wifi";
  331. echo "Comment[zh]=wifi";
  332. echo 'Exec=mate-terminal --full-screen -e "sudo batman monitor"';
  333. echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_wifi.png";
  334. echo 'Terminal=false';
  335. echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/wifi.desktop"
  336. { echo '[Desktop Entry]';
  337. echo 'Version=1.0';
  338. echo 'Name=Network Restart';
  339. echo "Name[el]= ";
  340. echo "Name[ar]= ";
  341. echo "Name[ca]=Reinicia la xarxa";
  342. echo "Name[hi]= ";
  343. echo "Name[fr]=Redmarrage du rseau";
  344. echo "Name[de]=Netzwerk Neustart";
  345. echo "Name[es]=Reinicio de red";
  346. echo "Name[it]=Riavvia rete";
  347. echo "Name[ru]= ";
  348. echo "Name[zh]=";
  349. echo 'Type=Application';
  350. echo 'Comment=Restart the mesh network daemon';
  351. echo "Comment[el]= ";
  352. echo "Comment[ar]= ";
  353. echo "Comment[ca]=Reinicia el dimoni de la xarxa de malla";
  354. echo "Comment[hi]= ";
  355. echo "Comment[fr]=Redmarrez le dmon rseau maill";
  356. echo "Comment[de]=Starten Sie den Mesh-Netzwerk-Daemon neu.";
  357. echo "Comment[es]=Reinicie el daemon de red de malla";
  358. echo "Comment[it]=Riavviare il daemon della rete mesh";
  359. echo "Comment[ru]= ";
  360. echo "Comment[zh]=";
  361. echo 'Exec=mate-terminal -e "sudo batman restart 2> /dev/null"';
  362. echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_restart_network.png";
  363. echo 'Terminal=false';
  364. echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/restart.desktop"
  365. { echo '[Desktop Entry]';
  366. echo 'Version=1.0';
  367. echo 'Name=New Identity';
  368. echo "Name[el]= ";
  369. echo "Name[ar]= ";
  370. echo "Name[ca]=Nova identitat";
  371. echo "Name[hi]= ";
  372. echo "Name[fr]=Nouvelle identit";
  373. echo "Name[de]=Neue Identitt";
  374. echo "Name[es]=Nueva identidad";
  375. echo "Name[it]=Nuova Identit";
  376. echo "Name[ru]= ";
  377. echo "Name[zh]=";
  378. echo 'Type=Application';
  379. echo 'Comment=Create a new identity';
  380. echo "Comment[el]= ";
  381. echo "Comment[ar]= ";
  382. echo "Comment[ca]=Crea una nova identitat";
  383. echo "Comment[hi]= ";
  384. echo "Comment[fr]=Crer une nouvelle identit";
  385. echo "Comment[de]=Erstellen Sie eine neue Identitt";
  386. echo "Comment[es]=Crea una nueva identidad";
  387. echo "Comment[it]=Crea una nuova identit";
  388. echo "Comment[ru]= ";
  389. echo "Comment[zh]=";
  390. echo "Exec=${PROJECT_NAME}-mesh-reset";
  391. echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_new_identity.png";
  392. echo 'Terminal=false';
  393. echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/new_identity.desktop"
  394. { echo '[Desktop Entry]';
  395. echo 'Name=Social';
  396. echo 'Name[el]=';
  397. echo 'Name[ar]=';
  398. echo 'Name[ca]=Social';
  399. echo 'Name[hi]=';
  400. echo 'Name[fr]=Social';
  401. echo 'Name[de]=Soziale';
  402. echo 'Name[es]=Social';
  403. echo 'Name[it]=Sociale';
  404. echo 'Name[ru]=';
  405. echo 'Name[zh]=';
  406. echo 'Type=Application';
  407. echo "Comment=A decentralized messaging and sharing app built on top of Secure Scuttlebutt";
  408. echo "Comment[el]= Secure Scuttlebutt";
  409. echo "Comment[ar]= ()";
  410. echo "Comment[ca]=Una aplicaci de missatgeria i distribuci descentralitzada integrada a Secure Scuttlebutt";
  411. echo "Comment[hi]= () ";
  412. echo "Comment[fr]=Une application de messagerie et de partage dcentralise base sur Secure Scuttlebutt";
  413. echo "Comment[de]=Eine dezentralisierte Messaging- und Sharing-App, die auf Secure Scuttlebutt basiert";
  414. echo "Comment[es]=Una aplicacin de mensajera y uso compartido descentralizada construida sobre Secure Scuttlebutt";
  415. echo "Comment[it]=Un'applicazione decentralizzata di messaggistica e condivisione costruita sulla base di Secure Shuttlebutt";
  416. echo "Comment[ru]= , Secure Scuttlebutt";
  417. echo "Comment[zh]=Scuttlebutt";
  418. echo 'Exec=bash /usr/bin/start_patchwork';
  419. echo "Icon=/usr/share/$PROJECT_NAME/avatars/icon_social.png";
  420. echo 'Terminal=false';
  421. echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/social.desktop"
  422. cp "/root/${PROJECT_NAME}/img/icon_kdenlive.png" "/usr/share/${PROJECT_NAME}/avatars/icon_kdenlive.png"
  423. { echo '#!/usr/bin/env xdg-open';
  424. echo '# KDE Config File';
  425. echo '';
  426. echo '[Desktop Entry]';
  427. echo 'Name=Video Editor';
  428. echo 'Name[ast]=Kdenlive';
  429. echo 'Name[bs]=Kdenlive';
  430. echo 'Name[ca]=Kdenlive';
  431. echo 'Name[ca@valencia]=Kdenlive';
  432. echo 'Name[cs]=Kdenlive';
  433. echo 'Name[da]=Kdenlive';
  434. echo 'Name[de]=Kdenlive';
  435. echo 'Name[el]=Kdenlive';
  436. echo 'Name[en_GB]=Video Editor';
  437. echo 'Name[es]=Kdenlive';
  438. echo 'Name[et]=Kdenlive';
  439. echo 'Name[fi]=Kdenlive';
  440. echo 'Name[fr]=Kdenlive';
  441. echo 'Name[ga]=Kdenlive';
  442. echo 'Name[gl]=Kdenlive';
  443. echo 'Name[hu]=Kdenlive';
  444. echo 'Name[it]=Kdenlive';
  445. echo 'Name[ja]=Kdenlive';
  446. echo 'Name[km]=Kdenlive';
  447. echo 'Name[lt]=Kdenlive';
  448. echo 'Name[lv]=Kdenlive';
  449. echo 'Name[mr]=--';
  450. echo 'Name[nb]=Kdenlive';
  451. echo 'Name[nds]=Kdenlive';
  452. echo 'Name[nl]=Kdenlive';
  453. echo 'Name[nn]=Kdenlive';
  454. echo 'Name[pl]=Kdenlive';
  455. echo 'Name[pt]=Kdenlive';
  456. echo 'Name[pt_BR]=Kdenlive';
  457. echo 'Name[ro]=Kdenlive';
  458. echo 'Name[ru]=Kdenlive';
  459. echo 'Name[sk]=Kdenlive';
  460. echo 'Name[sl]=Kdenlive';
  461. echo 'Name[sv]=Kdenlive';
  462. echo 'Name[tr]=Kdenlive';
  463. echo 'Name[ug]=Kdenlive';
  464. echo 'Name[uk]=Kdenlive';
  465. echo 'Name[x-test]=xxKdenlivexx';
  466. echo 'Name[zh_CN]=Kdenlive';
  467. echo 'Name[zh_TW]=Kdenlive';
  468. echo 'GenericName=Video Editor';
  469. echo 'GenericName[ar]= ';
  470. echo 'GenericName[ast]=Editor de videu';
  471. echo 'GenericName[bs]=Video ureiva';
  472. echo 'GenericName[ca]=Editor de vdeo';
  473. echo 'GenericName[ca@valencia]=Editor de vdeo';
  474. echo 'GenericName[cs]=Editor vide';
  475. echo 'GenericName[da]=Videoredigering';
  476. echo 'GenericName[de]=Video-Editor';
  477. echo 'GenericName[el]= ';
  478. echo 'GenericName[en_GB]=Video Editor';
  479. echo 'GenericName[es]=Editor de video';
  480. echo 'GenericName[et]=Videoredaktor';
  481. echo 'GenericName[fi]=Videomuokkain';
  482. echo 'GenericName[fr]=diteur vido';
  483. echo 'GenericName[ga]=Eagarthir Fse';
  484. echo 'GenericName[gl]=Editor de vdeo';
  485. echo 'GenericName[hu]=Videoszerkeszt';
  486. echo 'GenericName[it]=Editor video';
  487. echo 'GenericName[ja]=';
  488. echo 'GenericName[km]=';
  489. echo 'GenericName[lt]=Video redaktorius';
  490. echo 'GenericName[lv]=Video redaktors';
  491. echo 'GenericName[mr]= ';
  492. echo 'GenericName[nb]=Videoredigeringsprogram';
  493. echo 'GenericName[nl]=Video-bewerker';
  494. echo 'GenericName[nn]=Videoredigering';
  495. echo 'GenericName[pl]=Edytor wideo';
  496. echo 'GenericName[pt]=Editor de Vde';
  497. echo 'GenericName[pt_BR]=Editor de Vdeo';
  498. echo 'GenericName[ro]=Redactor de imagini';
  499. echo 'GenericName[ru]=';
  500. echo 'GenericName[sk]=Editor videa';
  501. echo 'GenericName[sl]=Urejevalnik videa';
  502. echo 'GenericName[sv]=Videoeditor';
  503. echo 'GenericName[tr]=Video Dzenleyici';
  504. echo 'GenericName[uk]=';
  505. echo 'GenericName[x-test]=xxVideo Editorxx';
  506. echo 'GenericName[zh_CN]=';
  507. echo 'GenericName[zh_TW]=';
  508. echo 'Comment=Nonlinear video editor for KDE';
  509. echo 'Comment[ar]= ';
  510. echo 'Comment[ast]=Editor de videu non llinial pa KDE';
  511. echo 'Comment[bs]=Nelinearni video ureiva za KDE';
  512. echo 'Comment[ca]=Editor de vdeo no lineal per al KDE';
  513. echo 'Comment[ca@valencia]=Editor de vdeo no lineal per al KDE';
  514. echo 'Comment[cs]=Nelinern editor vide pro KDE';
  515. echo 'Comment[da]=Ikke-liner videoredigering til KDE';
  516. echo 'Comment[de]=Nichtlinearer Video-Editor fr KDE';
  517. echo 'Comment[el]= KDE';
  518. echo 'Comment[en_GB]=Nonlinear video editor for KDE';
  519. echo 'Comment[es]=Editor no lineal de video para KDE';
  520. echo 'Comment[et]=KDE mittelineaarne videoredaktor';
  521. echo 'Comment[fi]=Eplineaarinen videomuokkain KDE:lle';
  522. echo 'Comment[fr]=diteur vido non linaire pour KDE';
  523. echo 'Comment[gl]=Editor de vdeo non linear para KDE';
  524. echo 'Comment[hu]=Nemlineris videoszerkeszt a KDE-hez';
  525. echo 'Comment[it]=Editor di video non lineare per KDE';
  526. echo 'Comment[ja]=KDE ';
  527. echo 'Comment[km]= KDE';
  528. echo 'Comment[lt]=Nelinijinis veido redaktorius skirtas KDE';
  529. echo 'Comment[lv]=Nelinerais video redaktors KDE videi';
  530. echo 'Comment[mr]= ';
  531. echo 'Comment[nb]=Videoredigeringsprogram for KDE med dataklipping';
  532. echo 'Comment[nl]=Niet-lineaire video-bewerker voor KDE';
  533. echo 'Comment[nn]=Program for ikkje-liner videoredigering';
  534. echo 'Comment[pl]=Nieliniowy edytor wideo dla KDE';
  535. echo 'Comment[pt]=Editor de vdeo no-linear para o KDE';
  536. echo 'Comment[pt_BR]=Editor de vdeo no-linear para o KDE';
  537. echo 'Comment[ro]=Redactor de imagini neliniar pentru KDE';
  538. echo 'Comment[ru]= KDE';
  539. echo 'Comment[sk]=Nelinerny editor videa pre KDE';
  540. echo 'Comment[sl]=Ne-linearni urejevalnik videa za KDE';
  541. echo 'Comment[sv]=Icke-linjr videoeditor fr KDE';
  542. echo 'Comment[tr]=KDE iin dorusal olmayan video dzenleyici';
  543. echo 'Comment[ug]=KDE ';
  544. echo 'Comment[uk]= KDE';
  545. echo 'Comment[x-test]=xxNonlinear video editor for KDExx';
  546. echo 'Comment[zh_CN]=KDE ';
  547. echo 'Comment[zh_TW]=KDE ';
  548. echo 'Type=Application';
  549. echo 'Exec=kdenlive %U';
  550. echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_kdenlive.png";
  551. echo 'X-DocPath=kdenlive/index.html';
  552. echo 'X-DocPath[cs]=http://cs.wikibooks.org/wiki/Kdenlive';
  553. echo 'Terminal=false';
  554. echo 'MimeType=application/x-kdenlive;';
  555. echo 'Categories=Qt;KDE;AudioVideo;AudioVideoEditing;';
  556. echo 'Keywords=editing;video;audio;mlt;kde;';
  557. echo 'Keywords[ca]=edici;vdeo;udio;mlt;kde;';
  558. echo 'Keywords[ca@valencia]=edici;vdeo;udio;mlt;kde;';
  559. echo 'Keywords[da]=redigering;video;lyd;mlt;kde;';
  560. echo 'Keywords[de]=Editing;Bearbeitung;Schnitt;Videoschnitt;Video;Audio;MLT;';
  561. echo 'Keywords[en_GB]=editing;video;audio;mlt;kde;';
  562. echo 'Keywords[es]=edicin;video;audio;mlt;kde;';
  563. echo 'Keywords[et]=redigeerimine;muutmine;video;audio;heli;mlt;kde;';
  564. echo 'Keywords[fi]=editing;video;audio;mlt;kde;editointi;ni;';
  565. echo 'Keywords[fr]=montage;vido;audio;mlt;kde;';
  566. echo 'Keywords[gl]=editing;edicin;video;vdeo;audio;son;mlt;kde;';
  567. echo 'Keywords[it]=editing;video;audio;mlt;kde;';
  568. echo 'Keywords[nl]=bewerken;video;audio;mlt;kde;';
  569. echo 'Keywords[nn]=redigering;video;lyd;mlt;kde;';
  570. echo 'Keywords[pl]=edytowanie;video;wideo;filmy;audio;dwik;mlt;kde;';
  571. echo 'Keywords[pt]=edio;vdeo;udio;MLT;kde;';
  572. echo 'Keywords[pt_BR]=edio;vdeo;udio;mlt;kde;';
  573. echo 'Keywords[sk]=editovanie;video;audio;mlt;kde;';
  574. echo 'Keywords[sl]=urejanje;video;zvok;mlt;kde;';
  575. echo 'Keywords[sv]=redigering;video;ljud;mlt;kde;';
  576. echo 'Keywords[uk]=editing;video;audio;mlt;kde;;;;;;;';
  577. echo 'Keywords[x-test]=xxeditingxx;xxvideoxx;xxaudioxx;xxmltxx;xxkdexx;';
  578. echo 'Keywords[zh_CN]=editing;video;audio;mlt;kde;;;;';
  579. echo 'Keywords[zh_TW]=editing;video;audio;mlt;kde;';
  580. echo 'X-DBUS-ServiceName=org.kde.kdenlive'; } > "/home/$MY_USERNAME/Desktop/kdenlive.desktop"
  581. cp "/root/${PROJECT_NAME}/img/icon_photos.png" "/usr/share/${PROJECT_NAME}/avatars/icon_photos.png"
  582. { echo '#!/usr/bin/env xdg-open';
  583. echo '[Desktop Entry]';
  584. echo 'Version=1.0';
  585. echo 'Name[ar]=';
  586. echo 'Name[as]=Photos';
  587. echo 'Name[bn_IN]=Shotwell';
  588. echo 'Name[bs]=Shotwell';
  589. echo 'Name[ca]=Shotwell';
  590. echo 'Name[cs]=Shotwell';
  591. echo 'Name[da]=Shotwell';
  592. echo 'Name[de]=Shotwell';
  593. echo 'Name[el]=Shotwell';
  594. echo 'Name[en_GB]=Photos';
  595. echo 'Name[es]=Shotwell';
  596. echo 'Name[et]=Shotwell';
  597. echo 'Name[eu]=Shotwell';
  598. echo 'Name[fi]=Shotwell';
  599. echo 'Name[fr]=Shotwell';
  600. echo 'Name[gd]=Shotwell';
  601. echo 'Name[gl]=Shotwell';
  602. echo 'Name[gu]=Shotwell';
  603. echo 'Name[he]=Shotwell';
  604. echo 'Name[hi]=';
  605. echo 'Name[hr]=Shotwell';
  606. echo 'Name[hu]=Shotwell';
  607. echo 'Name[id]=Shotwell';
  608. echo 'Name[it]=Shotwell';
  609. echo 'Name[ja]=Shotwell';
  610. echo 'Name[kk]=Shotwell';
  611. echo 'Name[kn]=Shotwell';
  612. echo 'Name[ko]=';
  613. echo 'Name[lt]=Shotwell';
  614. echo 'Name[lv]=Shotwell';
  615. echo 'Name[ml]=';
  616. echo 'Name[mr]=';
  617. echo 'Name[nb]=Shotwell';
  618. echo 'Name[nl]=Shotwell';
  619. echo 'Name[oc]=Shotwell';
  620. echo 'Name[or]=Shotwell';
  621. echo 'Name[pa]=';
  622. echo 'Name[pl]=Shotwell';
  623. echo 'Name[pt]=Shotwell';
  624. echo 'Name[pt_BR]=Shotwell';
  625. echo 'Name[ro]=Shotwell';
  626. echo 'Name[ru]=Shotwell';
  627. echo 'Name[sk]=Shotwell';
  628. echo 'Name[sl]=Shotwell';
  629. echo 'Name[sr]=-';
  630. echo 'Name[sr@latin]=Foto-bunar';
  631. echo 'Name[sv]=Shotwell';
  632. echo 'Name[ta]=';
  633. echo 'Name[te]=';
  634. echo 'Name[tr]=Shotwell';
  635. echo 'Name[uk]=Shotwell';
  636. echo 'Name[vi]=Shotwell';
  637. echo 'Name[zh_CN]=Shotwell';
  638. echo 'Name[zh_HK]=Shotwell';
  639. echo 'Name[zh_TW]=Shotwell';
  640. echo 'Name=Photos';
  641. echo 'GenericName[af]=Foto Organiseerder';
  642. echo 'GenericName[ar]= ';
  643. echo "GenericName[as]=' ";
  644. echo 'GenericName[ast]=Xestor de semeyes';
  645. echo 'GenericName[bg]= ';
  646. echo 'GenericName[bn]= ';
  647. echo 'GenericName[bn_IN]= ';
  648. echo 'GenericName[bs]=Organizator Slika';
  649. echo 'GenericName[ca]=Gestor fotogrfic';
  650. echo 'GenericName[cs]=Sprvce fotografi';
  651. echo 'GenericName[da]=Billedhndtering';
  652. echo 'GenericName[de]=Fotoverwaltung';
  653. echo 'GenericName[el]= ';
  654. echo 'GenericName[en_GB]=Photo Manager';
  655. echo 'GenericName[es]=Gestor de fotos';
  656. echo 'GenericName[et]=Fotohaldur';
  657. echo 'GenericName[eu]=Argazki-kudeatzailea';
  658. echo 'GenericName[fi]=Valokuvien hallinta';
  659. echo 'GenericName[fr]=Gestionnaire de photos';
  660. echo 'GenericName[gd]=Manaidsear dhealbhan';
  661. echo 'GenericName[gl]=Xestor de fotos';
  662. echo 'GenericName[gu]= ';
  663. echo 'GenericName[he]= ';
  664. echo 'GenericName[hi]= ';
  665. echo 'GenericName[hr]=Upravitelj fotografija';
  666. echo 'GenericName[hu]=Fnykpkezel';
  667. echo 'GenericName[ia]=Administrator de photos';
  668. echo 'GenericName[id]=Manajer Foto';
  669. echo 'GenericName[it]=Gestore di fotografie';
  670. echo 'GenericName[ja]=Shotwell ';
  671. echo 'GenericName[kk]= ';
  672. echo 'GenericName[km]=';
  673. echo 'GenericName[kn]= ';
  674. echo 'GenericName[ko]= ';
  675. echo 'GenericName[ky]= ';
  676. echo 'GenericName[lt]=Nuotrauk tvarkytuv';
  677. echo 'GenericName[lv]=Fotogrfiju prvaldnieks';
  678. echo 'GenericName[mk]= ';
  679. echo 'GenericName[ml]= ';
  680. echo 'GenericName[mr]= ';
  681. echo 'GenericName[nb]=Fotobehandler';
  682. echo 'GenericName[nl]=Fotobeheerder';
  683. echo 'GenericName[oc]=Gestionari de ftos';
  684. echo 'GenericName[or]= ';
  685. echo 'GenericName[pa]= ';
  686. echo 'GenericName[pl]=Meneder zdj';
  687. echo 'GenericName[pt]=Gestor de fotografias';
  688. echo 'GenericName[pt_BR]=Organizador de fotos';
  689. echo 'GenericName[ro]=Administrator de fotografii';
  690. echo 'GenericName[ru]= ';
  691. echo 'GenericName[sk]=Sprvca fotografi';
  692. echo 'GenericName[sl]=Upravljalnik fotografij';
  693. echo 'GenericName[sr]= ';
  694. echo 'GenericName[sr@latin]=Upravnik fotografija';
  695. echo 'GenericName[sv]=Bildhanterare';
  696. echo 'GenericName[ta]= ';
  697. echo 'GenericName[te]= ';
  698. echo 'GenericName[th]=';
  699. echo 'GenericName[tr]=Fotoraf Yneticisi';
  700. echo 'GenericName[uk]= ';
  701. echo 'GenericName[vi]=Trnh qun l nh';
  702. echo 'GenericName[zh_CN]=';
  703. echo 'GenericName[zh_HK]=';
  704. echo 'GenericName[zh_TW]=';
  705. echo 'GenericName=Photo Manager';
  706. echo 'Comment[cs]=Roztite si sv fotografie';
  707. echo 'Comment[da]=Organisr dine billeder';
  708. echo 'Comment[de]=Ihre Fotos organisieren';
  709. echo 'Comment[es]=Organice sus fotos';
  710. echo 'Comment[fi]=Hallitse kuviasi';
  711. echo 'Comment[gd]=Cuir rian air na dealbhan agad';
  712. echo 'Comment[he]= ';
  713. echo 'Comment[hr]=Organizirajte svoje fotografije';
  714. echo 'Comment[hu]=Rendszerezze a fnykpeit';
  715. echo 'Comment[id]=Organisasikan foto Anda';
  716. echo 'Comment[kk]= ';
  717. echo 'Comment[kn]= ';
  718. echo 'Comment[ko]= .';
  719. echo 'Comment[lv]=Organiz savas fotogrfijas';
  720. echo 'Comment[pl]=Organizowanie zdj';
  721. echo 'Comment[pt]=Organize as suas fotografias';
  722. echo 'Comment[pt_BR]=Organize suas fotos';
  723. echo 'Comment[sk]=Organizuje vae fotografie';
  724. echo 'Comment[sr]= ';
  725. echo 'Comment[sr@latin]=Organizujte vae fotografije';
  726. echo 'Comment[sv]=Organisera dina bilder';
  727. echo 'Comment[uk]= ';
  728. echo 'Comment=Organize your photos';
  729. echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_photos.png";
  730. echo 'Exec=shotwell %U';
  731. echo 'Terminal=false';
  732. echo 'Type=Application';
  733. echo 'MimeType=x-content/image-dcf;';
  734. echo 'Categories=Graphics;Photography;GNOME;GTK;';
  735. echo 'X-GIO-NoFuse=true';
  736. echo 'X-GNOME-Gettext-Domain=shotwell';
  737. echo 'X-GNOME-FullName=Shotwell Photo Manager'; } > "/home/$MY_USERNAME/Desktop/photos.desktop"
  738. #{ echo '[Desktop Entry]';
  739. #echo 'Name=Audio/Music';
  740. #echo 'Type=Application';
  741. #echo 'Comment=Audio publishing and streaming';
  742. #echo 'Exec=bash /usr/bin/start_ferment';
  743. #echo "Icon=/etc/patchwork/icon_ferment.png";
  744. #echo 'Terminal=false';
  745. #echo 'Categories=Application;'; } > "/home/$MY_USERNAME/Desktop/audio.desktop"
  746. { echo '[Desktop Entry]';
  747. echo 'Type=Application';
  748. echo 'Name=Routing Protocol';
  749. echo 'Name[el]= ';
  750. echo 'Name[ar]= ';
  751. echo "Name[ca]=Protocol d'enrutament";
  752. echo 'Name[hi]= ';
  753. echo 'Name[fr]=Protocole de routage';
  754. echo 'Name[de]=Routingprotokoll';
  755. echo 'Name[es]=Protocolo de enrutamiento';
  756. echo 'Name[it]=Protocollo di routing';
  757. echo 'Name[ru]= ';
  758. echo 'Name[zh]=';
  759. echo 'Comment=Select the mesh routing protocol';
  760. echo 'Comment[el]= ';
  761. echo 'Comment[ar]= ';
  762. echo "Comment[ca]=Seleccioneu el protocol d'enrutament de malles";
  763. echo 'Comment[hi]= ';
  764. echo 'Comment[fr]=Slectionnez le protocole de routage de maillage';
  765. echo 'Comment[de]=Whlen Sie das Mesh-Routing-Protokoll';
  766. echo 'Comment[es]=Seleccione el protocolo de enrutamiento de malla';
  767. echo "Comment[it]=Seleziona il protocollo di instradamento della mesh";
  768. echo 'Comment[ru]= ';
  769. echo 'Comment[zh]=';
  770. echo "Exec=mate-terminal -e \"/usr/local/bin/${PROJECT_NAME}-mesh-routing\"";
  771. echo "Icon=/usr/share/${PROJECT_NAME}/avatars/icon_routing.png";
  772. echo 'Terminal=false';
  773. echo 'Categories=Application'; } > "/home/$MY_USERNAME/Desktop/routing.desktop"
  774. # set permissions
  775. chmod +x /home/$MY_USERNAME/Desktop/*.desktop
  776. chown "${MY_USERNAME}":"${MY_USERNAME}" "/home/$MY_USERNAME/Desktop/"*
  777. chown "${MY_USERNAME}":"${MY_USERNAME}" "/home/$MY_USERNAME/.config"
  778. chown -R "${MY_USERNAME}":"${MY_USERNAME}" "/home/$MY_USERNAME/.config/tox"
  779. chown -R "${MY_USERNAME}":"${MY_USERNAME}" "/home/$MY_USERNAME/.config/autostart"
  780. chown "${MY_USERNAME}":"${MY_USERNAME}" /home/$MY_USERNAME/*.sh
  781. # link to Tahoe-LAFS Magic folder
  782. #ln -s /home/${MY_USERNAME}/Desktop/${TAHOELAFS_SHARED_DIR} /home/${MY_USERNAME}/${TAHOELAFS_SHARED_DIR}
  783. # restart caja
  784. killall caja
  785. killall mate-panel
  786. }
  787. function enable_batman_daemon {
  788. systemctl enable batman
  789. systemctl daemon-reload
  790. }
  791. function mesh_amnesic {
  792. if [ ! -f $MESH_AMNESIC ]; then
  793. return
  794. fi
  795. { echo '#!/bin/bash';
  796. echo '';
  797. echo "MY_USERNAME=\$1";
  798. echo 'tomb slam all';
  799. echo "if [ -f /home/${MY_USERNAME}/.bash_history ]; then";
  800. echo " shred -zu /home/${MY_USERNAME}/.bash_history";
  801. echo 'fi';
  802. echo "if [ -f /home/${MY_USERNAME}/.xsession-errors ]; then";
  803. echo " shred -zu /home/${MY_USERNAME}/.xsession-errors";
  804. echo 'fi';
  805. echo '';
  806. echo 'exit 0'; } > /usr/bin/amnesic
  807. chmod +x /usr/bin/amnesic
  808. if [ ! -f /etc/systemd/system/amnesic.service ]; then
  809. { echo '[Unit]';
  810. echo 'Description=Amnesic Mesh';
  811. echo '';
  812. echo '[Service]';
  813. echo 'User=root';
  814. echo 'Group=root';
  815. echo 'Type=oneshot';
  816. echo 'RemainAfterExit=true';
  817. echo 'ExecStart=/bin/true';
  818. echo "ExecStop=/usr/bin/amnesic $MY_USERNAME";
  819. echo '';
  820. echo '[Install]';
  821. echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/amnesic.service
  822. chmod +x /etc/systemd/system/amnesic.service
  823. systemctl daemon-reload
  824. fi
  825. systemctl enable amnesic
  826. systemctl start amnesic
  827. }
  828. function mesh_restart_daemons {
  829. systemctl restart avahi-daemon
  830. systemctl restart tox-bootstrapd
  831. systemctl restart nginx
  832. echo $'Daemons restarted' >> $INSTALL_LOG
  833. }
  834. function create_tomb {
  835. tomb_name=$1
  836. tomb_size=$2
  837. if [ -f "/tmp/${tomb_name}.tomb" ]; then
  838. tomb slam "/tmp/${tomb_name}.tomb"
  839. fi
  840. # make a temporary password
  841. tomb dig -s "${tomb_size}" "/tmp/${tomb_name}.tomb"
  842. if [ ! -f "/tmp/${tomb_name}.tomb" ]; then
  843. echo "WARNING: ${tomb_name} tomb did not install properly" >> /var/log/${PROJECT_NAME}.log
  844. tomb >> /var/log/${PROJECT_NAME}.log
  845. fi
  846. TOMB_TEMP_PASSWORD=$(openssl rand -base64 64 | tr -dc A-Za-z0-9 | head -c 30)
  847. tomb forge "/mnt/ramdisk/${tomb_name}.tomb.key" --tomb-pwd "${TOMB_TEMP_PASSWORD}" --unsafe
  848. tomb lock "/tmp/${tomb_name}.tomb" -k "/mnt/ramdisk/${tomb_name}.tomb.key" --tomb-pwd "${TOMB_TEMP_PASSWORD}" --unsafe
  849. tomb open "/tmp/${tomb_name}.tomb" -k "/mnt/ramdisk/${tomb_name}.tomb.key" --tomb-pwd "${TOMB_TEMP_PASSWORD}" --unsafe
  850. # stop stuff from popping up
  851. pkill caja
  852. # clear the temporary password
  853. TOMB_TEMP_PASSWORD=
  854. }
  855. function setup_amnesic_data {
  856. if [ ! -f $MESH_AMNESIC ]; then
  857. return
  858. fi
  859. if [ ! -d /mnt/ramdisk ]; then
  860. return
  861. fi
  862. # clear crypttab
  863. if [ -f /etc/crypttab ]; then
  864. shred -zu /etc/crypttab
  865. touch /etc/crypttab
  866. fi
  867. tomb_name=log
  868. create_tomb ${tomb_name} $TOMB_LOG_SIZE_MB
  869. if [ -d /media/${tomb_name} ]; then
  870. if [ -d /var/log ]; then
  871. if [ ! -d /var/log_base ]; then
  872. mv /var/log /var/log_base
  873. fi
  874. fi
  875. ln -s /media/${tomb_name} /var/log
  876. if [ -d /var/log_base ]; then
  877. cp -rp /var/log_base/* /media/${tomb_name}
  878. fi
  879. echo "${tomb_name} tomb created" >> $INSTALL_LOG
  880. else
  881. echo "WARNING: ${tomb_name} tomb not found" >> $INSTALL_LOG
  882. fi
  883. tomb_name=tox-bootstrapd
  884. if [ -f /etc/systemd/system/${tomb_name}.service ]; then
  885. systemctl stop ${tomb_name}
  886. fi
  887. create_tomb ${tomb_name} $TOMB_TOX_BOOTSTRAP_SIZE_MB
  888. if [ -d /media/${tomb_name} ]; then
  889. if [ -d /var/lib/tox-bootstrapd ]; then
  890. if [ ! -d /var/lib/tox-bootstrapd_base ]; then
  891. mv /var/lib/tox-bootstrapd /var/lib/tox-bootstrapd_base
  892. fi
  893. fi
  894. if [ -d /var/lib/tox-bootstrapd ]; then
  895. shred -zu /var/lib/tox-bootstrapd/*
  896. rm -rf /var/lib/tox-bootstrapd
  897. fi
  898. ln -s /media/${tomb_name} /var/lib/tox-bootstrapd
  899. if [ -d /var/lib/tox-bootstrapd_base ]; then
  900. cp -rp /var/lib/tox-bootstrapd_base/* /media/${tomb_name}
  901. fi
  902. echo "${tomb_name} tomb created" >> $INSTALL_LOG
  903. else
  904. echo "WARNING: ${tomb_name} tomb not found" >> $INSTALL_LOG
  905. fi
  906. tomb_name=tox
  907. create_tomb ${tomb_name} $TOMB_TOX_SIZE_MB
  908. if [ -d /media/${tomb_name} ]; then
  909. if [ ! -d /home/${MY_USERNAME}/.config ]; then
  910. mkdir -p /home/${MY_USERNAME}/.config
  911. chown ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config
  912. fi
  913. if [ -d /home/${MY_USERNAME}/.config/${tomb_name} ]; then
  914. rm -rf /home/${MY_USERNAME}/.config/${tomb_name}
  915. fi
  916. ln -s /media/${tomb_name} /home/${MY_USERNAME}/.config/${tomb_name}
  917. chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config/${tomb_name}
  918. chown -R ${MY_USERNAME}:${MY_USERNAME} /media/${tomb_name}
  919. echo "${tomb_name} tomb created" >> $INSTALL_LOG
  920. else
  921. echo "WARNING: ${tomb_name} tomb not found" >> $INSTALL_LOG
  922. fi
  923. }
  924. function setup_ipfs {
  925. IPFS_PATH=/usr/bin
  926. IPFS_KEY_LENGTH=2048
  927. IPFS_COMMAND=$IPFS_PATH/ipfs
  928. IPFS_PUBLIC=/home/$MY_USERNAME/.ipfs-public
  929. chmod 755 $IPFS_COMMAND
  930. su -c "systemctl --user enable ipfs" - $MY_USERNAME
  931. if [ -f $CURRENT_BLOG_INDEX ]; then
  932. shred -zu $CURRENT_BLOG_INDEX
  933. fi
  934. if [ -d /home/$MY_USERNAME/Public ]; then
  935. rm /home/$MY_USERNAME/Desktop/Public
  936. rm -rf /home/$MY_USERNAME/Public
  937. fi
  938. if [ -d /home/$MY_USERNAME/CreateBlog/content/images ]; then
  939. shred -zu /home/$MY_USERNAME/CreateBlog/content/images/*
  940. fi
  941. if [ -d /home/$MY_USERNAME/CreateBlog/content ]; then
  942. shred -zu /home/$MY_USERNAME/CreateBlog/content/*
  943. if grep -q "THEME=" /home/$MY_USERNAME/CreateBlog/pelicanconf.py; then
  944. sed -i "s|THEME=.*|THEME='themes/nice-blog'|g" /home/$MY_USERNAME/CreateBlog/pelicanconf.py
  945. else
  946. echo "THEME='themes/nice-blog'" >> /home/$MY_USERNAME/CreateBlog/pelicanconf.py
  947. fi
  948. fi
  949. if [ -d /home/$MY_USERNAME/.ipfs ]; then
  950. shred -zu /home/$MY_USERNAME/.ipfs/config
  951. rm -rf /home/$MY_USERNAME/.ipfs
  952. su -c "systemctl --user restart ipfs" - $MY_USERNAME
  953. else
  954. su -c "systemctl --user start ipfs" - $MY_USERNAME
  955. fi
  956. if [ -f /home/$MY_USERNAME/.blog-index ]; then
  957. shred -zu /home/$MY_USERNAME/.blog-index
  958. fi
  959. if [ -f /home/$MY_USERNAME/.blog-theme-index ]; then
  960. shred -zu /home/$MY_USERNAME/.blog-theme-index
  961. fi
  962. if [ -f /home/$MY_USERNAME/.ipfs-id ]; then
  963. shred -zu /home/$MY_USERNAME/.ipfs-id
  964. fi
  965. if [ -f /home/$MY_USERNAME/.ipfs-public ]; then
  966. shred -zu /home/$MY_USERNAME/.ipfs-public
  967. fi
  968. chmod 755 $IPFS_COMMAND
  969. su -c "$IPFS_COMMAND init -b $IPFS_KEY_LENGTH" - $MY_USERNAME
  970. if [ ! -d /home/$MY_USERNAME/.ipfs ]; then
  971. echo "IPFS could not be initialised for user $MY_USERNAME" >> $INSTALL_LOG
  972. return
  973. fi
  974. MY_IPFS_ID=/home/$MY_USERNAME/.ipfs-id
  975. su -c "echo \$($IPFS_COMMAND id | grep '\"ID\":' | awk -F '\"' '{print \$4}') > $MY_IPFS_ID" - $MY_USERNAME
  976. if [ ! -f $MY_IPFS_ID ]; then
  977. echo 'No IPFS identity was created' >> $INSTALL_LOG
  978. return
  979. fi
  980. IPFS_PEER_ID=$(cat $MY_IPFS_ID)
  981. if [ ${#IPFS_PEER_ID} -lt 10 ]; then
  982. echo 'Invalid IPFS peer ID' >> $INSTALL_LOG
  983. echo "$IPFS_PEER_ID" >> $INSTALL_LOG
  984. return
  985. fi
  986. # make a public directory
  987. TOX_ID='none'
  988. if [ -d /home/$MY_USERNAME/Desktop ]; then
  989. if [ ! -d /home/$MY_USERNAME/Public ]; then
  990. mkdir -p /home/$MY_USERNAME/Public/Videos
  991. mkdir -p /home/$MY_USERNAME/Public/Music
  992. mkdir -p /home/$MY_USERNAME/Public/Podcasts
  993. mkdir -p /home/$MY_USERNAME/Public/Documents
  994. mkdir -p /home/$MY_USERNAME/Public/Pictures
  995. echo $'Files within this directory will be publicly visible on the network' > /home/$MY_USERNAME/Public/README.txt
  996. chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Public
  997. ln -s /home/$MY_USERNAME/Public /home/$MY_USERNAME/Desktop/Public
  998. su -c "echo \$($IPFS_COMMAND add -rq /home/$MY_USERNAME/Public | tail -n 1) > $IPFS_PUBLIC" - $MY_USERNAME
  999. if [ ! -f $IPFS_PUBLIC ]; then
  1000. echo $'Unable to create public IPFS directory' >> $INSTALL_LOG
  1001. exit 368225
  1002. fi
  1003. fi
  1004. TOX_ID=$(su -c 'toxid' - $MY_USERNAME)
  1005. fi
  1006. create_avahi_mesh_service "ipfs_id" "ipfs_id" "udp" "$IPFS_PORT" "${IPFS_PEER_ID}:${TOX_ID}"
  1007. echo "IPFS installed with ID ${IPFS_PEER_ID}" >> $INSTALL_LOG
  1008. }
  1009. function setup_tahoelafs {
  1010. reconfigure_tahoelafs
  1011. TAHOELAFS_CONFIG=/home/${MY_USERNAME}/.tahoe/tahoe.cfg
  1012. if [ ! -f ${TAHOELAFS_CONFIG} ]; then
  1013. exit 673923
  1014. fi
  1015. echo $'Configured Tahoe-LAFS' >> $INSTALL_LOG
  1016. }
  1017. function create_user_vpn_key {
  1018. username=$1
  1019. if [ ! -d "/home/$username" ]; then
  1020. return
  1021. fi
  1022. echo $"Creating VPN key for $username" >> /var/log/${PROJECT_NAME}.log
  1023. cd /etc/openvpn/easy-rsa || exit 824527645247
  1024. if [ -f "/etc/openvpn/easy-rsa/keys/$username.crt" ]; then
  1025. rm "/etc/openvpn/easy-rsa/keys/$username.crt"
  1026. fi
  1027. if [ -f "/etc/openvpn/easy-rsa/keys/$username.key" ]; then
  1028. rm "/etc/openvpn/easy-rsa/keys/$username.key"
  1029. fi
  1030. if [ -f "/etc/openvpn/easy-rsa/keys/$username.csr" ]; then
  1031. rm "/etc/openvpn/easy-rsa/keys/$username.csr"
  1032. fi
  1033. sed -i 's| --interact||g' build-key
  1034. ./build-key "$username"
  1035. if [ ! -f "/etc/openvpn/easy-rsa/keys/$username.crt" ]; then
  1036. echo $'VPN user cert not generated' >> "/var/log/${PROJECT_NAME}.log"
  1037. exit 783528
  1038. fi
  1039. user_cert=$(cat "/etc/openvpn/easy-rsa/keys/$username.crt")
  1040. if [ ${#user_cert} -lt 10 ]; then
  1041. cat "/etc/openvpn/easy-rsa/keys/$username.crt"
  1042. echo $'User cert generation failed' >> /var/log/${PROJECT_NAME}.log
  1043. exit 634659
  1044. fi
  1045. if [ ! -f "/etc/openvpn/easy-rsa/keys/$username.key" ]; then
  1046. echo $'VPN user key not generated'
  1047. exit 682523
  1048. fi
  1049. user_key=$(cat "/etc/openvpn/easy-rsa/keys/$username.key")
  1050. if [ ${#user_key} -lt 10 ]; then
  1051. cat "/etc/openvpn/easy-rsa/keys/$username.key"
  1052. echo $'User key generation failed'
  1053. exit 285838
  1054. fi
  1055. user_vpn_cert_file=/home/$username/$OPENVPN_KEY_FILENAME
  1056. { echo 'client';
  1057. echo 'dev tun';
  1058. echo 'proto tcp';
  1059. echo "remote localhost $STUNNEL_PORT";
  1060. echo "route $DEFAULT_DOMAIN_NAME 255.255.255.255 net_gateway";
  1061. echo 'resolv-retry infinite';
  1062. echo 'nobind';
  1063. echo 'tun-mtu 1500';
  1064. echo 'tun-mtu-extra 32';
  1065. echo 'mssfix 1450';
  1066. echo 'persist-key';
  1067. echo 'persist-tun';
  1068. echo 'auth-nocache';
  1069. echo 'remote-cert-tls server';
  1070. echo 'comp-lzo';
  1071. echo 'verb 3';
  1072. echo '';
  1073. echo '<ca>';
  1074. cat "/etc/openvpn/ca.crt";
  1075. echo '</ca>';
  1076. echo '<cert>';
  1077. cat "/etc/openvpn/easy-rsa/keys/$username.crt";
  1078. echo '</cert>';
  1079. echo '<key>';
  1080. cat "/etc/openvpn/easy-rsa/keys/$username.key";
  1081. echo '</key>'; } > "$user_vpn_cert_file"
  1082. chown "$username":"$username" "$user_vpn_cert_file"
  1083. # keep a backup
  1084. cp "$user_vpn_cert_file" "/etc/openvpn/easy-rsa/keys/$username.ovpn"
  1085. #rm /etc/openvpn/easy-rsa/keys/$username.crt
  1086. #rm /etc/openvpn/easy-rsa/keys/$username.csr
  1087. shred -zu "/etc/openvpn/easy-rsa/keys/$username.key"
  1088. echo $"VPN key created at $user_vpn_cert_file" >> "/var/log/${PROJECT_NAME}.log"
  1089. }
  1090. function vpn_generate_keys {
  1091. # generate host keys
  1092. if [ ! -f /etc/openvpn/dh2048.pem ]; then
  1093. ${PROJECT_NAME}-dhparam -o /etc/openvpn/dh2048.pem
  1094. fi
  1095. if [ ! -f /etc/openvpn/dh2048.pem ]; then
  1096. echo $'vpn dhparams were not generated' >> /var/log/${PROJECT_NAME}.log
  1097. exit 73724523
  1098. fi
  1099. cp /etc/openvpn/dh2048.pem /etc/openvpn/easy-rsa/keys/dh2048.pem
  1100. cd /etc/openvpn/easy-rsa || exit 2452486824
  1101. # shellcheck disable=SC1091
  1102. . ./vars
  1103. ./clean-all
  1104. vpn_openssl_version='1.0.0'
  1105. if [ ! -f openssl-${vpn_openssl_version}.cnf ]; then
  1106. echo $"openssl-${vpn_openssl_version}.cnf was not found" >> /var/log/${PROJECT_NAME}.log
  1107. exit 7392353
  1108. fi
  1109. cp openssl-${vpn_openssl_version}.cnf openssl.cnf
  1110. if [ -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt ]; then
  1111. rm /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt
  1112. fi
  1113. if [ -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.key ]; then
  1114. rm /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.key
  1115. fi
  1116. if [ -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.csr ]; then
  1117. rm /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.csr
  1118. fi
  1119. sed -i 's| --interact||g' build-key-server
  1120. sed -i 's| --interact||g' build-ca
  1121. ./build-ca
  1122. ./build-key-server ${OPENVPN_SERVER_NAME}
  1123. if [ ! -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt ]; then
  1124. echo $'OpenVPN crt not found' >> /var/log/${PROJECT_NAME}.log
  1125. exit 7823352
  1126. fi
  1127. server_cert=$(cat /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt)
  1128. if [ ${#server_cert} -lt 10 ]; then
  1129. cat /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt
  1130. echo $'Server cert generation failed' >> /var/log/${PROJECT_NAME}.log
  1131. exit 3284682
  1132. fi
  1133. if [ ! -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.key ]; then
  1134. echo $'OpenVPN key not found' >> /var/log/${PROJECT_NAME}.log
  1135. exit 6839436
  1136. fi
  1137. if [ ! -f /etc/openvpn/easy-rsa/keys/ca.key ]; then
  1138. echo $'OpenVPN ca not found' >> /var/log/${PROJECT_NAME}.log
  1139. exit 7935203
  1140. fi
  1141. cp /etc/openvpn/easy-rsa/keys/{$OPENVPN_SERVER_NAME.crt,$OPENVPN_SERVER_NAME.key,ca.crt} /etc/openvpn
  1142. create_user_vpn_key ${MY_USERNAME}
  1143. }
  1144. function generate_stunnel_keys {
  1145. echo "Creating stunnel keys" >> /var/log/${PROJECT_NAME}.log
  1146. openssl req -x509 -nodes -days 3650 -sha256 \
  1147. -subj "/O=$VPN_ORGANISATION/OU=$VPN_UNIT/C=$VPN_COUNTRY_CODE/ST=$VPN_AREA/L=$VPN_LOCATION/CN=$HOSTNAME" \
  1148. -newkey rsa:2048 -keyout /etc/stunnel/key.pem \
  1149. -out /etc/stunnel/cert.pem
  1150. if [ ! -f /etc/stunnel/key.pem ]; then
  1151. echo $'stunnel key not created' >> /var/log/${PROJECT_NAME}.log
  1152. exit 793530
  1153. fi
  1154. if [ ! -f /etc/stunnel/cert.pem ]; then
  1155. echo $'stunnel cert not created' >> /var/log/${PROJECT_NAME}.log
  1156. exit 204587
  1157. fi
  1158. chmod 400 /etc/stunnel/key.pem
  1159. chmod 640 /etc/stunnel/cert.pem
  1160. cat /etc/stunnel/key.pem /etc/stunnel/cert.pem >> /etc/stunnel/stunnel.pem
  1161. chmod 640 /etc/stunnel/stunnel.pem
  1162. openssl pkcs12 -export -out /etc/stunnel/stunnel.p12 -inkey /etc/stunnel/key.pem -in /etc/stunnel/cert.pem -passout pass:
  1163. if [ ! -f /etc/stunnel/stunnel.p12 ]; then
  1164. echo $'stunnel pkcs12 not created' >> /var/log/${PROJECT_NAME}.log
  1165. exit 639353
  1166. fi
  1167. chmod 640 /etc/stunnel/stunnel.p12
  1168. cp /etc/stunnel/stunnel.pem /home/$MY_USERNAME/stunnel.pem
  1169. cp /etc/stunnel/stunnel.p12 /home/$MY_USERNAME/stunnel.p12
  1170. chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/stunnel*
  1171. echo "stunnel keys created" >> /var/log/${PROJECT_NAME}.log
  1172. }
  1173. function mesh_setup_vpn {
  1174. vpn_generate_keys
  1175. cp /etc/stunnel/stunnel-client.conf /home/$MY_USERNAME/stunnel-client.conf
  1176. chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/stunnel*
  1177. generate_stunnel_keys
  1178. sed -i 's|tun-mtu .*|tun-mtu 1532|g' /home/$MY_USERNAME/client.ovpn
  1179. chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/client.ovpn
  1180. chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/stunnel*
  1181. # create an archive of the vpn client files
  1182. cd /home/$MY_USERNAME || exit 24682468242
  1183. tar -czvf vpn.tar.gz stunnel* client.ovpn
  1184. chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/vpn.tar.gz
  1185. systemctl restart openvpn
  1186. }
  1187. function initialise_scuttlebot_pub {
  1188. chown -R scuttlebot:scuttlebot /etc/scuttlebot
  1189. systemctl enable git_ssb.service
  1190. systemctl daemon-reload
  1191. systemctl start scuttlebot.service
  1192. sleep 10
  1193. if [ ! -d /etc/scuttlebot/.ssb ]; then
  1194. echo $'Scuttlebot config not generated' >> /var/log/${PROJECT_NAME}.log
  1195. systemctl status scuttlebot -l >> /var/log/${PROJECT_NAME}.log
  1196. exit 73528
  1197. fi
  1198. { echo '{';
  1199. echo " \"host\": \"$P{PEER_ID}.local\",";
  1200. echo " \"port\": ${SCUTTLEBOT_PORT},";
  1201. echo ' "allowPrivate": true,';
  1202. echo ' "timeout": 30000,';
  1203. echo ' "pub": true,';
  1204. echo ' "local": true,';
  1205. echo ' "friends": {';
  1206. echo ' "dunbar": 150,';
  1207. echo ' "hops": 3';
  1208. echo ' },';
  1209. echo ' "gossip": {';
  1210. echo ' "connections": 2';
  1211. echo ' },';
  1212. echo ' "master": [],';
  1213. echo ' "logging": {';
  1214. echo ' "level": "error"';
  1215. echo ' }';
  1216. echo '}'; } > /etc/scuttlebot/.ssb/config
  1217. chown scuttlebot:scuttlebot /etc/scuttlebot/.ssb/config
  1218. systemctl restart scuttlebot.service
  1219. echo "scuttlebot pub started" >> /var/log/${PROJECT_NAME}.log
  1220. # git ssb site
  1221. if [ -f /etc/nginx/sites-available/git_ssb ]; then
  1222. sed -i "s|server_name .*|server_name ${HOSTNAME}.local;|g" /etc/nginx/sites-available/git_ssb
  1223. ln -s /etc/nginx/sites-available/git_ssb /etc/nginx/sites-enabled/git_ssb
  1224. systemctl enable git_ssb.service
  1225. systemctl start git_ssb.service
  1226. fi
  1227. }
  1228. # whether to reset the identity
  1229. set_new_identity=
  1230. if [ "$2" ]; then
  1231. if [[ "$2" == $"new"* ]]; then
  1232. if [ ! -f $MESH_INSTALL_SETUP ]; then
  1233. touch $MESH_INSTALL_SETUP
  1234. fi
  1235. set_new_identity=1
  1236. fi
  1237. if [[ "$2" == $"amnesic"* ]]; then
  1238. if [ ! -f $MESH_AMNESIC ]; then
  1239. touch $MESH_AMNESIC
  1240. fi
  1241. if [ ! -f $MESH_INSTALL_SETUP ]; then
  1242. touch $MESH_INSTALL_SETUP
  1243. fi
  1244. set_new_identity=1
  1245. fi
  1246. fi
  1247. if [ -f $MESH_INSTALL_SETUP ]; then
  1248. if [ "$1" ]; then
  1249. MY_USERNAME=$1
  1250. fi
  1251. if [ ! $set_new_identity ]; then
  1252. # sleep in order to allow other daemons to start up
  1253. sleep 5
  1254. fi
  1255. # clear the install log
  1256. if [ -f $INSTALL_LOG ]; then
  1257. rm $INSTALL_LOG
  1258. fi
  1259. # Remove SSB/Patchwork files
  1260. if [ -d "/home/$MY_USERNAME/.ssb" ]; then
  1261. rm -rf "/home/$MY_USERNAME/.ssb"
  1262. fi
  1263. # Remove vpn host keys
  1264. if [ -d /etc/openvpn/easy-rsa/keys ]; then
  1265. rm -rf /etc/openvpn/easy-rsa/keys/*
  1266. fi
  1267. # Remove hidden service
  1268. if [ -d /var/lib/tor/hidden_service_mesh ]; then
  1269. rm -rf /var/lib/tor/hidden_service_mesh
  1270. fi
  1271. # Remove any existing vpn client keys
  1272. if [ -f "/home/$MY_USERNAME/vpn.tar.gz" ]; then
  1273. rm "/home/$MY_USERNAME/vpn.tar.gz"
  1274. fi
  1275. if [ -f "/home/$MY_USERNAME/stunnel.pem" ]; then
  1276. rm "/home/$MY_USERNAME/stunnel.pem"
  1277. fi
  1278. if [ -f "/home/$MY_USERNAME/stunnel.p12" ]; then
  1279. rm "/home/$MY_USERNAME/stunnel.p12"
  1280. fi
  1281. # Remove cryptpad datastore
  1282. if [ -d $CRYPTPAD_DIR/datastore ]; then
  1283. rm -rf $CRYPTPAD_DIR/datastore
  1284. fi
  1285. echo $'Beginning mesh node setup' >> $INSTALL_LOG
  1286. if [ -d "/home/$MY_USERNAME/.config" ]; then
  1287. chown "${MY_USERNAME}":"${MY_USERNAME}" "/home/$MY_USERNAME/.config"
  1288. fi
  1289. systemctl stop tor
  1290. systemctl disable tor
  1291. echo $'TOR disabled' >> $INSTALL_LOG
  1292. systemctl stop bmx6
  1293. systemctl disable bmx6
  1294. echo $'BMX6 disabled' >> $INSTALL_LOG
  1295. if [ -d /etc/bmx7 ]; then
  1296. systemctl stop bmx7
  1297. systemctl disable bmx7
  1298. echo $'BMX7 disabled' >> $INSTALL_LOG
  1299. fi
  1300. systemctl stop olsr2
  1301. systemctl disable olsr2
  1302. echo $'OLSR2 disabled' >> $INSTALL_LOG
  1303. systemctl stop babel
  1304. systemctl disable babel
  1305. echo $'Babel disabled' >> $INSTALL_LOG
  1306. #tomb slam all
  1307. tmp_ram_disk 100
  1308. enable_predictable_device_names
  1309. enable_batman_daemon
  1310. #create_ram_disk 1
  1311. #setup_amnesic_data
  1312. change_avahi_name
  1313. if [ -d $CRYPTPAD_DIR ]; then
  1314. systemctl start cryptpad
  1315. fi
  1316. configure_toxcore
  1317. create_tox_user
  1318. #setup_tahoelafs
  1319. mesh_setup_vpn
  1320. initialise_scuttlebot_pub
  1321. setup_ipfs
  1322. enable_cryptpad
  1323. enable_peertube
  1324. mesh_amnesic
  1325. make_root_read_only
  1326. if [ ! -f $MESH_AMNESIC ]; then
  1327. rm $MESH_INSTALL_SETUP
  1328. systemctl disable mesh-setup.service
  1329. fi
  1330. show_desktop_icons
  1331. mesh_restart_daemons
  1332. if [ ! -f $MESH_INSTALL_COMPLETED ]; then
  1333. echo $'Mesh node setup complete' >> $INSTALL_LOG
  1334. touch $MESH_INSTALL_COMPLETED
  1335. if [ -d "/home/$MY_USERNAME/Desktop" ]; then
  1336. touch $FIRST_BOOT
  1337. chown "${MY_USERNAME}":"${MY_USERNAME}" "$FIRST_BOOT"
  1338. fi
  1339. # set the desktop background
  1340. if [ -d "/home/$MY_USERNAME/Desktop" ]; then
  1341. MESH_DESKTOP_BACKGROUND_IMAGE=/usr/local/share/${PROJECT_NAME}_mesh_background.png
  1342. cp $MESH_DESKTOP_BACKGROUND_IMAGE /usr/share/images/desktop-base/${PROJECT_NAME}_mesh_background.png
  1343. rm /usr/share/images/desktop-base/desktop-background
  1344. ln -s /usr/share/images/desktop-base/${PROJECT_NAME}_mesh_background.png /usr/share/images/desktop-base/desktop-background
  1345. fi
  1346. if [ -f /etc/default/grub ]; then
  1347. update-grub
  1348. fi
  1349. systemctl reboot -i
  1350. fi
  1351. fi
  1352. exit 0