From cd2af02c115e1b3d7877f33471da852ad975dad7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 7 Mar 2018 15:09:31 +0000 Subject: [PATCH 1/9] interface type for wifi adapter search --- src/freedombone-mesh-batman | 6 ++++-- src/freedombone-utils-wifi | 15 ++++++++++----- src/freedombone-wifi | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/freedombone-mesh-batman b/src/freedombone-mesh-batman index 1dd8730c..7b8b40f5 100755 --- a/src/freedombone-mesh-batman +++ b/src/freedombone-mesh-batman @@ -34,11 +34,13 @@ COMPLETION_FILE="/root/${PROJECT_NAME}-completed.txt" # hotspot passphrase must be 5 characters or longer HOTSPOT_PASSPHRASE="${PROJECT_NAME}" +interface_type='wlan' + source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh mesh_protocol_init -update_wifi_adaptors +update_wifi_adaptors "${interface_type}" if [ ! "$IFACE" ]; then echo $'No wlan adaptor' @@ -168,7 +170,7 @@ function add_wifi_interface { # shellcheck disable=SC2120 function start { - update_wifi_adaptors + update_wifi_adaptors "${interface_type}" if [ -z "$IFACE" ] ; then echo 'error: unable to find wifi interface, not enabling batman-adv mesh' diff --git a/src/freedombone-utils-wifi b/src/freedombone-utils-wifi index 663bf8b9..e140028d 100755 --- a/src/freedombone-utils-wifi +++ b/src/freedombone-utils-wifi @@ -100,7 +100,7 @@ function setup_wifi_atheros { fi dpkg -i "$atheros_drivers_file" reset_usb_devices - update_wifi_adaptors + update_wifi_adaptors 'wlan' if [ "$IFACE" ]; then wpa_action "${IFACE}" stop wpa_cli -i "${IFACE}" terminate @@ -198,19 +198,24 @@ function install_atheros_wifi { } function update_wifi_adaptors { + interface_type="$1" IFACE= IFACE_SECONDARY= + if [ ! "$interface_type" ]; then + interface_type='wlan' + fi + for i in $(seq 10 -1 0); do - ifdown --force "wlan${i}" 2> /dev/null + ifdown --force "${interface_type}${i}" 2> /dev/null done for i in $(seq 10 -1 0); do - if grep -q "wlan${i}" /proc/net/dev; then + if grep -q "${interface_type}${i}" /proc/net/dev; then if [ ! $IFACE ]; then IFACE="wlan${i}" else - IFACE_SECONDARY="wlan${i}" + IFACE_SECONDARY="${interface_type}${i}" return fi fi @@ -479,7 +484,7 @@ function wifi_networks_file_header { function create_networks_interactive { remove_config_param "WIFI_INTERFACE" - update_wifi_adaptors + update_wifi_adaptors 'wlan' if [ ! "$IFACE" ]; then # Don't try to configure wifi if there are no adaptors return diff --git a/src/freedombone-wifi b/src/freedombone-wifi index c154f49a..da673c7b 100755 --- a/src/freedombone-wifi +++ b/src/freedombone-wifi @@ -150,7 +150,7 @@ if [ ! ${wifi_interface_specified} ]; then else sleep "${WAIT_SEC}" fi - update_wifi_adaptors + update_wifi_adaptors 'wlan' if [ ! $IFACE ]; then echo $'No wifi adaptors were found' exit 872356 From 1564cb18db1a00c5033045ae79e360aaaac8b169 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 7 Mar 2018 15:22:13 +0000 Subject: [PATCH 2/9] Not so restrictive on allowing mesh interfaces --- src/freedombone-utils-avahi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/freedombone-utils-avahi b/src/freedombone-utils-avahi index 7d24de6f..8895cd41 100755 --- a/src/freedombone-utils-avahi +++ b/src/freedombone-utils-avahi @@ -65,10 +65,10 @@ function mesh_avahi { sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" "$rootdir/etc/avahi/avahi-daemon.conf" sed -i "s|use-ipv4=.*|use-ipv4=no|g" "$rootdir/etc/avahi/avahi-daemon.conf" sed -i "s|use-ipv6=.*|use-ipv6=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf" - sed -i "s|#allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf" - sed -i "s|allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf" - sed -i "s|#deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf" - sed -i "s|deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf" + #sed -i "s|#allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf" + #sed -i "s|allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf" + #sed -i "s|#deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf" + #sed -i "s|deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf" sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf" sed -i "s|disallow-other-stacks=.*|disallow-other-stacks=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf" sed -i "s|#publish_addresses=.*|publish_addresses=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf" From 9f14c00645fa4db151194c19fd81ce87acd7e16b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 7 Mar 2018 15:35:10 +0000 Subject: [PATCH 3/9] optionally a file can contain the mesh interface type --- src/freedombone-mesh-batman | 47 +++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/freedombone-mesh-batman b/src/freedombone-mesh-batman index 7b8b40f5..48177bd7 100755 --- a/src/freedombone-mesh-batman +++ b/src/freedombone-mesh-batman @@ -8,7 +8,7 @@ # # Freedom in the Cloud # -# Used to enable or disable batman mesh protocol on wlanX +# Used to enable or disable batman mesh protocol on a given interface # # License # ======= @@ -34,24 +34,12 @@ COMPLETION_FILE="/root/${PROJECT_NAME}-completed.txt" # hotspot passphrase must be 5 characters or longer HOTSPOT_PASSPHRASE="${PROJECT_NAME}" -interface_type='wlan' +# The type of interface which the mesh will run on +MESH_INTERFACE_TYPE='wlan' source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh -mesh_protocol_init -update_wifi_adaptors "${interface_type}" - -if [ ! "$IFACE" ]; then - echo $'No wlan adaptor' - exit 0 -fi - -if [ -e /etc/default/batctl ]; then - # shellcheck disable=SC1091 - . /etc/default/batctl -fi - function status { batctl o @@ -170,7 +158,7 @@ function add_wifi_interface { # shellcheck disable=SC2120 function start { - update_wifi_adaptors "${interface_type}" + update_wifi_adaptors "${MESH_INTERFACE_TYPE}" if [ -z "$IFACE" ] ; then echo 'error: unable to find wifi interface, not enabling batman-adv mesh' @@ -237,7 +225,7 @@ function start { brctl addif "$BRIDGE" "$EIFACE" ifconfig "$EIFACE" 0.0.0.0 ifconfig "$EIFACE" up promisc - echo $'End of ethernet bridge' + echo $'End of internet bridge' sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx6.service sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx7.service @@ -359,6 +347,31 @@ function monitor { start } +# optionally a file can contain the mesh interface type +mesh_interface_type_file=/root/.mesh_interface_type +if [ -f "$mesh_interface_type_file" ]; then + MESH_INTERFACE_TYPE=$(head -n 1 < "$mesh_interface_type_file") + if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then + MESH_INTERFACE_TYPE='wlan' + fi + if [[ "$MESH_INTERFACE_TYPE" == 'eth'* ]]; then + MESH_INTERFACE_TYPE='eth' + fi +fi + +mesh_protocol_init +update_wifi_adaptors "${MESH_INTERFACE_TYPE}" + +if [ ! "$IFACE" ]; then + echo $'No wlan adaptor' + exit 0 +fi + +if [ -e /etc/default/batctl ]; then + # shellcheck disable=SC1091 + . /etc/default/batctl +fi + if ! grep -q "$IFACE" /proc/net/dev; then echo "Interface \$IFACE was not found" stop From e209eef34eeeca8ac47636a0b8567c9031c45104 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 7 Mar 2018 15:59:09 +0000 Subject: [PATCH 4/9] Allow mesh on an interface other than wlanX --- src/freedombone-mesh-batman | 86 +++++++++++++++++++++++-------------- src/freedombone-utils-mesh | 10 +++-- 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/src/freedombone-mesh-batman b/src/freedombone-mesh-batman index 48177bd7..24bc1a71 100755 --- a/src/freedombone-mesh-batman +++ b/src/freedombone-mesh-batman @@ -74,15 +74,17 @@ function stop { # shellcheck disable=SC2153 if [ "$EIFACE" ]; then - brctl delif "$BRIDGE" bat0 - ifconfig "$BRIDGE" down || true - ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier") - if [[ "$ethernet_connected" != "0" ]]; then - systemctl stop hostapd - brctl delif "$BRIDGE" "$EIFACE" - ifconfig "$EIFACE" down -promisc + if [[ "$EIFACE" != "$IFACE" ]] ; then + brctl delif "$BRIDGE" bat0 + ifconfig "$BRIDGE" down || true + ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier") + if [[ "$ethernet_connected" != "0" ]]; then + systemctl stop hostapd + brctl delif "$BRIDGE" "$EIFACE" + ifconfig "$EIFACE" down -promisc + fi + brctl delbr "$BRIDGE" fi - brctl delbr "$BRIDGE" fi ifconfig bat0 down -promisc @@ -90,7 +92,9 @@ function stop { batctl if del "$IFACE" ifconfig "$IFACE" mtu 1500 ifconfig "$IFACE" down - iwconfig "$IFACE" mode managed + if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then + iwconfig "$IFACE" mode managed + fi if [ "$IFACE_SECONDARY" ]; then systemctl stop hostapd @@ -98,7 +102,9 @@ function stop { batctl if del "$IFACE_SECONDARY" ifconfig "$IFACE_SECONDARY" mtu 1500 ifconfig "$IFACE_SECONDARY" down - iwconfig "$IFACE_SECONDARY" mode managed + if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then + iwconfig "$IFACE_SECONDARY" mode managed + fi fi rmmod batman-adv @@ -149,8 +155,10 @@ function add_wifi_interface { fi ifconfig "$ifname" hw ether "$peermac" echo $"$ifname assigned MAC address $peermac" - iwconfig "$ifname" enc off - iwconfig "$ifname" mode "$ifmode" essid "$ifssid" channel "$ifchannel" + if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then + iwconfig "$ifname" enc off + iwconfig "$ifname" mode "$ifmode" essid "$ifssid" channel "$ifchannel" + fi batctl if add "$ifname" ifconfig "$ifname" up @@ -184,13 +192,15 @@ function start { rfkill unblock "$(rfkill list|awk -F: "/phy/ {print $1}")" || true secondary_wifi_available= - if [ "$IFACE_SECONDARY" ]; then - if [[ "$IFACE" != "$IFACE_SECONDARY" ]]; then - if [ -d /etc/hostapd ]; then - if [ ${#HOTSPOT_PASSPHRASE} -gt 4 ]; then - secondary_wifi_available=1 - else - echo $'Hotspot passphrase is too short' + if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then + if [ "$IFACE_SECONDARY" ]; then + if [[ "$IFACE" != "$IFACE_SECONDARY" ]]; then + if [ -d /etc/hostapd ]; then + if [ ${#HOTSPOT_PASSPHRASE} -gt 4 ]; then + secondary_wifi_available=1 + else + echo $'Hotspot passphrase is too short' + fi fi fi fi @@ -219,21 +229,23 @@ function start { ifconfig bat0 0.0.0.0 ethernet_connected='0' if [ "$EIFACE" ] ; then - ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier") - if [[ "$ethernet_connected" != "0" ]]; then - echo $'Trying ethernet bridge to the internet' - brctl addif "$BRIDGE" "$EIFACE" - ifconfig "$EIFACE" 0.0.0.0 - ifconfig "$EIFACE" up promisc - echo $'End of internet bridge' + if [[ "$EIFACE" != "$IFACE" ]] ; then + ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier") + if [[ "$ethernet_connected" != "0" ]]; then + echo $'Trying ethernet bridge to the internet' + brctl addif "$BRIDGE" "$EIFACE" + ifconfig "$EIFACE" 0.0.0.0 + ifconfig "$EIFACE" up promisc + echo $'End of internet bridge' - sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx6.service - sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx7.service - sed -i "s|ExecStart=.*|ExecStart=/usr/local/sbin/olsrd2_static ${IFACE} ${EIFACE}|g" /etc/systemd/system/olsr2.service - sed -i "s|ExecStart=.*|ExecStart=/usr/local/bin/babeld ${IFACE} ${EIFACE}|g" /etc/systemd/system/babel.service - systemctl daemon-reload - else - echo $"$EIFACE is not connected" + sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx6.service + sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx7.service + sed -i "s|ExecStart=.*|ExecStart=/usr/local/sbin/olsrd2_static ${IFACE} ${EIFACE}|g" /etc/systemd/system/olsr2.service + sed -i "s|ExecStart=.*|ExecStart=/usr/local/bin/babeld ${IFACE} ${EIFACE}|g" /etc/systemd/system/babel.service + systemctl daemon-reload + else + echo $"$EIFACE is not connected" + fi fi fi ifconfig "$BRIDGE" up @@ -292,6 +304,9 @@ function start { } function monitor { + if [[ "$MESH_INTERFACE_TYPE" != 'wlan'* ]]; then + return + fi if [ -z "$IFACE" ] ; then echo 'error: unable to find wifi interface, not enabling batman-adv mesh' exit 723657 @@ -360,6 +375,11 @@ if [ -f "$mesh_interface_type_file" ]; then fi mesh_protocol_init + +if [[ "$MESH_INTERFACE_TYPE" == 'eth'* ]]; then + MESH_INTERFACE_TYPE='eth' +fi + update_wifi_adaptors "${MESH_INTERFACE_TYPE}" if [ ! "$IFACE" ]; then diff --git a/src/freedombone-utils-mesh b/src/freedombone-utils-mesh index 6b1ddcc9..f6eae5aa 100755 --- a/src/freedombone-utils-mesh +++ b/src/freedombone-utils-mesh @@ -99,11 +99,13 @@ function mesh_protocol_init { IFACE= IFACE_SECONDARY= EIFACE=eth0 - WLAN_ADAPTORS=$(count_wlan) + if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then + WLAN_ADAPTORS=$(count_wlan) - if [ "$WLAN_ADAPTORS" -eq 0 ]; then - echo $'No wlan adaptors found' - exit 0 + if [ "$WLAN_ADAPTORS" -eq 0 ]; then + echo $'No wlan adaptors found' + exit 0 + fi fi } From 0d7c5033636a8b2dd2521520405b0262ffcc018c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 7 Mar 2018 17:26:48 +0000 Subject: [PATCH 5/9] Commands to switch between wired and wireless mesh --- src/freedombone-image-customise | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index d7b917a3..c3510e61 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -973,6 +973,18 @@ initialise_mesh() { MESH_STARTUP_PARAMS="${MY_USERNAME} amnesic" fi + # command to switch to wired mesh + { echo '#!/bin/bash'; + echo 'echo -n "eth" > /root/.mesh_interface_type'; + echo 'systemctl reboot -i'; } > "$rootdir/usr/bin/wired" + chmod +x "$rootdir/usr/bin/wired" + + # command to switch to wireless mesh + { echo '#!/bin/bash'; + echo 'echo -n "wlan" > /root/.mesh_interface_type'; + echo 'systemctl reboot -i'; } > "$rootdir/usr/bin/wireless" + chmod +x "$rootdir/usr/bin/wireless" + { echo '[Unit]'; echo 'Description=Initial mesh router configuration'; echo 'After=syslog.target'; From 4c21484c95188e78c6c62c5e04ceb7e849847e65 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 7 Mar 2018 22:26:08 +0000 Subject: [PATCH 6/9] dat-boi daemon --- src/freedombone-app-scuttlebot | 38 ++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/freedombone-app-scuttlebot b/src/freedombone-app-scuttlebot index 3c96b4b5..f13ed568 100755 --- a/src/freedombone-app-scuttlebot +++ b/src/freedombone-app-scuttlebot @@ -373,19 +373,49 @@ function mesh_install_dat { #!/bin/bash npm install --arch=$NPM_ARCH -g dat npm install --arch=$NPM_ARCH -g @garbados/dat-boi -npm install --arch=$NPM_ARCH -g add-to-systemd -add-to-systemd dat-boi --user "$(whoami)" "$(which dat-boi)" EOF chroot "$rootdir" /bin/chmod +x /usr/bin/install_dat chroot "$rootdir" /usr/bin/install_dat rm "$rootdir/usr/bin/install_dat" + + { echo '[Unit]'; + echo 'Description=DAT-boi'; + echo 'After=syslog.target'; + echo 'After=network.target'; + echo ''; + echo '[Service]'; + echo 'Type=simple'; + echo 'User=root'; + echo 'Group=root'; + echo 'ExecStart=/usr/local/bin/dat-boi'; + echo 'Restart=always'; + echo ''; + echo '[Install]'; + echo 'WantedBy=multi-user.target'; } > "$rootdir/etc/systemd/system/dat-boi.service" + chmod +x "$rootdir/etc/systemd/system/dat-boi.service" + chroot "$rootdir" systemctl enable dat-boi } function install_dat { npm install -g dat npm install -g @garbados/dat-boi - npm install -g add-to-systemd - add-to-systemd dat-boi --user "$(whoami)" "$(which dat-boi)" + + { echo '[Unit]'; + echo 'Description=DAT-boi'; + echo 'After=syslog.target'; + echo 'After=network.target'; + echo ''; + echo '[Service]'; + echo 'Type=simple'; + echo 'User=root'; + echo 'Group=root'; + echo 'ExecStart=/usr/local/bin/dat-boi'; + echo 'Restart=always'; + echo ''; + echo '[Install]'; + echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/dat-boi.service + chmod +x /etc/systemd/system/dat-boi.service + systemctl enable dat-boi } function mesh_install_scuttlebot { From d1dce3d3d77568f1dd05fc0dd4f0086ccd17a105 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 8 Mar 2018 11:09:11 +0000 Subject: [PATCH 7/9] Consistent function style --- src/freedombone-image-customise | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index c3510e61..db060082 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -143,11 +143,11 @@ BMX7_COMMIT='0a82c7c10fef44b259b35e77ab33632aa132d219' PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin -function configure_backports { +configure_backports() { echo "deb http://${DEBIAN_REPO}/debian/ ${DEBIAN_VERSION}-backports main" >> "$rootdir/etc/apt/sources.list" } -function configure_contrib_repo { +configure_contrib_repo() { if ! grep -q "contrib" "$rootdir/etc/apt/sources.list"; then chroot "$rootdir" /bin/sed -i "s| main| main contrib|g" /etc/apt/sources.list fi From bbf1b9461d4327d40dedf954574a911b5f0dd4df Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 8 Mar 2018 11:13:07 +0000 Subject: [PATCH 8/9] Consistent function style --- src/freedombone-image-customise | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index db060082..561407f4 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -1007,7 +1007,7 @@ initialise_mesh() { # User interface for USB drive installs ###################################### -function mesh_client_startup_applications { +mesh_client_startup_applications() { if [ ! -d "$rootdir/home/$MY_USERNAME/Desktop" ]; then mkdir -p "$rootdir/home/$MY_USERNAME/Desktop" fi @@ -1086,7 +1086,7 @@ function mesh_client_startup_applications { chmod +x "$START_DESKTOP2" } -function mesh_desktop_icons { +mesh_desktop_icons() { if [ ! -d "$rootdir/home/$MY_USERNAME/Desktop" ]; then mkdir -p "$rootdir/home/$MY_USERNAME/Desktop" fi @@ -1104,7 +1104,7 @@ function mesh_desktop_icons { chroot "$rootdir" /bin/chown -R "$MY_USERNAME":"$MY_USERNAME" "/home/$MY_USERNAME/Desktop" } -function configure_user_interface { +configure_user_interface() { if [[ "$VARIANT" != "meshclient" && "$VARIANT" != "meshusb" && "$VARIANT" != "usb" ]]; then return fi @@ -1642,7 +1642,7 @@ EOF # setup_utils ############################################################################## -function image_install_inadyn { +image_install_inadyn() { if [ "$INSTALLING_MESH" ]; then return fi @@ -1705,7 +1705,7 @@ function image_install_inadyn { echo "inadyn commit:$INADYN_COMMIT" >> "$rootdir/root/freedombone-completed.txt" } -function image_setup_utils { +image_setup_utils() { if [ "$INSTALLING_MESH" ]; then return fi @@ -1893,12 +1893,12 @@ function image_setup_utils { #sed -i 's|btrfs subvol=@|btrfs defaults,subvol=@,compress=lzo,ssd|g' $rootdir/etc/fstab } -function image_install_nodejs { +image_install_nodejs() { mesh_install_nodejs #echo 'install_nodejs' >> ${rootdir}/root/${PROJECT_NAME}-completed.txt } -function image_preinstall_repos { +image_preinstall_repos() { if [[ "$VARIANT" == "mesh"* ]]; then return fi From a012bc8477df358528b92b0e624dc7cdff1ea044 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 8 Mar 2018 11:50:07 +0000 Subject: [PATCH 9/9] Replacements in custom build script --- src/freedombone-image-make | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/freedombone-image-make b/src/freedombone-image-make index fcf99df9..db45e646 100755 --- a/src/freedombone-image-make +++ b/src/freedombone-image-make @@ -193,7 +193,7 @@ fi echo $'Changing values within customised customisation script' cp "$PROJECT_INSTALL_DIR/${PROJECT_NAME}-image-customise" "$TEMP_CUSTOMISE3" if [ "$MYUSERNAME" ]; then - sed -i "s|MY_USERNAME=.*|MY_USERNAME=${MYUSERNAME}|g" "$TEMP_CUSTOMISE3" + sed -i "0,/MY_USERNAME=.*/s//MY_USERNAME=${MYUSERNAME}/" "$TEMP_CUSTOMISE3" fi if [ "$MYPASSWORD" ]; then sed -i "s|MY_PASSWORD=.*|MY_PASSWORD=${MYPASSWORD}|g" "$TEMP_CUSTOMISE3" @@ -211,7 +211,7 @@ sed -i "s|CONFIG_FILENAME=.*|CONFIG_FILENAME=${CONFIG_FILENAME}|g" "$TEMP_CUSTOM sed -i "s|SSH_PUBKEY=.*|SSH_PUBKEY=${SSH_PUBKEY}|g" "$TEMP_CUSTOMISE3" sed -i "s|GENERIC_IMAGE=.*|GENERIC_IMAGE=${GENERIC_IMAGE}|g" "$TEMP_CUSTOMISE3" sed -i "s|MINIMAL_INSTALL=.*|MINIMAL_INSTALL=\"${MINIMAL_INSTALL}\"|g" "$TEMP_CUSTOMISE3" -sed -i "s|SSH_PORT=.*|SSH_PORT=\"${SSH_PORT}\"|g" "$TEMP_CUSTOMISE3" +sed -i "0,/SSH_PORT=.*/s//SSH_PORT=\"${SSH_PORT}\"/" "$TEMP_CUSTOMISE3" sed -i "s|ONION_ONLY=.*|ONION_ONLY=\"${ONION_ONLY}\"|g" "$TEMP_CUSTOMISE3" sed -i "s|PROJECT_REPO=.*|PROJECT_REPO=\"${PROJECT_REPO}\"|g" "$TEMP_CUSTOMISE3" sed -i "s|DEBIAN_INSTALL_ONLY=.*|DEBIAN_INSTALL_ONLY=\"${DEBIAN_INSTALL_ONLY}\"|g" "$TEMP_CUSTOMISE3"