freedombone-image-customise 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Based on bin/freedombox-customize from freedom-maker
  12. #
  13. # License
  14. # =======
  15. #
  16. # This program is free software: you can redistribute it and/or modify
  17. # it under the terms of the GNU Affero General Public License as published by
  18. # the Free Software Foundation, either version 3 of the License, or
  19. # (at your option) any later version.
  20. #
  21. # This program is distributed in the hope that it will be useful,
  22. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. # GNU Affero General Public License for more details.
  25. #
  26. # You should have received a copy of the GNU Affero General Public License
  27. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  28. set -e
  29. set -x
  30. PROJECT_NAME='freedombone'
  31. INSTALL_DIR=/root/build
  32. COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
  33. PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
  34. VARIANT='full'
  35. # username created by default within a debian image
  36. GENERIC_IMAGE_USERNAME='fbone'
  37. export TEXTDOMAIN=${PROJECT_NAME}-image-customise
  38. export TEXTDOMAINDIR="/usr/share/locale"
  39. # Whether to minimise the number of decisions during interactive install
  40. MINIMAL_INSTALL="yes"
  41. MY_USERNAME='debian'
  42. MY_PASSWORD="${PROJECT_NAME}"
  43. # Minimum number of characters in a password
  44. MINIMUM_PASSWORD_LENGTH=10
  45. # IP address of the router (gateway)
  46. ROUTER_IP_ADDRESS="192.168.1.254"
  47. # The fixed IP address of the Beaglebone Black on your local network
  48. BOX_IP_ADDRESS="192.168.1.55"
  49. # DNS
  50. NAMESERVER1='213.73.91.35'
  51. NAMESERVER2='85.214.20.141'
  52. # optional configuration file containing freedombone settings
  53. CONFIG_FILENAME=
  54. # Optional ssh public key to allow
  55. SSH_PUBKEY="no"
  56. # Whether this is a generic image for mass redistribution on the interwebs
  57. GENERIC_IMAGE="no"
  58. # default SSH port
  59. SSH_PORT=2222
  60. # for mesh installs
  61. TRACKER_PORT=6969
  62. # Whether sites are accessible only within a Tor browser
  63. ONION_ONLY="no"
  64. # Whether to only install debian and nothing else
  65. DEBIAN_INSTALL_ONLY="no"
  66. # wifi settings
  67. WIFI_INTERFACE='wlan0'
  68. WIFI_SSID=
  69. WIFI_TYPE='wpa2-psk'
  70. WIFI_PASSPHRASE=
  71. WIFI_HOTSPOT='no'
  72. WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
  73. # Whether to install non-free wifi drivers for the mesh client
  74. INSECURE='no'
  75. # optional desktop background image for mesh
  76. MESH_DESKTOP_BACKGROUND_IMAGE=/usr/local/share/${PROJECT_NAME}_mesh_background.png
  77. # The browser application to use
  78. BROWSER=iceweasel
  79. MESH_INSTALL_DIR=/var/lib
  80. # for mesh installs whether to delete all data and generate
  81. # a new identity at every shutdown/boot
  82. AMNESIC='no'
  83. # defines the initial keyboard layout
  84. KEYBOARD_MAP='gb'
  85. # Strings used for setting the username
  86. MESH_TITLE=$"Freedombone Mesh"
  87. MESH_SET_USERNAME=$"Welcome to the Freedombone mesh.\n\nThe first thing you will need to do is set a username so that other peers can find you."
  88. enable_eatmydata_override() {
  89. chroot $rootdir apt-get install --no-install-recommends -y eatmydata
  90. if [ -x $rootdir/usr/bin/eatmydata ] && \
  91. [ ! -f $rootdir/etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata ]; then
  92. echo $"info: Adding apt config to call dpkg via eatmydata"
  93. printf "#!/bin/sh\nexec eatmydata dpkg \"\$@\"\n" \
  94. > $rootdir/var/tmp/dpkg-eatmydata
  95. chmod 755 $rootdir/var/tmp/dpkg-eatmydata
  96. cat > $rootdir/etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata <<EOF
  97. Dir::Bin::dpkg "/var/tmp/dpkg-eatmydata";
  98. EOF
  99. else
  100. echo $"error: unable to find /usr/bin/eatmydata after installing the eatmydata package"
  101. fi
  102. }
  103. disable_eatmydata_override() {
  104. for override in \
  105. /etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata \
  106. /var/tmp/dpkg-eatmydata ; do
  107. echo $"info: Removing apt config to call dpkg via eatmydata"
  108. if [ -f $rootdir$override ] ; then
  109. rm -f $rootdir$override
  110. else
  111. echo $"warning: missing $rootdir$override"
  112. fi
  113. done
  114. sync # Flush file buffers before continuing
  115. }
  116. set_apt_sources() {
  117. NEW_MIRROR="$1"
  118. COMPONENTS="main"
  119. cat <<EOF > etc/apt/sources.list
  120. deb $NEW_MIRROR $SUITE $COMPONENTS
  121. deb-src $NEW_MIRROR $SUITE $COMPONENTS
  122. #deb http://security.debian.org/ $SUITE/updates main
  123. #deb-src http://security.debian.org/ $SUITE/updates main
  124. EOF
  125. }
  126. configure_networking() {
  127. if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
  128. return
  129. fi
  130. if [[ $GENERIC_IMAGE == "no" ]]; then
  131. echo "# This file describes the network interfaces available on your system
  132. # and how to activate them. For more information, see interfaces(5).
  133. # The loopback network interface
  134. auto lo
  135. iface lo inet loopback
  136. # The primary network interface
  137. auto eth0
  138. iface eth0 inet static
  139. address $BOX_IP_ADDRESS
  140. netmask 255.255.255.0
  141. gateway $ROUTER_IP_ADDRESS
  142. dns-nameservers $NAMESERVER1 $NAMESERVER2
  143. # Example to keep MAC address between reboots
  144. #hwaddress ether B5:A2:BE:3F:1A:FE
  145. # The secondary network interface
  146. #auto eth1
  147. #iface eth1 inet dhcp
  148. # WiFi Example
  149. #auto wlan0
  150. #iface wlan0 inet dhcp
  151. # wpa-ssid \"essid\"
  152. # wpa-psk \"password\"
  153. # Ethernet/RNDIS gadget (g_ether)
  154. # ... or on host side, usbnet and random hwaddr
  155. # Note on some boards, usb0 is automaticly setup with an init script
  156. #iface usb0 inet static
  157. # address 192.168.7.2
  158. # netmask 255.255.255.0
  159. # network 192.168.7.0
  160. # gateway 192.168.7.1" > $rootdir/etc/network/interfaces
  161. hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
  162. a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
  163. b=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
  164. c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
  165. d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
  166. e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
  167. sed -i "s|#hwaddress ether.*|hwaddress ether de:$a:$b:$c:$d:$e|g" \
  168. $rootdir/etc/network/interfaces
  169. fi
  170. sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $rootdir/etc/resolv.conf
  171. sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $rootdir/etc/resolv.conf
  172. if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
  173. # change the motd to show further install instructions
  174. echo $"
  175. .---. . .
  176. | | |
  177. |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  178. | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  179. ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  180. Initial base install
  181. Your system is not yet installed. To complete the process run the
  182. following commands, then enter your details.
  183. sudo su
  184. ${PROJECT_NAME} menuconfig
  185. " > $rootdir/etc/motd
  186. else
  187. echo $"
  188. .---. . .
  189. | | |
  190. |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  191. | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  192. ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  193. Freedom in the Mesh
  194. " > $rootdir/etc/motd
  195. fi
  196. }
  197. configure_ssh() {
  198. sed -i "s/Port .*/Port ${SSH_PORT}/g" $rootdir/etc/ssh/sshd_config
  199. if [[ "$SSH_PUBKEY" != "no" ]]; then
  200. if [ ! -d $rootdir/home/$MY_USERNAME/.ssh ]; then
  201. mkdir $rootdir/home/$MY_USERNAME/.ssh
  202. fi
  203. echo "$SSH_PUBKEY" > $rootdir/home/$MY_USERNAME/.ssh/authorized_keys
  204. chroot $rootdir chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
  205. sed -i 's|PasswordAuthentication.*|PasswordAuthentication no|g' $rootdir/etc/ssh/sshd_config
  206. echo $"Using ssh public key:"
  207. echo $SSH_PUBKEY
  208. echo $'Password ssh authentication turned off'
  209. fi
  210. }
  211. admin_user_sudo() {
  212. echo "$MY_USERNAME ALL=(ALL) ALL" >> $rootdir/etc/sudoers
  213. }
  214. create_generic_image() {
  215. if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
  216. return
  217. fi
  218. if [[ $GENERIC_IMAGE == "no" ]]; then
  219. return
  220. fi
  221. if [ $CONFIG_FILENAME ]; then
  222. if [[ "$CONFIG_FILENAME" == *"mesh.cfg"* ]]; then
  223. VARIANT="mesh"
  224. fi
  225. fi
  226. # Don't install any configuration. This will be a base system
  227. if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
  228. CONFIG_FILENAME=
  229. else
  230. touch $rootdir/root/.initial_mesh_setup
  231. fi
  232. # Stick with the existing login for mesh clients
  233. if [[ $VARIANT == "meshclient" || $VARIANT == "meshusb" ]]; then
  234. return
  235. fi
  236. # The presence of this file indicates that the initial
  237. # setup has not yet been completed
  238. touch $rootdir/home/$MY_USERNAME/.initial_setup
  239. chroot $rootdir chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.initial_setup
  240. touch $rootdir/root/.initial_setup
  241. cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
  242. # initial setup of the system
  243. if [ -f ~/.initial_setup ]; then
  244. clear
  245. echo "
  246. .---. . .
  247. | | |
  248. |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  249. | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  250. ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  251. Initial setup process
  252. Please enter your password a second time.
  253. "
  254. sudo su
  255. fi
  256. EOF
  257. echo '# initial setup of the system' >> $rootdir/root/.bashrc
  258. echo 'if [ -f ~/.initial_setup ]; then' >> $rootdir/root/.bashrc
  259. echo ' if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc
  260. echo ' NEW_USER_PASSWORD=$(printf `cat ~/login.txt`)' >> $rootdir/root/.bashrc
  261. echo ' else' >> $rootdir/root/.bashrc
  262. echo ' ENTROPY=$(cat /proc/sys/kernel/random/entropy_avail)' >> $rootdir/root/.bashrc
  263. echo ' if [ $ENTROPY -lt 500 ]; then' >> $rootdir/root/.bashrc
  264. ENTROPY_MESSAGE1=$'Initial setup process'
  265. ENTROPY_MESSAGE2=$'Password Generation'
  266. ENTROPY_MESSAGE3=$'WARNING: The entropy available on this system is too low to generate a password.\n\nThe installation process cannot continue.'
  267. echo " dialog --backtitle \"${ENTROPY_MESSAGE1}\" --title \"${ENTROPY_MESSAGE2}\" --msgbox \"${ENTROPY_MESSAGE3}\" 8 50" >> $rootdir/root/.bashrc
  268. echo ' exit' >> $rootdir/root/.bashrc
  269. echo ' fi' >> $rootdir/root/.bashrc
  270. echo -n ' NEW_USER_PASSWORD="$(openssl rand -base64 30 | cut -c1-' >> $rootdir/root/.bashrc
  271. echo "${MINIMUM_PASSWORD_LENGTH})\"" >> $rootdir/root/.bashrc
  272. echo ' fi' >> $rootdir/root/.bashrc
  273. echo ' echo "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/root/.bashrc
  274. echo ' clear' >> $rootdir/root/.bashrc
  275. echo ' echo ""' >> $rootdir/root/.bashrc
  276. NEW_LOGIN_PASSWORD_MESSAGE1=$'Your new login password is:'
  277. NEW_LOGIN_PASSWORD_MESSAGE2=$'Use it whenever you wish to ssh into this system.'
  278. NEW_LOGIN_PASSWORD_MESSAGE3=$'IMPORTANT: Please take a moment to enter the above password into a\npassword manager or write it down somewhere.'
  279. PRESS_KEY_MESSAGE=$'Press any key to continue...'
  280. echo " echo \"${NEW_LOGIN_PASSWORD_MESSAGE1}\"" >> $rootdir/root/.bashrc
  281. echo ' echo ""' >> $rootdir/root/.bashrc
  282. echo ' toilet "${NEW_USER_PASSWORD}"' >> $rootdir/root/.bashrc
  283. echo ' echo ""' >> $rootdir/root/.bashrc
  284. echo ' echo " ${NEW_USER_PASSWORD}"' >> $rootdir/root/.bashrc
  285. echo ' echo ""' >> $rootdir/root/.bashrc
  286. echo " echo \"${NEW_LOGIN_PASSWORD_MESSAGE2}\"" >> $rootdir/root/.bashrc
  287. echo ' echo ""' >> $rootdir/root/.bashrc
  288. echo " echo \"${NEW_LOGIN_PASSWORD_MESSAGE3}\"" >> $rootdir/root/.bashrc
  289. echo ' echo ""' >> $rootdir/root/.bashrc
  290. echo " read -n1 -r -p \"${PRESS_KEY_MESSAGE}\" key" >> $rootdir/root/.bashrc
  291. # change the password for the admin user
  292. echo -n " echo \"${MY_USERNAME}:" >> $rootdir/root/.bashrc
  293. echo '$(printf `cat ~/login.txt`)"|chpasswd' >> $rootdir/root/.bashrc
  294. # update before continuing
  295. echo " cd /root/${PROJECT_NAME}" >> $rootdir/root/.bashrc
  296. echo " git stash" >> $rootdir/root/.bashrc
  297. echo " git pull" >> $rootdir/root/.bashrc
  298. echo " make install" >> $rootdir/root/.bashrc
  299. if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
  300. if [[ $ONION_ONLY == "no" ]]; then
  301. if [[ $MINIMAL_INSTALL == "no" ]]; then
  302. echo " ${PROJECT_NAME} menuconfig-full" >> $rootdir/root/.bashrc
  303. else
  304. echo " ${PROJECT_NAME} menuconfig" >> $rootdir/root/.bashrc
  305. fi
  306. else
  307. echo " ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
  308. fi
  309. else
  310. echo " echo ''" >> $rootdir/root/.bashrc
  311. fi
  312. echo ' if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
  313. echo " if [ -f ~/${PROJECT_NAME}-completed.txt ]; then" >> $rootdir/root/.bashrc
  314. # Remove the initial setup files
  315. echo ' rm /root/.initial_setup' >> $rootdir/root/.bashrc
  316. echo " rm /home/${MY_USERNAME}/.initial_setup" >> $rootdir/root/.bashrc
  317. echo " touch /root/.remove_${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
  318. echo ' shred -zu ~/login.txt' >> $rootdir/root/.bashrc
  319. END_MESSAGE1=$'Congratulations!'
  320. if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
  321. END_MESSAGE2=$'\nYour system has now installed\n\nThe onion ssh service is at $SSH_ONION_HOSTNAME\n\nPress any key to reboot and begin using it'
  322. echo ' SSH_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_ssh/hostname)' >> $rootdir/root/.bashrc
  323. else
  324. END_MESSAGE2=$'\nYour system has now installed\n\nPress any key to reboot and begin using it'
  325. fi
  326. echo " dialog --title '$END_MESSAGE1' --msgbox \"$END_MESSAGE2\" 9 50" >> $rootdir/root/.bashrc
  327. echo ' reboot' >> $rootdir/root/.bashrc
  328. echo ' fi' >> $rootdir/root/.bashrc
  329. echo ' else' >> $rootdir/root/.bashrc
  330. echo ' key=' >> $rootdir/root/.bashrc
  331. echo ' while [[ $key != "x" ]]; do' >> $rootdir/root/.bashrc
  332. INSTALL_FAIL_MESSAGE=$"Install failed. Press x to continue..."
  333. echo " read -n1 -r -p \"${INSTALL_FAIL_MESSAGE}\" key" >> $rootdir/root/.bashrc
  334. echo ' done' >> $rootdir/root/.bashrc
  335. echo ' fi' >> $rootdir/root/.bashrc
  336. echo ' exit' >> $rootdir/root/.bashrc
  337. echo 'else' >> $rootdir/root/.bashrc
  338. echo ' # Remove default account after install' >> $rootdir/root/.bashrc
  339. echo " if [ -f /root/.remove_${GENERIC_IMAGE_USERNAME} ]; then" >> $rootdir/root/.bashrc
  340. echo " if [ -d /home/${GENERIC_IMAGE_USERNAME} ]; then" >> $rootdir/root/.bashrc
  341. echo " userdel -r ${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
  342. echo " if [ -d /home/${GENERIC_IMAGE_USERNAME} ]; then" >> $rootdir/root/.bashrc
  343. echo " rm -rf /home/${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
  344. echo " rm /root/.remove_${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
  345. echo ' fi' >> $rootdir/root/.bashrc
  346. echo ' fi' >> $rootdir/root/.bashrc
  347. echo ' fi' >> $rootdir/root/.bashrc
  348. echo 'fi' >> $rootdir/root/.bashrc
  349. }
  350. continue_installation() {
  351. # If a configuration file exists then run with it
  352. # otherwise the interactive installer can be used
  353. # This is equivalent to installing freedombox-setup on freedombox
  354. if [ $CONFIG_FILENAME ]; then
  355. if [ ${#CONFIG_FILENAME} -gt 2 ]; then
  356. cp $CONFIG_FILENAME $rootdir/root/$PROJECT_NAME.cfg
  357. cat $rootdir/root/$PROJECT_NAME.cfg
  358. chroot "$rootdir" su -c "$PROJECT_NAME -c /root/$PROJECT_NAME.cfg" - root
  359. fi
  360. fi
  361. }
  362. atheros_wifi() {
  363. firmware_filename="open-ath9k-htc-firmware_1.3-1_all.deb"
  364. firmware_hash='5fea58ffefdf0ef15b504db7fbe3bc078c03e0d927bba64085e4b6f2546102f5'
  365. firmware_url="http://us.archive.trisquel.info/trisquel/pool/main/o/open-ath9k-htc-firmware/$firmware_filename"
  366. firmware_tempfile="/tmp/$firmware_filename"
  367. wget "$firmware_url" -O "$rootdir$firmware_tempfile"
  368. downloaded_firmware_hash=$(sha256sum "$rootdir$firmware_tempfile" | awk -F ' ' '{print $1}')
  369. if [[ "$downloaded_firmware_hash" == "$firmware_hash" ]]; then
  370. chroot "$rootdir" dpkg -i "$firmware_tempfile"
  371. else
  372. echo 'WARNING: Atheros Wifi firmware hash does not match. The driver has not been installed.'
  373. fi
  374. }
  375. configure_wifi() {
  376. if [[ $VARIANT == "mesh" || $VARIANT == "meshclient" || $VARIANT == "meshusb" ]]; then
  377. return
  378. fi
  379. if [ -f $WIFI_NETWORKS_FILE ]; then
  380. chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE --networks $WIFI_NETWORKS_FILE
  381. return
  382. fi
  383. if [[ $WIFI_TYPE != 'none' ]]; then
  384. if [ ${#WIFI_PASSPHRASE} -lt 2 ]; then
  385. return
  386. fi
  387. chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE -p $WIFI_PASSPHRASE --hotspot $WIFI_HOTSPOT
  388. else
  389. chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE --hotspot $WIFI_HOTSPOT
  390. fi
  391. }
  392. ##############################################################################
  393. # Mesh networking
  394. ##############################################################################
  395. # for mesh installs
  396. TRACKER_PORT=6969
  397. WIFI_CHANNEL=2
  398. # B.A.T.M.A.N settings
  399. BATMAN_CELLID='02:BA:00:00:03:01'
  400. WIFI_SSID='mesh'
  401. # To avoid confusions these are obtained from the main project file
  402. TOXID_REPO=
  403. TOX_PORT=
  404. TOXCORE_REPO=
  405. TOXIC_REPO=
  406. TOXCORE_COMMIT=
  407. TOXIC_COMMIT=
  408. # These are some default nodes, but you can replace them with trusted nodes
  409. # as you prefer. See https://wiki.tox.im/Nodes
  410. TOX_NODES=
  411. #TOX_NODES=(
  412. # '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
  413. # '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
  414. #)
  415. # To avoid confusions these are obtained from the main project file
  416. ZERONET_REPO=
  417. ZERONET_COMMIT=
  418. ZERONET_PORT=
  419. ZERONET_BLOG_REPO=
  420. ZERONET_BLOG_COMMIT=
  421. ZERONET_MAIL_REPO=
  422. ZERONET_MAIL_COMMIT=
  423. ZERONET_FORUM_REPO=
  424. ZERONET_FORUM_COMMIT=
  425. ZERONET_ID_REPO=
  426. ZERONET_ID_COMMIT=
  427. # Directory where source code is downloaded and compiled
  428. INSTALL_DIR=$HOME/build
  429. INSTALLING_MESH=
  430. initialise_mesh() {
  431. if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
  432. return
  433. fi
  434. if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
  435. return
  436. fi
  437. if [[ $INSECURE == $'yes' ]]; then
  438. echo '*********************************************************'
  439. echo $'WARNING: non-free wifi drivers are being installed.'
  440. echo $' This may compromise the security of your system.'
  441. echo '*********************************************************'
  442. # enable non-free repo
  443. if ! grep -q "non-free" $rootdir/etc/apt/sources.list; then
  444. chroot "$rootdir" sed -i "s| main| main non-free|g" /etc/apt/sources.list
  445. fi
  446. # enable contrib repo
  447. if ! grep -q "contrib" $rootdir/etc/apt/sources.list; then
  448. chroot "$rootdir" sed -i "s| main| main contrib|g" /etc/apt/sources.list
  449. fi
  450. chroot "$rootdir" apt-get update
  451. # install proprietary wifi drivers
  452. # see https://wiki.debian.org/iwlwifi
  453. chroot "$rootdir" apt-get -y install firmware-iwlwifi firmware-b43-installer firmware-brcm80211
  454. fi
  455. INSTALLING_MESH=1
  456. configure_firewall
  457. install_avahi
  458. install_batman
  459. install_tomb
  460. install_tox
  461. install_web_server
  462. install_zeronet
  463. MESH_SERVICE='mesh-setup.service'
  464. MESH_SETUP_DAEMON=$rootdir/etc/systemd/system/$MESH_SERVICE
  465. MESH_STARTUP_PARAMS="${MY_USERNAME}"
  466. if [[ $AMNESIC != 'no' ]]; then
  467. MESH_STARTUP_PARAMS="${MY_USERNAME} amnesic"
  468. fi
  469. echo '[Unit]' > $MESH_SETUP_DAEMON
  470. echo 'Description=Initial mesh router configuration' >> $MESH_SETUP_DAEMON
  471. echo 'After=syslog.target' >> $MESH_SETUP_DAEMON
  472. echo 'After=network.target' >> $MESH_SETUP_DAEMON
  473. echo '[Service]' >> $MESH_SETUP_DAEMON
  474. echo 'Type=simple' >> $MESH_SETUP_DAEMON
  475. echo 'User=root' >> $MESH_SETUP_DAEMON
  476. echo 'Group=root' >> $MESH_SETUP_DAEMON
  477. echo 'WorkingDirectory=/root' >> $MESH_SETUP_DAEMON
  478. echo "ExecStart=/usr/local/bin/${PROJECT_NAME}-image-mesh ${MESH_STARTUP_PARAMS} > /var/log/mesh-setup.log" >> $MESH_SETUP_DAEMON
  479. echo '' >> $MESH_SETUP_DAEMON
  480. echo 'TimeoutSec=99999' >> $MESH_SETUP_DAEMON
  481. echo '' >> $MESH_SETUP_DAEMON
  482. echo '[Install]' >> $MESH_SETUP_DAEMON
  483. echo 'WantedBy=multi-user.target' >> $MESH_SETUP_DAEMON
  484. chroot "$rootdir" systemctl enable $MESH_SERVICE
  485. }
  486. # User interface for USB drive installs ######################################
  487. function mesh_client_startup_applications {
  488. if [ ! -d $rootdir/home/$MY_USERNAME/Desktop ]; then
  489. mkdir -p $rootdir/home/$MY_USERNAME/Desktop
  490. fi
  491. if [ ! -d $rootdir/home/$MY_USERNAME/.config/autostart ]; then
  492. mkdir -p $rootdir/home/$MY_USERNAME/.config/autostart
  493. chroot "$rootdir" chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
  494. fi
  495. START_DESKTOP=$rootdir/home/$MY_USERNAME/mesh-desktop.sh
  496. FIRST_BOOT=/home/$MY_USERNAME/.first_boot
  497. echo '#!/bin/bash' > $START_DESKTOP
  498. echo "setxkbmap ${KEYBOARD_MAP}" > $START_DESKTOP
  499. echo 'dconf write /org/mate/caja/desktop/volumes-visible false' >> $START_DESKTOP
  500. echo 'dconf write /org/mate/caja/desktop/computer-icon-visible false' >> $START_DESKTOP
  501. echo 'dconf write /org/mate/caja/desktop/home-icon-visible false' >> $START_DESKTOP
  502. echo 'dconf write /org/mate/caja/desktop/network-icon-visible false' >> $START_DESKTOP
  503. echo 'dconf write /org/mate/caja/desktop/trash-icon-visible false' >> $START_DESKTOP
  504. echo 'dconf write /org/mate/caja/desktop/volumes-visible false' >> $START_DESKTOP
  505. echo 'dconf write /org/mate/desktop/media-handling/automount-open false' >> $START_DESKTOP
  506. echo 'dconf write /org/mate/desktop/screensaver/lock-enabled false' >> $START_DESKTOP
  507. echo "touch /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
  508. echo "chmod 600 /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
  509. echo "env | grep DBUS_SESSION_BUS_ADDRESS > /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
  510. echo "echo 'export DBUS_SESSION_BUS_ADDRESS' >> /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
  511. echo '' >> $START_DESKTOP
  512. echo "if [ ! -f $FIRST_BOOT ]; then" >> $START_DESKTOP
  513. echo ' exit 0' >> $START_DESKTOP
  514. echo 'fi' >> $START_DESKTOP
  515. echo '' >> $START_DESKTOP
  516. echo 'INITIAL_TOX_USERNAME=' >> $START_DESKTOP
  517. echo 'while [ ! $INITIAL_TOX_USERNAME ]; do' >> $START_DESKTOP
  518. echo ' data=$(tempfile 2>/dev/null)' >> $START_DESKTOP
  519. echo ' trap "rm -f $data" 0 1 2 5 15' >> $START_DESKTOP
  520. echo -n " dialog --title \"${MESH_TITLE}\" " >> $START_DESKTOP
  521. echo -n "--backtitle \"${MESH_TITLE}\" " >> $START_DESKTOP
  522. echo -n "--inputbox \"${MESH_SET_USERNAME}\" 12 60 Anon " >> $START_DESKTOP
  523. echo '2>$data' >> $START_DESKTOP
  524. echo ' sel=$?' >> $START_DESKTOP
  525. echo ' case $sel in' >> $START_DESKTOP
  526. echo ' 0)' >> $START_DESKTOP
  527. echo ' INITIAL_TOX_USERNAME=$(<$data)' >> $START_DESKTOP
  528. echo ' if [ ${#INITIAL_TOX_USERNAME} -lt 1 ]; then' >> $START_DESKTOP
  529. echo ' INITIAL_TOX_USERNAME=' >> $START_DESKTOP
  530. echo ' fi' >> $START_DESKTOP
  531. echo ' ;;' >> $START_DESKTOP
  532. echo ' esac' >> $START_DESKTOP
  533. echo 'done' >> $START_DESKTOP
  534. echo '' >> $START_DESKTOP
  535. echo 'toxid --setuser "$INITIAL_TOX_USERNAME"' >> $START_DESKTOP
  536. echo '' >> $START_DESKTOP
  537. echo "rm -f $FIRST_BOOT" >> $START_DESKTOP
  538. echo '' >> $START_DESKTOP
  539. echo 'exit 0' >> $START_DESKTOP
  540. chmod +x $START_DESKTOP
  541. START_DESKTOP2=$rootdir/home/$MY_USERNAME/.config/autostart/mesh-start.desktop
  542. echo '[Desktop Entry]' > $START_DESKTOP2
  543. echo 'Type=Application' >> $START_DESKTOP2
  544. echo 'Name=Mesh start desktop script' >> $START_DESKTOP2
  545. echo "Exec=bash -c '~/mesh-desktop.sh'" >> $START_DESKTOP2
  546. echo 'X-GNOME-Autostart-enabled=true' >> $START_DESKTOP2
  547. chmod +x $START_DESKTOP2
  548. START_DESKTOP3=$rootdir/home/$MY_USERNAME/.config/autostart/set_username.desktop
  549. echo '[Desktop Entry]' > $START_DESKTOP3
  550. echo 'Version=1.0' >> $START_DESKTOP3
  551. echo 'Name=Set Username' >> $START_DESKTOP3
  552. echo 'Type=Application' >> $START_DESKTOP3
  553. echo 'Comment=Set username' >> $START_DESKTOP3
  554. echo "Exec=mate-terminal -e \"bash -c /home/${MY_USERNAME}/mesh-desktop.sh\"" >> $START_DESKTOP3
  555. echo 'Icon=user-away' >> $START_DESKTOP3
  556. echo 'Terminal=false' >> $START_DESKTOP3
  557. echo 'Categories=Application;' >> $START_DESKTOP3
  558. chmod +x $START_DESKTOP3
  559. }
  560. function mesh_desktop_icons {
  561. if [ ! -d $rootdir/home/$MY_USERNAME/Desktop ]; then
  562. mkdir -p $rootdir/home/$MY_USERNAME/Desktop
  563. fi
  564. # Terminal
  565. #echo '[Desktop Entry]' > $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop
  566. #echo 'Name=MATE Terminal' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop
  567. #echo 'Type=Application' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop
  568. #echo 'Comment=Use the command line' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop
  569. #echo 'TryExec=mate-terminal' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop
  570. #echo 'Exec=mate-terminal' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop
  571. #echo 'Icon=terminal' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop
  572. #echo 'StartupNotify=true' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop
  573. chroot "$rootdir" chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop
  574. }
  575. function configure_user_interface {
  576. if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
  577. return
  578. fi
  579. if [ ! $DEBIAN_REPO ]; then
  580. DEBIAN_REPO='ftp.de.debian.org'
  581. fi
  582. if [ ! $DEBIAN_VERSION ]; then
  583. DEBIAN_VERSION='jessie'
  584. fi
  585. # install backports
  586. echo "deb http://${DEBIAN_REPO}/debian/ ${DEBIAN_VERSION}-backports main" >> $rootdir/etc/apt/sources.list
  587. chroot "$rootdir" apt-get -y update
  588. # desktop
  589. chroot "$rootdir" apt-get -y install mate-desktop-environment
  590. # tool to change desktop settings from command line
  591. chroot "$rootdir" apt-get -y install dconf-cli dconf-gsettings-backend dbus dbus-x11
  592. # for tomb
  593. chroot "$rootdir" apt-get -y install pinentry-gtk2
  594. # for tox video
  595. chroot "$rootdir" apt-get -y install ffmpeg cheese v4l-utils
  596. # to provide notifications
  597. chroot "$rootdir" apt-get -y install libnotify-bin
  598. # some dbus stuff to enable notifications
  599. if [[ $VARIANT != "usb" ]]; then
  600. # log in automatically
  601. chroot "$rootdir" apt-get -y install nodm xinit
  602. echo 'NODM_ENABLED=true' > /etc/default/nodm
  603. echo "NODM_USER=$MY_USERNAME" >> /etc/default/nodm
  604. chroot "$rootdir" mkdir /etc/systemd/system/getty@tty1.service.d
  605. echo '[Service]' > $rootdir/etc/systemd/system/getty@tty1.service.d/override.conf
  606. echo 'ExecStart=' >> $rootdir/etc/systemd/system/getty@tty1.service.d/override.conf
  607. echo 'ExecStart=-/sbin/agetty --autologin fbone --noclear %I $TERM' >> $rootdir/etc/systemd/system/getty@tty1.service.d/override.conf
  608. echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx' >> $rootdir/home/$MY_USERNAME/.profile
  609. chroot "$rootdir" systemctl set-default multi-user.target
  610. mesh_client_startup_applications
  611. mesh_desktop_icons
  612. # Different desktop background for amnesic
  613. if [[ $AMNESIC != 'no' ]]; then
  614. MESH_DESKTOP_BACKGROUND_IMAGE=/usr/local/share/${PROJECT_NAME}_mesh_amnesic_background.png
  615. fi
  616. # change the desktop background
  617. if [ $MESH_DESKTOP_BACKGROUND_IMAGE ]; then
  618. if [ -f $MESH_DESKTOP_BACKGROUND_IMAGE ]; then
  619. if [ -d $rootdir/usr/share/images/desktop-base ]; then
  620. cp $MESH_DESKTOP_BACKGROUND_IMAGE $rootdir/usr/share/images/desktop-base/${PROJECT_NAME}_mesh_background.png
  621. chroot "$rootdir" rm /usr/share/images/desktop-base/desktop-background
  622. chroot "$rootdir" ln -s /usr/share/images/desktop-base/${PROJECT_NAME}_mesh_background.png /usr/share/images/desktop-base/desktop-background
  623. fi
  624. fi
  625. fi
  626. else
  627. chroot "$rootdir" apt-get -y install lightdm
  628. fi
  629. # browser
  630. chroot "$rootdir" apt-get -y install $BROWSER
  631. # Tox user interface
  632. enable_tox_repo
  633. mesh_tox_qtox
  634. # copy the default qtox ini file
  635. if [ ! -d ${rootdir}/home/${MY_USERNAME}/.config/tox ]; then
  636. mkdir ${rootdir}/home/${MY_USERNAME}/.config/tox
  637. cp /usr/local/bin/freedombone-config-qtox ${rootdir}/home/${MY_USERNAME}/.config/tox/qtox.ini
  638. chroot "$rootdir" chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config
  639. fi
  640. # Syncthing
  641. install_syncthing
  642. # Add a Sync folder to the desktop
  643. mkdir ${rootdir}/home/${MY_USERNAME}/Sync
  644. chroot "$rootdir" chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/Sync
  645. chroot "$rootdir" ln -s /home/${MY_USERNAME}/Sync /home/${MY_USERNAME}/Desktop/Sync
  646. if [[ $VARIANT == "usb" ]]; then
  647. # tor
  648. chroot "$rootdir" apt-get -y install tor
  649. # xmpp client
  650. chroot "$rootdir" echo "deb ftp://ftp.gajim.org/debian unstable main" > /etc/apt/sources.list.d/gajim.list
  651. chroot "$rootdir" apt-get update
  652. chroot "$rootdir" apt-get -y install gajim-dev-keyring
  653. chroot "$rootdir" apt-get -y install git python-dev python-pip gajim-nightly
  654. chroot "$rootdir" mkdir /home/$GENERIC_IMAGE_USERNAME/.local/share/gajim/plugins -p
  655. chroot "$rootdir" git clone https://github.com/omemo/gajim-omemo /home/$GENERIC_IMAGE_USERNAME/.local/share/gajim/plugins/gajim-omemo
  656. chroot "$rootdir" pip install protobuf==2.6.1, python-axolotl==0.1.35
  657. chroot "$rootdir" chown -R $GENERIC_IMAGE_USERNAME:$GENERIC_IMAGE_USERNAME /home/$GENERIC_IMAGE_USERNAME/.local
  658. # IRC client
  659. chroot "$rootdir" apt-get -y install hexchat profanity
  660. fi
  661. }
  662. ##############################################################################
  663. # Set to true/false to control if eatmydata is used during build
  664. use_eatmydata=true
  665. rootdir="$1"
  666. fmdir="$(pwd)"
  667. image="$fmdir"/"$2"
  668. cd "$rootdir"
  669. echo info: building $MACHINE for $ARCHITECTURE
  670. export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
  671. export LC_ALL=C LANGUAGE=C LANG=C
  672. # Override libpam-tmpdir setting during build, as the directories
  673. # are not created yet.
  674. export TMP=/tmp/ TMPDIR=/tmp/
  675. if [ ! $MY_USERNAME ]; then
  676. echo $'No username was specified'
  677. exit 52825
  678. fi
  679. username=$MY_USERNAME
  680. echo $"warning: creating initial user $username with well known password!"
  681. password=$MY_PASSWORD
  682. chroot "$rootdir" adduser --gecos $username --disabled-password $username
  683. echo $username:$password | chroot $rootdir /usr/sbin/chpasswd
  684. chroot "$rootdir" adduser $username sudo
  685. case "$MACHINE" in
  686. virtualbox)
  687. # hide irrelevant console keyboard messages.
  688. echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \
  689. >> /etc/init.d/rc.local
  690. ;;
  691. qemu)
  692. # hide irrelevant console keyboard messages.
  693. echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \
  694. >> /etc/init.d/rc.local
  695. ;;
  696. esac
  697. set_apt_sources $BUILD_MIRROR
  698. chroot "$rootdir" apt-get clean
  699. chroot "$rootdir" rm -rf /var/lib/apt/lists/*
  700. chroot "$rootdir" apt-get clean
  701. chroot "$rootdir" apt-get update
  702. cat > $rootdir/usr/sbin/policy-rc.d <<EOF
  703. #!/bin/sh
  704. exit 101
  705. EOF
  706. chmod a+rx $rootdir/usr/sbin/policy-rc.d
  707. if $use_eatmydata ; then
  708. enable_eatmydata_override
  709. fi
  710. if [ -n "$CUSTOM_SETUP" ]; then
  711. cp "$CUSTOM_SETUP" "$rootdir"/tmp
  712. chroot "$rootdir" apt-get install -y gdebi-core
  713. chroot "$rootdir" gdebi -n /tmp/"$(basename $CUSTOM_SETUP)"
  714. fi
  715. chroot "$rootdir" apt-get install -y sudo git dialog toilet build-essential openssh-server
  716. chroot "$rootdir" apt-get install -y avahi-daemon avahi-utils avahi-discover avahi-autoipd
  717. chroot "$rootdir" apt-get install -y iptables dnsutils net-tools network-manager iputils-ping
  718. chroot "$rootdir" apt-get install -y libnss-mdns libnss-myhostname libnss-gw-name nano man ntp
  719. chroot "$rootdir" apt-get install -y locales locales-all debconf wireless-tools wpasupplicant
  720. chroot "$rootdir" apt-get install -y usbutils cryptsetup zsh pinentry-curses iotop
  721. sed -i "s|#host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
  722. sed -i "s|host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
  723. chroot "$rootdir" /bin/bash -x <<EOF
  724. git clone $PROJECT_REPO /root/$PROJECT_NAME
  725. cd /root/$PROJECT_NAME
  726. git checkout origin/stockholm -b stockholm
  727. make install
  728. EOF
  729. chroot "$rootdir" ${PROJECT_NAME}-image-hardware-setup 2>&1 | \
  730. tee $rootdir/var/log/${PROJECT_NAME}-image-hardware-setup.log
  731. rm $rootdir/usr/sbin/policy-rc.d
  732. # Set up HRNG for systems known to have one
  733. # Otherwise install haveged
  734. if [[ "$MACHINE" != "beaglebone" ]]; then
  735. chroot $rootdir apt-get -y install haveged
  736. else
  737. chroot $rootdir apt-get -y install rng-tools
  738. sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
  739. fi
  740. # copy u-boot to beginning of image
  741. case "$MACHINE" in
  742. beaglebone)
  743. dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/MLO of="$image" \
  744. count=1 seek=1 conv=notrunc bs=128k
  745. dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img of="$image" \
  746. count=2 seek=1 conv=notrunc bs=384k
  747. ;;
  748. cubieboard2)
  749. dd if=$rootdir/usr/lib/u-boot/Cubieboard2/u-boot-sunxi-with-spl.bin of="$image" \
  750. seek=8 conv=notrunc bs=1k
  751. ;;
  752. a20-olinuxino-lime)
  753. dd if=$rootdir/usr/lib/u-boot/A20-OLinuXino-Lime/u-boot-sunxi-with-spl.bin \
  754. of="$image" seek=8 conv=notrunc bs=1k
  755. ;;
  756. esac
  757. if $use_eatmydata ; then
  758. disable_eatmydata_override
  759. fi
  760. set_apt_sources $MIRROR
  761. chroot "$rootdir" apt-get update
  762. configure_ssh
  763. configure_networking
  764. admin_user_sudo
  765. create_generic_image
  766. atheros_wifi
  767. continue_installation
  768. initialise_mesh
  769. configure_wifi
  770. configure_user_interface
  771. cd /
  772. echo $"info: killing leftover processes in chroot"
  773. fuser -mvk $rootdir/. || true
  774. exit 0