From 0f83ec05556d1dea8b6b2529fa8be6cd61fcb248 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 28 Jan 2025 18:09:43 +0200 Subject: [PATCH 01/13] Improve runonce text. --- .../usr/local/bin/femto-runonce.sh | 31 ++++++++----------- .../usr/local/bin/femto-software.sh | 2 +- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 006066b..195bcd6 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -13,11 +13,18 @@ if ! grep -qE '^first_boot=true' /etc/femto.conf; then # if not the first boot export LANG=C.UTF-8 dialog --title "Femtofox run once utility" --yesno "\ This does not appear to be this system's first boot.\n\ -Re-running this script will resize the filesystem to fit the SD card, allocate a swap file, add RTC support, add terminal type to .bashrc, set the eth0 MAC address to be derivative of the CPU serial number and then reboot.\n\ +\n\ +Re-running this script will:\n\ +* Resize filesystem to fit the SD card\n\ +* Allocate the swap file\n\ +* Add terminal type to user femto's .bashrc\n\ +* Set the eth0 MAC to be derivative of CPU serial number\n\ +\n\ +Finally, the Femtofox will reboot.\n\ \n\ Re-running this script after first boot should not cause any harm, but may not work as expected.\n\ \n\ -Proceed?" 15 60 +Proceed?" 19 60 if [ $? -eq 1 ]; then #if cancel/no exit 0 fi @@ -35,9 +42,6 @@ echo -e "\e[32m******* First boot *******\e[0m" done ) & -# Disable LED to prevent boot codes from showing during this boot -#sh -c "echo 34 > /sys/class/gpio/unexport" - # Perform filesystem resize log_message "Resizing filesystem. This can take up to 10 minutes, depending on microSD card size and speed" sudo resize2fs /dev/mmcblk1p5 @@ -51,7 +55,6 @@ if [ ! -f /swapfile ]; then # check if swap file already exists sudo mkswap /swapfile > /dev/null sudo swapon /swapfile > /dev/null echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null -# touch /etc/.filesystem_swap # no longer used log_message "Swap file allocated." else log_message "Swap file already allocated, skipping." @@ -62,8 +65,9 @@ fi #log_message "Added ds1307/ds3231 RTC support." # prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip +mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')" if ! grep -q "eth0" /etc/network/interfaces; then - log_message "Setting eth0 MAC address to derivative of CPU s/n." + log_message "Setting eth0 MAC address to $mac (derivative of CPU s/n)" cat <> /etc/network/interfaces # static mac address for onboard ethernet (castellated pins) allow-hotplug eth0 @@ -71,7 +75,7 @@ iface eth0 inet dhcp hwaddress ether $(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//') EOF else - log_message "eth0 already exists in /etc/network/interfaces, skipping." + log_message "eth0 already exists in /etc/network/interfaces, skipping" fi # Add term stuff to .bashrc @@ -85,17 +89,8 @@ else echo "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping" fi -# set meshtastic nodeid to derivative of CPU serial number (unique to this board) -#seed=$(sed -n '/Serial/ s/^.*: \(.*\)$/\U\1/p' /proc/cpuinfo | bc | tail -c 9) -#seed=$((0x$(awk '/Serial/ {print $3}' /proc/cpuinfo) & 0x3B9AC9FF)) #alternate method for generating seed - not in use -#sed -i "s|^ExecStart=/usr/sbin/meshtasticd.*|ExecStart=/usr/sbin/meshtasticd -h $seed|" /usr/lib/systemd/system/meshtasticd.service -#log_message "Using Luckfox CPU S/N to generate nodeid for Meshtastic." -#systemctl daemon-reload -#systemctl enable meshtasticd -#systemctl restart meshtasticd - # remove first boot flag sed -i -E 's/^first_boot=.*/first_boot=false/' /etc/femto.conf log_message "Removing first boot flag and rebooting in 5 seconds..." sleep 5 -reboot +reboot \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 1321245..a77c052 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -91,7 +91,7 @@ package_menu() { $(if $package_dir/$1.sh -O | grep -q 's' && $package_dir/$1.sh -I; then echo "Stop service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'r' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Get service status x"; fi) \ - "" "" \ + " " "" \ "Back to software manager" "" 3>&1 1>&2 2>&3) exit_status=$? # This line checks the exit status of the dialog command From 6534d4a3a01d304e735c11269f2bbe209a0c5313 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 29 Jan 2025 15:12:53 +0200 Subject: [PATCH 02/13] Add Samba file sharing support, and improve software menu Software menu is now entirely dynamically generated from the contents of /usr/local/bin/packages. To add a new software package, simply create a package file in that directory. --- environment-setup/femtofox.chroot | 3 +- .../usr/local/bin/femto-software.sh | 48 +++--- .../usr/local/bin/packages/contact_client.sh | 2 +- .../usr/local/bin/packages/meshing_around.sh | 2 +- .../bin/packages/mosquitto_mqtt_broker.sh | 2 +- .../bin/packages/mosquitto_mqtt_client.sh | 2 +- .../local/bin/packages/package_template.sh | 4 +- .../usr/local/bin/packages/samba.sh | 146 ++++++++++++++++++ .../usr/local/bin/packages/tc2_bbs.sh | 2 +- 9 files changed, 183 insertions(+), 28 deletions(-) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index e45fae5..4b18cc7 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -27,7 +27,7 @@ ln -sf /usr/share/zoneinfo/UTC /etc/localtime echo "Installing packages..." apt update -DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode software-properties-common python-is-python3 python3.10-venv lsof spi-tools python3-luma.oled +DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode software-properties-common python-is-python3 python3.10-venv lsof spi-tools python3-luma.oled samba if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi DEBIAN_FRONTEND=noninteractive apt upgrade -y --option Dpkg::Options::="--force-confold" @@ -59,6 +59,7 @@ systemctl enable femto-usb-config-tool.service systemctl enable femto-boot-complete.service systemctl enable wifi-mesh-control +systemctl disable smbd nmbd # samba services, can be enabled via menu systemctl disable NetworkManager systemctl disable NetworkManager-dispatcher systemctl disable NetworkManager-wait-online diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index a77c052..f30cfb4 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -116,31 +116,39 @@ package_menu() { done } - +# generate menu from filenames in /usr/local/bin/packages while true; do -title="$title" - software_option=$(dialog --no-collapse --cancel-label "Back" --default-item "$software_option" --menu "$title" 0 0 6 \ - 1 "The Comms Channel BBS, TC²BBS" \ - 2 "Contact (Meshtastic client)" \ - 3 "Meshing Around by Spud" \ - 4 "Mosquitto MQTT Broker" \ - 5 "Mosquitto MQTT Client" \ - " " ""\ - 6 "Back to Main Menu" 3>&1 1>&2 2>&3) - + menu_entries=() + index=1 + for file in /usr/local/bin/packages/*.sh; do + filename=$(basename "$file" .sh) + [[ "$filename" == "package_template" ]] && continue # skip package_template.sh + menu_entries+=("$index" "$(/usr/local/bin/packages/"$filename".sh -N)") + ((index++)) + done + + menu_entries+=(" " "") # add blank line and "Back to Main Menu" entry + menu_entries+=("$index" "Back to main menu") + software_option=$(dialog --no-collapse --cancel-label "Back" --default-item "$software_option" --menu "$title" $((9 + index)) 50 $((index + 1)) "${menu_entries[@]}" 3>&1 1>&2 2>&3) exit_status=$? # This line checks the exit status of the dialog command if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog break fi - - case $software_option in - 1) package_intro "tc2_bbs" ;; - 2) package_intro "contact_client" ;; - 3) package_intro "meshing_around" ;; - 4) package_intro "mosquitto_mqtt_broker" ;; - 5) package_intro "mosquitto_mqtt_client" ;; - 6) break ;; - esac + + case_block=" case \$software_option in" + index=1 + for file in /usr/local/bin/packages/*.sh; do + filename=$(basename "$file" .sh) + [[ "$filename" == "package_template" ]] && continue # skip package_template.sh + case_block+=" + $index) package_intro \"$filename\" ;;" + ((index++)) + done + + case_block+=" + $index) break ;; + esac" #add return to main menu option + eval "$case_block" # Execute the generated case statement done exit 0 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 4e18dd0..082f891 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -48,7 +48,7 @@ name="Contact" # software name author="pdxlocations" # software author - OPTIONAL description="A Text-Based Console UI for Meshtastic Nodes.\nAfter install, run \`contact\` to launch." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/pdxlocations/contact/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiuglNADUOLIto" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiuglNADUOSLCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="python /opt/contact/main.py --host" # command to launch software, if applicable service_name="" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/contact" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh index 06528da..9d86eac 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh @@ -52,7 +52,7 @@ name="Meshing Around" # software name author="Spud" # software author - OPTIONAL description="Meshing Around is a feature-rich bot designed to enhance your Meshtastic network experience with a variety of powerful tools and fun features. Connectivity and utility through text-based message delivery. Whether you're looking to perform network tests, send messages, or even play games, mesh_bot.py has you covered." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/SpudGunMan/meshing-around" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrNADUOSLCIto" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSLCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="mesh_bot pong_bot mesh_bot_reporting" # the name of the service, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/meshing-around" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh index e8a264d..a58edf1 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh @@ -53,7 +53,7 @@ name="Mosquitto MQTT Broker" # software name author="Eclipse Foundation" # software author - OPTIONAL description="Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.\n\nThe MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.\n\nThe Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.\n\nMosquitto is part of the Eclipse Foundation, and is an iot.eclipse.org project. The development is driven by Cedalo." # software description - OPTIONAL (but strongly recommended!) URL="https://mosquitto.org/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedslNADUOSLCIto" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="mosquitto" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh index 834d85c..23b77c0 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh @@ -53,7 +53,7 @@ name="Mosquitto MQTT Client" # software name author="Eclipse Foundation" # software author - OPTIONAL description="Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.\n\nThe MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.\n\nThe Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.\n\nMosquitto is part of the Eclipse Foundation, and is an iot.eclipse.org project. The development is driven by Cedalo." # software description - OPTIONAL (but strongly recommended!) URL="https://mosquitto.org/" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedslNADUOSLCIto" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh index 19a5dcd..8af9bc6 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh @@ -47,13 +47,13 @@ EOF # Successful operations should `exit 0`, fails should `exit 1` # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` # Everything following `user_message: ` will be displayed prominently to the user, so it must the last thing echoed - +hxiugedsrlNADUOSLCI name="name" # software name author="author" # software author - OPTIONAL description="description" # software description - OPTIONAL (but strongly recommended!) URL="URL" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrlNADUOSLCIto" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrlNADUOSLCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="service_name" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/location" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh new file mode 100644 index 0000000..dbd2353 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -0,0 +1,146 @@ +#!/bin/bash +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root. Try \`sudo\`." + exit 1 +fi +if [ $# -eq 0 ]; then + echo "No arguments provided." + echo -e "$help" + exit 1 +fi + +args="$@" # arguments to this script +interaction="true" +help=$(cat <&1 | tee /dev/tty # allows output to be shown onscreen + DEBIAN_FRONTEND=noninteractive apt-get install samba -y 2>&1 | tee /dev/tty # allows output to be shown onscreen + echo "user_message: System comes with a configuration file to share /home/femto. See \`/etc/samba/smb.conf\`." + exit 0 # should be `exit 1` if operation failed +} + + +# uninstall script +uninstall() { + DEBIAN_FRONTEND=noninteractive apt remove -y samba 2>&1 | tee /dev/tty + echo "user_message: Some files may remain on system. To remove, run \`sudo apt remove --purge samba -y\` and \`sudo apt autoremove -y\`." + exit 0 # should be `exit 1` if operation failed +} + + +#upgrade script +upgrade() { + echo "apt update can take a long while..." + DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen + DEBIAN_FRONTEND=noninteractive apt upgrade -y samba 2>&1 | tee /dev/tty + exit 0 # should be `exit 1` if operation failed +} + +# Check if already installed. `exit 0` if yes, `exit 1` if no +check() { +if dpkg -l | grep -q samba; then + exit 0 +else + exit 1 +fi +} + +while getopts ":h$options" opt; do + case ${opt} in + h) # Option -h (help) + echo -e "$help" + ;; + x) # Option -x (no user interaction available) + interaction="false" + ;; + i) # Option -i (install) + install + ;; + u) # Option -u (uninstall) + uninstall + ;; + g) # Option -g (upgrade) + upgrade + ;; + e) # Option -e (Enable service, if applicable) + systemctl enable $service_name + ;; + d) # Option -d (Disable service, if applicable) + systemctl disable $service_name + ;; + s) # Option -s (Stop service) + systemctl stop $service_name + ;; + r) # Option -r (Start/Restart) + systemctl restart $service_name + ;; + l) # Option -l (Run software) + echo "Launching $name..." + sudo -u ${SUDO_USER:-$(whoami)} $launch + ;; + N) echo -e $name ;; + A) echo -e $author ;; + D) echo $description ;; + U) echo -e $URL ;; + O) echo -e $options ;; + S) # Option -S (Get service status) + systemctl status $service_name + ;; + L) echo -e $location ;; + C) echo -e $conflicts ;; + I) # Option -I (Check if already installed) + check + ;; + esac +done + +exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index 66af6c2..74e9244 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -53,7 +53,7 @@ name="TC2-BBS" # software name author="The Comms Channel" # software author - OPTIONAL description="The TC²-BBS system integrates with Meshtastic devices. The system allows for message handling, bulletin boards, mail systems, and a channel directory." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/TheCommsChannel/TC2-BBS-mesh" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrlNADUOSLCIto" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiugedsrNADUOSLCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="python /opt/TC2-BBS-mesh/server.py" # command to launch software, if applicable service_name="mesh-bbs" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/TC2-BBS-mesh" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` From a1e1009fb31f1149b7e291bc754ad2eaa4eb1816 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 29 Jan 2025 17:42:16 +0200 Subject: [PATCH 03/13] Add samba to chroot --- environment-setup/femtofox.chroot | 13 +++---------- .../usr/local/bin/femto-runonce.sh | 2 +- .../usr/local/bin/femto-software.sh | 3 +-- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 4b18cc7..6e7676a 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -9,23 +9,19 @@ echo "tmpfs /run tmpfs rw,nodev,nosuid,size=32M 0 0" | tee -a /etc/fstab #echo "deb [arch=all signed-by=/etc/apt/keyrings/meshtastic-deb.asc] https://meshtastic.github.io/deb stable main" | tee /etc/apt/sources.list.d/meshtastic-deb.list >/dev/null echo "Removing netdevice rules..." - ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules echo "Setting up kernel modules..." - touch /lib/modules/5.10.160/modules.order touch /lib/modules/5.10.160/modules.builtin depmod -a 5.10.160 if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi echo "Setting localtime to UTC..." - rm /etc/localtime ln -sf /usr/share/zoneinfo/UTC /etc/localtime echo "Installing packages..." - apt update DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode software-properties-common python-is-python3 python3.10-venv lsof spi-tools python3-luma.oled samba if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi @@ -41,17 +37,17 @@ echo "Installing dependencies for meshing-around and meshtastic cli..." pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi -echo "Setting MOTD..." +echo "Adding Samba configuration..." # add it manually so we're always using the most up to date smb.conf file template from the package +echo -e "\n[home]\npath = /home/femto\nbrowsable = yes\nwritable = yes\nread only = no\ncreate mask = 0775\ndirectory mask = 0775\nvalid users = femto" | sudo tee -a /etc/samba/smb.conf > /dev/null && sudo systemctl restart smbd +echo "Setting MOTD..." mv /etc/update-motd.d/10-help-text /etc/update-motd.d/10-help-text.bak mv /etc/update-motd.d/60-unminimize /etc/update-motd.d/60-unminimize.bak echo "Setting hostname to femtofox..." - echo "femtofox" | tee /etc/hostname > /dev/null echo "Configuring autostart of systemd services..." - systemctl enable button systemctl enable meshtasticd systemctl enable femto-runonce.service @@ -78,7 +74,6 @@ systemctl disable veritysetup.target systemctl disable systemd-pstore.service echo "Adding femto and pico users/groups..." - groupmod -n femto pico usermod -l femto pico usermod -aG sudo,input femto @@ -86,7 +81,6 @@ echo "femto ALL=(ALL:ALL) ALL" | tee /etc/sudoers.d/femto > /dev/null chmod 440 /etc/sudoers.d/femto # this seems messy, user:group should be set cleanly and not corrected after? OSC: somethings were owned my pico from factory - find / -group pico -exec chgrp femto {} \; 2>/dev/null find / -user pico -exec chown femto {} \; 2>/dev/null usermod -d /home/femto -m femto @@ -97,6 +91,5 @@ usermod -a -G tty femto usermod -a -G dialout femto echo "Cleaning up chroot..." - apt clean && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* && rm -rf /var/tmp/* && find /var/log -type f -exec truncate -s 0 {} + && : > /root/.bash_history && history -c exit diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 195bcd6..be7cbe1 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -72,7 +72,7 @@ if ! grep -q "eth0" /etc/network/interfaces; then # static mac address for onboard ethernet (castellated pins) allow-hotplug eth0 iface eth0 inet dhcp -hwaddress ether $(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//') +hwaddress ether $mac EOF else log_message "eth0 already exists in /etc/network/interfaces, skipping" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index f30cfb4..30a4da9 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -11,7 +11,6 @@ install() { echo "Installing $($package_dir/$1.sh -N)..." # Run the installation script, capturing the output and displaying it in real time output=$($package_dir/$1.sh -i) - echo $output install_status=$? # Capture the exit status of the eval command user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present #output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output @@ -37,7 +36,7 @@ uninstall() { dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuUninstallation of $($package_dir/$1.sh -N) successful!\Zn$([ -n "$user_message" ] && echo "\n\n$user_message")\n\nLog:\n$(echo -e "$output")" 0 0 # if there's a user_message, display it with two preceeding line breaks else dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuUninstallation of $($package_dir/$1.sh -N) FAILED!\Zn\n\n$user_message\n\nLog:\n$(echo "$output")" 0 0 # if there's a user_message, display it with two preceeding line breaks - fi + fi } upgrade() { From 93f086d66c49b8fd0a2406aa3d1a49025f1fcc8c Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 29 Jan 2025 18:13:46 +0200 Subject: [PATCH 04/13] +x --- .../out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh old mode 100644 new mode 100755 From c8e5fbd8db579746f027e5d7732496a3e265fe9a Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 29 Jan 2025 18:51:25 +0200 Subject: [PATCH 05/13] Final commit for Samba? One can hope. --- environment-setup/femtofox.chroot | 2 +- .../usr/local/bin/femto-software.sh | 20 +++++++++---------- .../usr/local/bin/packages/contact_client.sh | 2 ++ .../usr/local/bin/packages/tc2_bbs.sh | 2 ++ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 6e7676a..1d86242 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -38,7 +38,7 @@ pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beauti if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi echo "Adding Samba configuration..." # add it manually so we're always using the most up to date smb.conf file template from the package -echo -e "\n[home]\npath = /home/femto\nbrowsable = yes\nwritable = yes\nread only = no\ncreate mask = 0775\ndirectory mask = 0775\nvalid users = femto" | sudo tee -a /etc/samba/smb.conf > /dev/null && sudo systemctl restart smbd +echo "\n[home]\npath = /home/femto\nbrowsable = yes\nwritable = yes\nread only = no\ncreate mask = 0775\ndirectory mask = 0775\nvalid users = femto" | sudo tee -a /etc/samba/smb.conf > /dev/null && sudo systemctl restart smbd echo "Setting MOTD..." mv /etc/update-motd.d/10-help-text /etc/update-motd.d/10-help-text.bak diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 30a4da9..bd96cdc 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -13,7 +13,7 @@ install() { output=$($package_dir/$1.sh -i) install_status=$? # Capture the exit status of the eval command user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present - #output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output + output=$(echo -e "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output if [ $install_status -eq 0 ]; then # if the installation was successful dialog --no-collapse --colors --title "$title" --beep --msgbox "\ZuInstallation of $($package_dir/$1.sh -N) successful!\Zn$([ -n "$user_message" ] && echo "\n\n$user_message")\n\nLog:\n$(echo $output)" 0 0 # if there's a user_message, display it with two preceeding line breaks @@ -23,7 +23,7 @@ install() { } uninstall() { - dialog --no-collapse --title "$title" --yesno "\nUninstall $1\n\nProceed?" 10 40 + dialog --no-collapse --title "$title" --yesno "\nUninstall $($package_dir/$1.sh -N)\n\nProceed?" 10 40 if [ $? -eq 1 ]; then #if cancel/no return 1 fi @@ -31,7 +31,7 @@ uninstall() { output=$(eval "$package_dir/$1.sh -u 2>&1 | tee /dev/tty") install_status=$? # Capture the exit status of the eval command user_message=$(echo "$output" | awk '/user_message: / {found=1; split($0, arr, "user_message: "); print arr[2]; next} found {print}' | sed '/^$/q') # grab the user_message, if present - #output=$(echo "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output + output=$(echo "$output" | sed '/user_message: /,$d') # remove the user message from the detailed output if [ $install_status -eq 0 ]; then # if the installation was successful dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuUninstallation of $($package_dir/$1.sh -N) successful!\Zn$([ -n "$user_message" ] && echo "\n\n$user_message")\n\nLog:\n$(echo -e "$output")" 0 0 # if there's a user_message, display it with two preceeding line breaks else @@ -40,7 +40,7 @@ uninstall() { } upgrade() { - dialog --no-collapse --title "$title" --yesno "\nUpgrade $1\n\nProceed?" 10 40 + dialog --no-collapse --title "$title" --yesno "\nUpgrade $($package_dir/$1.sh -N)\n\nProceed?" 10 40 if [ $? -eq 1 ]; then #if cancel/no return 1 fi @@ -67,7 +67,7 @@ package_intro() { $(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\ $(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\ \n\ -$(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo " \Zunot installed\Zn")\n\ +$(echo "Currently: " && $package_dir/$1.sh -I && echo "\Zuinstalled\Zn" || echo "\Zunot installed\Zn")\n\ $(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\ An internet connection is required for installation.\n\ @@ -105,11 +105,11 @@ package_menu() { "Install") install $1 ;; "Uninstall") uninstall $1 ;; "Upgrade") upgrade $1 ;; - "Enable service") eval "$package_dir/$1.sh -e" ;; - "Disable service") eval "$package_dir/$1.sh -d" ;; - "Stop service") eval "$package_dir/$1.sh -s" ;; - "Start/restart service") eval "$package_dir/$1.sh -r" ;; - "Get service status") dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; + "Enable service") echo "Enabling service..." && eval "$package_dir/$1.sh -e" ;; + "Disable service") echo "Disabling service..." && eval "$package_dir/$1.sh -d" ;; + "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; + "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; + "Get service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; "Back to software manager") break ;; esac done diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh index 082f891..00a3bc9 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/contact_client.sh @@ -85,7 +85,9 @@ $launch" | sudo tee /usr/local/bin/contact > /dev/null # uninstall script uninstall() { rm -rf $location + echo "Removed \`$location\`." rm /usr/local/bin/contact + echo "Removed \`contact\` shortcut." echo "user_message: All files removed." exit 0 # should be `exit 1` if the installation failed } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh index 74e9244..f9f906c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/tc2_bbs.sh @@ -93,7 +93,9 @@ uninstall() { systemctl stop $service_name rm /etc/systemd/system/$service_name.service systemctl daemon-reload + echo "Disabled and removed \`$service_name\` service." rm -rf $location + echo "Removed \`$location\`." echo "user_message: Service removed, all files deleted." exit 0 } From 90a58d9f8de94c9e2c1f3197ff56e362a0952717 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 29 Jan 2025 19:08:02 +0200 Subject: [PATCH 06/13] Add a bit of extra echo to runonce --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index be7cbe1..f38e0e7 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -47,6 +47,7 @@ done sudo resize2fs /dev/mmcblk1p5 sudo resize2fs /dev/mmcblk1p6 sudo resize2fs /dev/mmcblk1p7 + log_message "Resizing filesystem complete" # allocate swap file if [ ! -f /swapfile ]; then # check if swap file already exists From e2d6cb8ac7b317cb79271472c620c81906da8584 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 29 Jan 2025 20:01:02 +0200 Subject: [PATCH 07/13] This time it's GOTTA be the last one, right? ...right? --- .../usr/local/bin/femto-software.sh | 4 ++-- .../local/bin/packages/mosquitto_mqtt_broker.sh | 9 +++++---- .../local/bin/packages/mosquitto_mqtt_client.sh | 3 ++- .../usr/local/bin/packages/package_template.sh | 3 ++- .../usr/local/bin/packages/samba.sh | 17 ++++++++++------- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index bd96cdc..7d2f008 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -105,8 +105,8 @@ package_menu() { "Install") install $1 ;; "Uninstall") uninstall $1 ;; "Upgrade") upgrade $1 ;; - "Enable service") echo "Enabling service..." && eval "$package_dir/$1.sh -e" ;; - "Disable service") echo "Disabling service..." && eval "$package_dir/$1.sh -d" ;; + "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; + "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; "Get service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh index a58edf1..89b4600 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh @@ -56,6 +56,7 @@ URL="https://mosquitto.org/" # software URL. Can contain multiple URLs - OPTIO options="xiugedsrNADUOSCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="mosquitto" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" +package_name="mosquitto" # apt package name, if applicable location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" @@ -63,7 +64,7 @@ conflicts="" # comma delineated plain-text list of packages with which this pa install() { echo "apt update can take a long while..." DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt-get install mosquitto -y 2>&1 | tee /dev/tty # allows output to be shown onscreen + DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty # allows output to be shown onscreen echo "user_message: Installation requires more setup. For a guide, see https://docs.vultr.com/how-to-install-mosquitto-mqtt-broker-on-ubuntu-24-04" exit 0 # should be `exit 1` if operation failed } @@ -71,7 +72,7 @@ install() { # uninstall script uninstall() { - DEBIAN_FRONTEND=noninteractive apt remove -y mosquitto 2>&1 | tee /dev/tty + DEBIAN_FRONTEND=noninteractive apt remove -y $package_name 2>&1 | tee /dev/tty /usr/local/bin/mosquitto_mqtt_broker.sh -s # stop service /usr/local/bin/mosquitto_mqtt_broker.sh -d # disable service echo "user_message: Some files may remain on system. To remove, run \`sudo apt remove --purge mosquitto -y\` and \`sudo apt autoremove -y\`." @@ -83,13 +84,13 @@ uninstall() { upgrade() { echo "apt update can take a long while..." DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt upgrade -y mosquitto 2>&1 | tee /dev/tty + DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty exit 0 # should be `exit 1` if operation failed } # Check if already installed. `exit 0` if yes, `exit 1` if no check() { -if dpkg -l | grep -q mosquitto; then +if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then exit 0 else exit 1 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh index 23b77c0..f51b883 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh @@ -57,6 +57,7 @@ options="xiugedsrNADUOSCI" # script options in use by software package. For ex launch="" # command to launch software, if applicable service_name="" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` +package_name="mosquitto-clients" # apt package name, if applicable conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script @@ -87,7 +88,7 @@ upgrade() { # Check if already installed. `exit 0` if yes, `exit 1` if no check() { -if dpkg -l | grep -q mosquitto-clients; then +if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then exit 0 else exit 1 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh index 8af9bc6..debf87c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh @@ -56,6 +56,7 @@ URL="URL" # software URL. Can contain multiple URLs - OPTIONAL options="xiugedsrlNADUOSLCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="service_name" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" +package_name="apt_package" # apt package name, if applicable. Can be multiple packages separated by spaces, but if at least one is installed the package will show as "installed" even if the others aren't location="/opt/location" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` conflicts="package name, other package name" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" @@ -91,7 +92,7 @@ check() { fi # this works for apt packages - if [ dpkg -l | grep -q package-name ] ; then + if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then exit 0 else exit 1 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index dbd2353..60eb4cd 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -51,28 +51,31 @@ EOF name="Samba File Sharing" # software name author="Software Freedom Conservancy" # software author - OPTIONAL -description="Samba is a free software re-implementation of the SMB networking protocol, and was originally developed by Andrew Tridgell. Samba provides file and print services for various Microsoft Windows clients[5] and can integrate with a Microsoft Windows Server domain, either as a Domain Controller (DC) or as a domain member. As of version 4, it supports Active Directory and Microsoft Windows NT domains." # software description - OPTIONAL (but strongly recommended!) +description="Femtofox comes with Samba preinstalled but disabled. To enable file sharing, run \`sudo smbpasswd femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nSamba is an open-source implementation of the SMB/CIFS protocol that enables file and printer sharing between Linux/Unix and Windows systems. It allows Linux machines to act as file servers, domain controllers, or Active Directory members, making them accessible from Windows and other SMB-compatible clients." # software description - OPTIONAL (but strongly recommended!) URL="https://www.samba.org/" # software URL. Can contain multiple URLs - OPTIONAL options="xiugedsrNADUOSCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="smbd nmbd" # the name of the service/s, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` +package_name="samba" # apt package name, if applicable conflicts="" # comma delineated plain-text list of packages with which this package conflicts. Blank if none. Use the name as it appears in the $name field of the other package. Extra plaintext is allowed, such as "packageA, packageB, any other software that uses the Meshtastic CLI" # install script install() { echo "apt update can take a long while..." DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt-get install samba -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - echo "user_message: System comes with a configuration file to share /home/femto. See \`/etc/samba/smb.conf\`." + DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty # allows output to be shown onscreen + echo -e "user_message: IMPORTANT: To complete installation, run \`sudo smbpasswd femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares." exit 0 # should be `exit 1` if operation failed } # uninstall script uninstall() { - DEBIAN_FRONTEND=noninteractive apt remove -y samba 2>&1 | tee /dev/tty - echo "user_message: Some files may remain on system. To remove, run \`sudo apt remove --purge samba -y\` and \`sudo apt autoremove -y\`." + DEBIAN_FRONTEND=noninteractive apt remove -y $package_name 2>&1 | tee /dev/tty + echo "Removing unused dependencies..." + DEBIAN_FRONTEND=noninteractive apt autoremove -y $package_name 2>&1 | tee /dev/tty + echo "user_message: Some files may remain on system. To remove, run \`sudo apt remove --purge $package_name -y\` and \`sudo apt autoremove -y\`." exit 0 # should be `exit 1` if operation failed } @@ -81,13 +84,13 @@ uninstall() { upgrade() { echo "apt update can take a long while..." DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt upgrade -y samba 2>&1 | tee /dev/tty + DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty exit 0 # should be `exit 1` if operation failed } # Check if already installed. `exit 0` if yes, `exit 1` if no check() { -if dpkg -l | grep -q samba; then +if dpkg-query -W -f='${Status}' $package_name 2>/dev/null | grep -q "install ok installed"; then exit 0 else exit 1 From cfe2e19e408a9f67e3dfaba9e28e3256062bb275 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 29 Jan 2025 20:38:16 +0200 Subject: [PATCH 08/13] Fix activation command helptext --- .../out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index 60eb4cd..ec40932 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -51,7 +51,7 @@ EOF name="Samba File Sharing" # software name author="Software Freedom Conservancy" # software author - OPTIONAL -description="Femtofox comes with Samba preinstalled but disabled. To enable file sharing, run \`sudo smbpasswd femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nSamba is an open-source implementation of the SMB/CIFS protocol that enables file and printer sharing between Linux/Unix and Windows systems. It allows Linux machines to act as file servers, domain controllers, or Active Directory members, making them accessible from Windows and other SMB-compatible clients." # software description - OPTIONAL (but strongly recommended!) +description="Femtofox comes with Samba preinstalled but disabled. To enable file sharing, run \`sudo smbpasswd -a femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nSamba is an open-source implementation of the SMB/CIFS protocol that enables file and printer sharing between Linux/Unix and Windows systems. It allows Linux machines to act as file servers, domain controllers, or Active Directory members, making them accessible from Windows and other SMB-compatible clients." # software description - OPTIONAL (but strongly recommended!) URL="https://www.samba.org/" # software URL. Can contain multiple URLs - OPTIONAL options="xiugedsrNADUOSCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable @@ -65,7 +65,7 @@ install() { echo "apt update can take a long while..." DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - echo -e "user_message: IMPORTANT: To complete installation, run \`sudo smbpasswd femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares." + echo -e "user_message: IMPORTANT: To complete installation, run \`sudo smbpasswd -a femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares." exit 0 # should be `exit 1` if operation failed } From 464551d0bb3cb4c8d33903ece4d801e2f8966b73 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 29 Jan 2025 22:17:32 +0200 Subject: [PATCH 09/13] Switch smb.conf to git source --- environment-setup/femtofox.chroot | 3 - .../rootfs_uclibc_rv1106/etc/samba/smb.conf | 253 ++++++++++++++++++ 2 files changed, 253 insertions(+), 3 deletions(-) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/samba/smb.conf diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 1d86242..dde7ebd 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -37,9 +37,6 @@ echo "Installing dependencies for meshing-around and meshtastic cli..." pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi -echo "Adding Samba configuration..." # add it manually so we're always using the most up to date smb.conf file template from the package -echo "\n[home]\npath = /home/femto\nbrowsable = yes\nwritable = yes\nread only = no\ncreate mask = 0775\ndirectory mask = 0775\nvalid users = femto" | sudo tee -a /etc/samba/smb.conf > /dev/null && sudo systemctl restart smbd - echo "Setting MOTD..." mv /etc/update-motd.d/10-help-text /etc/update-motd.d/10-help-text.bak mv /etc/update-motd.d/60-unminimize /etc/update-motd.d/60-unminimize.bak diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/samba/smb.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/samba/smb.conf new file mode 100644 index 0000000..4fa791a --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/samba/smb.conf @@ -0,0 +1,253 @@ +# +# Sample configuration file for the Samba suite for Debian GNU/Linux. +# +# +# This is the main Samba configuration file. You should read the +# smb.conf(5) manual page in order to understand the options listed +# here. Samba has a huge number of configurable options most of which +# are not shown in this example +# +# Some options that are often worth tuning have been included as +# commented-out examples in this file. +# - When such options are commented with ";", the proposed setting +# differs from the default Samba behaviour +# - When commented with "#", the proposed setting is the default +# behaviour of Samba but the option is considered important +# enough to be mentioned here +# +# NOTE: Whenever you modify this file you should run the command +# "testparm" to check that you have not made any basic syntactic +# errors. + +#======================= Global Settings ======================= + +[global] + +## Browsing/Identification ### + +# Change this to the workgroup/NT-domain name your Samba server will part of + workgroup = WORKGROUP + +# server string is the equivalent of the NT Description field + server string = %h server (Samba, Ubuntu) + +#### Networking #### + +# The specific set of interfaces / networks to bind to +# This can be either the interface name or an IP address/netmask; +# interface names are normally preferred +; interfaces = 127.0.0.0/8 eth0 + +# Only bind to the named interfaces and/or networks; you must use the +# 'interfaces' option above to use this. +# It is recommended that you enable this feature if your Samba machine is +# not protected by a firewall or is a firewall itself. However, this +# option cannot handle dynamic or non-broadcast interfaces correctly. +; bind interfaces only = yes + + + +#### Debugging/Accounting #### + +# This tells Samba to use a separate log file for each machine +# that connects + log file = /var/log/samba/log.%m + +# Cap the size of the individual log files (in KiB). + max log size = 1000 + +# We want Samba to only log to /var/log/samba/log.{smbd,nmbd}. +# Append syslog@1 if you want important messages to be sent to syslog too. + logging = file + +# For more verbose logging: +; log level = 3 + +# Do something sensible when Samba crashes: mail the admin a backtrace + panic action = /usr/share/samba/panic-action %d + + +####### Authentication ####### + +# Server role. Defines in which mode Samba will operate. Possible +# values are "standalone server", "member server", "classic primary +# domain controller", "classic backup domain controller", "active +# directory domain controller". +# +# Most people will want "standalone server" or "member server". +# Running as "active directory domain controller" will require first +# running "samba-tool domain provision" to wipe databases and create a +# new domain. + server role = standalone server + + obey pam restrictions = yes + +# This boolean parameter controls whether Samba attempts to sync the Unix +# password with the SMB password when the encrypted SMB password in the +# passdb is changed. + unix password sync = yes + +# For Unix password sync to work on a Debian GNU/Linux system, the following +# parameters must be set (thanks to Ian Kahan < for +# sending the correct chat script for the passwd program in Debian Sarge). + passwd program = /usr/bin/passwd %u + passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . + +# This boolean controls whether PAM will be used for password changes +# when requested by an SMB client instead of the program listed in +# 'passwd program'. The default is 'no'. + pam password change = yes + +# This option controls how unsuccessful authentication attempts are mapped +# to anonymous connections + map to guest = bad user + +########## Domains ########### + +# +# The following settings only takes effect if 'server role = classic +# primary domain controller', 'server role = classic backup domain controller' +# or 'domain logons' is set +# + +# It specifies the location of the user's +# profile directory from the client point of view) The following +# required a [profiles] share to be setup on the samba server (see +# below) +; logon path = \\%N\profiles\%U +# Another common choice is storing the profile in the user's home directory +# (this is Samba's default) +# logon path = \\%N\%U\profile + +# The following setting only takes effect if 'domain logons' is set +# It specifies the location of a user's home directory (from the client +# point of view) +; logon drive = H: +# logon home = \\%N\%U + +# The following setting only takes effect if 'domain logons' is set +# It specifies the script to run during logon. The script must be stored +# in the [netlogon] share +# NOTE: Must be store in 'DOS' file format convention +; logon script = logon.cmd + +# This allows Unix users to be created on the domain controller via the SAMR +# RPC pipe. The example command creates a user account with a disabled Unix +# password; please adapt to your needs +; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u + +# This allows machine accounts to be created on the domain controller via the +# SAMR RPC pipe. +# The following assumes a "machines" group exists on the system +; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u + +# This allows Unix groups to be created on the domain controller via the SAMR +# RPC pipe. +; add group script = /usr/sbin/addgroup --force-badname %g + +############ Misc ############ + +# Using the following line enables you to customise your configuration +# on a per machine basis. The %m gets replaced with the netbios name +# of the machine that is connecting +; include = /home/samba/etc/smb.conf.%m + +# Some defaults for winbind (make sure you're not using the ranges +# for something else.) +; idmap config * : backend = tdb +; idmap config * : range = 3000-7999 +; idmap config YOURDOMAINHERE : backend = tdb +; idmap config YOURDOMAINHERE : range = 100000-999999 +; template shell = /bin/bash + +# Setup usershare options to enable non-root users to share folders +# with the net usershare command. + +# Maximum number of usershare. 0 means that usershare is disabled. +# usershare max shares = 100 + +# Allow users who've been granted usershare privileges to create +# public shares, not just authenticated ones + usershare allow guests = yes + +#======================= Share Definitions ======================= + +# Un-comment the following (and tweak the other settings below to suit) +# to enable the default home directory shares. This will share each +# user's home directory as \\server\username +;[homes] +; comment = Home Directories +; browseable = no + +# By default, the home directories are exported read-only. Change the +# next parameter to 'no' if you want to be able to write to them. +; read only = yes + +# File creation mask is set to 0700 for security reasons. If you want to +# create files with group=rw permissions, set next parameter to 0775. +; create mask = 0700 + +# Directory creation mask is set to 0700 for security reasons. If you want to +# create dirs. with group=rw permissions, set next parameter to 0775. +; directory mask = 0700 + +# By default, \\server\username shares can be connected to by anyone +# with access to the samba server. +# Un-comment the following parameter to make sure that only "username" +# can connect to \\server\username +# This might need tweaking when using external authentication schemes +; valid users = %S + +# Un-comment the following and create the netlogon directory for Domain Logons +# (you need to configure Samba to act as a domain controller too.) +;[netlogon] +; comment = Network Logon Service +; path = /home/samba/netlogon +; guest ok = yes +; read only = yes + +# Un-comment the following and create the profiles directory to store +# users profiles (see the "logon path" option above) +# (you need to configure Samba to act as a domain controller too.) +# The path below should be writable by all users so that their +# profile directory may be created the first time they log on +;[profiles] +; comment = Users profiles +; path = /home/samba/profiles +; guest ok = no +; browseable = no +; create mask = 0600 +; directory mask = 0700 + +[printers] + comment = All Printers + browseable = no + path = /var/spool/samba + printable = yes + guest ok = no + read only = yes + create mask = 0700 + +# Windows clients look for this share name as a source of downloadable +# printer drivers +[print$] + comment = Printer Drivers + path = /var/lib/samba/printers + browseable = yes + read only = yes + guest ok = no +# Uncomment to allow remote administration of Windows print drivers. +# You may need to replace 'lpadmin' with the name of the group your +# admin users are members of. +# Please note that you also need to set appropriate Unix permissions +# to the drivers directory for these users to have write rights in it +; write list = root, @lpadmin + +[home] +path = /home/femto +browseable = yes +writable = yes +read only = no +create mask = 0775 +directory mask = 0775 +valid users = femto \ No newline at end of file From 8c5b94da52e17e51bec0dfde420bf25993b1f05e Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 30 Jan 2025 00:09:42 +0200 Subject: [PATCH 10/13] Complete samba support. Pretty please? --- .../usr/local/bin/femto-runonce.sh | 17 +++++++++-------- .../local/bin/packages/mosquitto_mqtt_broker.sh | 8 ++++---- .../local/bin/packages/mosquitto_mqtt_client.sh | 8 ++++---- .../usr/local/bin/packages/package_template.sh | 3 ++- .../usr/local/bin/packages/samba.sh | 12 ++++++------ 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index f38e0e7..db38faa 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -44,21 +44,22 @@ done # Perform filesystem resize log_message "Resizing filesystem. This can take up to 10 minutes, depending on microSD card size and speed" - sudo resize2fs /dev/mmcblk1p5 - sudo resize2fs /dev/mmcblk1p6 - sudo resize2fs /dev/mmcblk1p7 + resize2fs /dev/mmcblk1p5 + resize2fs /dev/mmcblk1p6 + resize2fs /dev/mmcblk1p7 log_message "Resizing filesystem complete" # allocate swap file if [ ! -f /swapfile ]; then # check if swap file already exists - sudo fallocate -l 1G /swapfile - sudo chmod 600 /swapfile - sudo mkswap /swapfile > /dev/null - sudo swapon /swapfile > /dev/null + log_message "Allocating swap file" + fallocate -l 1G /swapfile + chmod 600 /swapfile + mkswap /swapfile > /dev/null + swapon /swapfile > /dev/null echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null log_message "Swap file allocated." else - log_message "Swap file already allocated, skipping." + log_message "Swap file already allocated, skipping" fi # add RTC support - looks unneeded? diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh index 89b4600..a901fc7 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_broker.sh @@ -63,8 +63,8 @@ conflicts="" # comma delineated plain-text list of packages with which this pa # install script install() { echo "apt update can take a long while..." - DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty # allows output to be shown onscreen + DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } + DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; } echo "user_message: Installation requires more setup. For a guide, see https://docs.vultr.com/how-to-install-mosquitto-mqtt-broker-on-ubuntu-24-04" exit 0 # should be `exit 1` if operation failed } @@ -83,8 +83,8 @@ uninstall() { #upgrade script upgrade() { echo "apt update can take a long while..." - DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty + DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } + DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt upgrade failed. Is internet connected?"; exit 1; } exit 0 # should be `exit 1` if operation failed } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh index f51b883..46fbed4 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/mosquitto_mqtt_client.sh @@ -63,8 +63,8 @@ conflicts="" # comma delineated plain-text list of packages with which this pa # install script install() { echo "apt update can take a long while..." - DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt-get install mosquitto-clients -y 2>&1 | tee /dev/tty # allows output to be shown onscreen + DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } + DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; } echo "user_message: Installation requires more setup. For a guide, see https://docs.vultr.com/how-to-install-mosquitto-mqtt-broker-on-ubuntu-24-04" exit 0 # should be `exit 1` if operation failed } @@ -81,8 +81,8 @@ uninstall() { #upgrade script upgrade() { echo "apt update can take a long while..." - DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt upgrade -y mosquitto-clients 2>&1 | tee /dev/tty + DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } + DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt upgrade failed. Is internet connected?"; exit 1; } exit 0 # should be `exit 1` if operation failed } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh index debf87c..6ef49bd 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh @@ -63,7 +63,8 @@ conflicts="package name, other package name" # comma delineated plain-text lis # install script install() { # for apt packages, this method allows onscreen output during install: - # DEBIAN_FRONTEND=noninteractive sudo apt-get install mosquitto -y 2>&1 | tee /dev/tty # allows output to be shown onscreen + # DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty || { echo "user_message: apt update failed. Is internet connected?"; exit 1; } + # DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty || { echo "user_message: apt install failed. Is internet connected?"; exit 1; } echo "user_message: Exit message to user, displayed prominently in post-install" exit 0 # should be `exit 1` if operation failed } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index ec40932..1addff3 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -51,7 +51,7 @@ EOF name="Samba File Sharing" # software name author="Software Freedom Conservancy" # software author - OPTIONAL -description="Femtofox comes with Samba preinstalled but disabled. To enable file sharing, run \`sudo smbpasswd -a femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nSamba is an open-source implementation of the SMB/CIFS protocol that enables file and printer sharing between Linux/Unix and Windows systems. It allows Linux machines to act as file servers, domain controllers, or Active Directory members, making them accessible from Windows and other SMB-compatible clients." # software description - OPTIONAL (but strongly recommended!) +description="Femtofox comes with Samba preinstalled but disabled. To enable file sharing, run \`sudo smbpasswd -a femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nSamba is an open-source implementation of the SMB/CIFS protocol that enables file and printer sharing between Linux/Unix and Windows systems. It allows Linux machines to act as file servers, domain controllers, or Active Directory members, making them accessible from Windows and other SMB-compatible clients.\n\nTroubleshooting: if Windows refuses to connect, especially after succeeding previously, hit [win]+R and enter \`net use * /delete\`." # software description - OPTIONAL (but strongly recommended!) URL="https://www.samba.org/" # software URL. Can contain multiple URLs - OPTIONAL options="xiugedsrNADUOSCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable @@ -63,9 +63,9 @@ conflicts="" # comma delineated plain-text list of packages with which this pa # install script install() { echo "apt update can take a long while..." - DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - echo -e "user_message: IMPORTANT: To complete installation, run \`sudo smbpasswd -a femto\` to set a Samba password, and enable the Samba service.\nTo connect to network share, enter \`\\\\\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares." + DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } + DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; } + echo -e "user_message: IMPORTANT: To complete installation, enable the Samba service, run \`sudo smbpasswd -a femto\` to set a Samba password, and restart the Samba service.\nTo connect to network share, enter \`\\\\\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nTroubleshooting: if Windows refuses to connect, especially after succeeding previously, hit [win]+R and enter \`net use * /delete\`." exit 0 # should be `exit 1` if operation failed } @@ -83,8 +83,8 @@ uninstall() { #upgrade script upgrade() { echo "apt update can take a long while..." - DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty # allows output to be shown onscreen - DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty + DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } + DEBIAN_FRONTEND=noninteractive apt upgrade -y $package_name 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt upgrade failed. Is internet connected?"; exit 1; } exit 0 # should be `exit 1` if operation failed } From 03dddff7164428f049287d703faac88c3941ae7c Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 30 Jan 2025 11:29:07 +0200 Subject: [PATCH 11/13] Updated run once messages --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index db38faa..04367ea 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -43,7 +43,7 @@ done ) & # Perform filesystem resize - log_message "Resizing filesystem. This can take up to 10 minutes, depending on microSD card size and speed" + log_message "Resizing filesystem. This can take several minutes, depending on microSD card size and speed" resize2fs /dev/mmcblk1p5 resize2fs /dev/mmcblk1p6 resize2fs /dev/mmcblk1p7 @@ -51,7 +51,7 @@ done # allocate swap file if [ ! -f /swapfile ]; then # check if swap file already exists - log_message "Allocating swap file" + log_message "Allocating swap file. This can take up to 10 minutes, depending on microSD card speed" fallocate -l 1G /swapfile chmod 600 /swapfile mkswap /swapfile > /dev/null From 8521180d783effc3f68158557eb6d56a1c72c66c Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 30 Jan 2025 13:51:18 +0200 Subject: [PATCH 12/13] allow samba (and meshing around) initialization from menu --- .../usr/local/bin/femto-software.sh | 20 +++++++++-- .../usr/local/bin/packages/meshing_around.sh | 17 +++++++--- .../local/bin/packages/package_template.sh | 14 +++++--- .../usr/local/bin/packages/samba.sh | 34 ++++++++++++++----- 4 files changed, 66 insertions(+), 19 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 7d2f008..425229d 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -39,6 +39,21 @@ uninstall() { fi } +initialize() { + dialog --no-collapse --title "$title" --yesno "\nIntialize $($package_dir/$1.sh -N)\n\nInitialization runs commands that frequently require user interaction and so can only be run from terminal.\n\nProceed?" 13 50 + if [ $? -eq 1 ]; then #if cancel/no + return 1 + fi + clear + echo "Initializing $($package_dir/$1.sh -N)..." + eval "$package_dir/$1.sh -a" + if [ $? -eq 0 ]; then # if the installation was successful + dialog --no-collapse --colors --title "$title" --beep --msgbox "\nInitialization of $($package_dir/$1.sh -N) successful!" 8 50 # if there's a user_message, display it with two preceeding line breaks + else + dialog --no-collapse --colors --title "$title" --beep --msgbox "\nInitialization of $($package_dir/$1.sh -N) FAILED!" 8 50 # if there's a user_message, display it with two preceeding line breaks + fi +} + upgrade() { dialog --no-collapse --title "$title" --yesno "\nUpgrade $($package_dir/$1.sh -N)\n\nProceed?" 10 40 if [ $? -eq 1 ]; then #if cancel/no @@ -54,7 +69,6 @@ upgrade() { else dialog --no-collapse --colors --title "$title" --beep --msgbox "\n\ZuUpgrade of $($package_dir/$1.sh -N) FAILED!\Zn\n\n$user_message\n\nLog:\n$output" 0 0 # if there's a user_message, display it with two preceeding line breaks fi - } @@ -80,10 +94,11 @@ package_menu() { while true; do echo "Loading package menu..." # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) - choice=$(dialog --no-collapse --title "$title" --cancel-label "Back" --default-item "$choice" --menu "$($package_dir/$1.sh -N)" 17 45 5 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "Back" --default-item "$choice" --menu "$($package_dir/$1.sh -N)" 18 45 5 \ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'u' && $package_dir/$1.sh -I; then echo "Uninstall x"; fi) \ + $(if $package_dir/$1.sh -O | grep -q 'a' && $package_dir/$1.sh -I; then echo "Initialize x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'g' && $package_dir/$1.sh -I; then echo "Upgrade x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Enable service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'd' && $package_dir/$1.sh -I; then echo "Disable service x"; fi) \ @@ -104,6 +119,7 @@ package_menu() { "Run software") eval "$package_dir/$1.sh -l" ;; "Install") install $1 ;; "Uninstall") uninstall $1 ;; + "Initialize") initialize $1 ;; "Upgrade") upgrade $1 ;; "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh index 9d86eac..bf45a13 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/meshing_around.sh @@ -19,6 +19,7 @@ Arguments: Actions: -i Install -u Uninstall +-a Interactive initialization script: code that must be run to initialize the installation prior to use, but can only be run from terminal -g Upgrade -e Enable service, if applicable -d Disable service, if applicable @@ -52,7 +53,7 @@ name="Meshing Around" # software name author="Spud" # software author - OPTIONAL description="Meshing Around is a feature-rich bot designed to enhance your Meshtastic network experience with a variety of powerful tools and fun features. Connectivity and utility through text-based message delivery. Whether you're looking to perform network tests, send messages, or even play games, mesh_bot.py has you covered." # software description - OPTIONAL (but strongly recommended!) URL="https://github.com/SpudGunMan/meshing-around" # software URL. Can contain multiple URLs - OPTIONAL -options="xiugedsrNADUOSLCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` +options="xiuagedsrNADUOSLCI" # script options in use by software package. For example, for a package with no service, exclude `edsr` launch="" # command to launch software, if applicable service_name="mesh_bot pong_bot mesh_bot_reporting" # the name of the service, such as `chrony`. REQUIRED if service options are in use. If multiple services, separate by spaces "service1 service2" location="/opt/meshing-around" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name` @@ -65,16 +66,13 @@ install() { exit 1 fi if [ "$interactive" = "true" ]; then #interactive install - "$location/install.sh" | tee /dev/tty - echo "user_message: To change settings, run \`sudo nano $location/config.ini\`" - exit 0 + interactive_init else echo "user_message: IMPORTANT: To complete installation, run \`sudo $location/install.sh\`\nTo change settings, run \`sudo nano $location/config.ini\`" exit 0 fi } - # uninstall script uninstall() { # stop, disable and remove the service, reload systemctl daemon, remove the installation directory and quit @@ -96,6 +94,12 @@ uninstall() { exit 0 } +# code that must be run to initialize the installation prior to use, but can only be run from terminal +interactive_init() { + "$location/install.sh" | tee /dev/tty + echo "user_message: To change settings, run \`sudo nano $location/config.ini\`" + exit 0 +} #upgrade script upgrade() { @@ -129,6 +133,9 @@ while getopts ":h$options" opt; do i) # Option -i (install) install ;; + a) # Option -a (interactive initialization) + interactive_init + ;; u) # Option -u (uninstall) uninstall ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh index 6ef49bd..30fe0e3 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/package_template.sh @@ -10,7 +10,7 @@ if [ $# -eq 0 ]; then fi args="$@" # arguments to this script -interaction="true" +interactive="true" help=$(cat <&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } - DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; } - echo -e "user_message: IMPORTANT: To complete installation, enable the Samba service, run \`sudo smbpasswd -a femto\` to set a Samba password, and restart the Samba service.\nTo connect to network share, enter \`\\\\\\\\femtofox\` from Windows, \`smb://$(hostname)\` from MacOS and \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nTroubleshooting: if Windows refuses to connect, especially after succeeding previously, hit [win]+R and enter \`net use * /delete\`." - exit 0 # should be `exit 1` if operation failed + # DEBIAN_FRONTEND=noninteractive apt-get update -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt update failed. Is internet connected?"; exit 1; } + # DEBIAN_FRONTEND=noninteractive apt-get install $package_name -y 2>&1 | tee /dev/tty | grep -q "Err" && { echo "user_message: apt install failed. Is internet connected?"; exit 1; } + if [ "$interactive" = "true" ]; then # interactive install + interactive_init + else # noninteractive installation (such as web-UI) + echo -e "user_message: IMPORTANT: $init_instructions\n\n$user_message" + exit 0 # should be `exit 1` if operation failed + fi } - # uninstall script uninstall() { DEBIAN_FRONTEND=noninteractive apt remove -y $package_name 2>&1 | tee /dev/tty @@ -79,6 +85,15 @@ uninstall() { exit 0 # should be `exit 1` if operation failed } +# code that must be run to initialize the installation prior to use, but can only be run from terminal +interactive_init() { + $(basename "$0" -e) + echo -e "\nSet user \`Femto\` login password:" + smbpasswd -a femto + $(basename "$0" -r) + echo -e "user_message: Samba initialized, and service enabled and started. $user_message" + exit 0 +} #upgrade script upgrade() { @@ -108,6 +123,9 @@ while getopts ":h$options" opt; do i) # Option -i (install) install ;; + a) # Option -a (interactive initialization) + interactive_init + ;; u) # Option -u (uninstall) uninstall ;; From 7bac1c22d68dd977dfc718440110cc81ec5b9756 Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 30 Jan 2025 14:17:43 +0200 Subject: [PATCH 13/13] Complete samba? --- .../rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 2 +- .../rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 425229d..4ca5354 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -40,7 +40,7 @@ uninstall() { } initialize() { - dialog --no-collapse --title "$title" --yesno "\nIntialize $($package_dir/$1.sh -N)\n\nInitialization runs commands that frequently require user interaction and so can only be run from terminal.\n\nProceed?" 13 50 + dialog --no-collapse --title "$title" --yesno "\nIntialize $($package_dir/$1.sh -N)\n\nInitialization runs commands that require user interaction and so can only be run from terminal.\n\nProceed?" 13 50 if [ $? -eq 1 ]; then #if cancel/no return 1 fi diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh index a22fc03..d085851 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/packages/samba.sh @@ -49,7 +49,7 @@ EOF # Messages to the user (such as configuration instructions, explanatory error messages, etc) should be given as: `echo "user_message: text"` # Everything following `user_message: ` will be displayed prominently to the user, so it must the last thing echoed -user_message="To connect to network share, enter \`\\\\\\\\femtofox\\home\` from Windows, \`smb://$(hostname)\\home\` from MacOS or \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nTroubleshooting: if Windows refuses to connect, especially after succeeding previously, hit [win]+R and enter \`net use * /delete\`." +user_message="To connect to network share, enter \`\\\\femtofox\\home\` from Windows, \`smb://$(hostname)\\home\` from MacOS or \`smbclient //$(hostname)/femto -U femto\` from Linux.\nDefault configuration shares /home/femto. Edit \`/etc/samba/smb.conf\` to add other shares.\n\nTroubleshooting: if Windows refuses to connect, especially after succeeding previously, hit [win]+R and enter \`net use * /delete\`." init_instructions="To enable file sharing, run \`Initialize\` in the femto-config Samba menu, or enable the Samba service, run \`sudo smbpasswd -a femto\` to set a Samba password, and then restart the Samba service." name="Samba File Sharing" # software name @@ -87,10 +87,10 @@ uninstall() { # code that must be run to initialize the installation prior to use, but can only be run from terminal interactive_init() { - $(basename "$0" -e) echo -e "\nSet user \`Femto\` login password:" smbpasswd -a femto - $(basename "$0" -r) + /usr/local/bin/packages/samba.sh -e + /usr/local/bin/packages/samba.sh -r echo -e "user_message: Samba initialized, and service enabled and started. $user_message" exit 0 }