Merge pull request #385 from femtofox/main

Update noon2 from main
This commit is contained in:
noon92 2025-03-08 18:30:46 +02:00 • committed by GitHub
commit b7bc76a9ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 274 additions and 143 deletions

View file

@ -48,6 +48,12 @@ wget -qO- https://api.github.com/repos/tsl0922/ttyd/releases/latest | grep "brow
chmod +x /opt/ttyd/ttyd
systemctl enable ttyd
echo "Cloning Control for Meshtastic by pdxlocations"
git clone https://github.com/pdxlocations/control.git /opt/control
pip install -r /opt/control/requirements.txt
chown -R femto /opt/control
git config --global --add safe.directory /opt/control # prevents git error when updating
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

View file

@ -421,23 +421,92 @@ legacy_admin() {
done
}
meshtastic_config_url() {
newurl=$(dialog --no-collapse --colors --title "Meshtastic URL" --inputbox "The Meshtastic configuration URL allows for automatic configuration of all Meshtastic LoRa settings and channels.\n\nEntering a URL may \Z1\ZuOVERWRITE\Zn your LoRa settings and channels!\n\nNew Meshtastic LoRa configuration URL (SHIFT+INS to paste):" 14 63 3>&1 1>&2 2>&3)
if [ -n "$newurl" ]; then #if a URL was entered
femto-meshtasticd-config.sh -q "$newurl"
fi
}
set_lora_radio() {
choice="" # zero the choice before loading the submenu
while true; do
echo "Checking LoRa radio..."
#Display filename, if exists: $(files=$(ls /etc/meshtasticd/config.d/* 2>/dev/null) && [ -n "$files" ] && echo "\n\nConfiguration files in use:\n$files" | paste -sd, -))
choice=$(dialog --no-collapse --colors --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "$choice" --title "Meshtastic LoRa radio" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")$(ls -1 /etc/meshtasticd/config.d 2>/dev/null | grep -v '^femto_' | paste -sd ', ' - | sed 's/^/ (/; s/$/)/; s/,/, /g' | grep -v '^ ()$')" 22 50 10 \
"Radio name:" "Configuration:" "" \
"" "" "" \
"Ebyte e22-900m30s" "(SX1262_TCXO)" "Included in Femtofox Pro" \
"Ebyte e22-900m22s" "(SX1262_TCXO)" "" \
"Ebyte e80-900m22s" "(SX1262_XTAL)" "" \
"Heltec ht-ra62" "(SX1262_TCXO)" "" \
"Seeed wio-sx1262" "(SX1262_TCXO)" "" \
"Waveshare sx126x-xxxm" "(SX1262_XTAL)" "Not recommended due issues with sending longer messages" \
"AI Thinker ra-01sh" "(SX1262_XTAL)" "" \
"LoRa Meshstick 1262" "(meshstick-1262)" "USB based LoRa radio from Mark Birss. https://github.com/markbirss/MESHSTICK" \
"Simulated radio" "(none)" "" \
" " "" "" \
"Cancel" "" "" 3>&1 1>&2 2>&3)
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
local radio=""
case $choice in
"Ebyte e22-900m30s")
radio="sx1262_tcxo"
;;
"Ebyte e22-900m22s")
radio="sx1262_tcxo"
;;
"Ebyte e80-900m22s")
radio="sx1262_xtal"
;;
"Heltec ht-ra62")
radio="sx1262_tcxo"
;;
"Seeed wio-sx1262")
radio="sx1262_tcxo"
;;
"Waveshare sx126x-xxxm")
radio="sx1262_xtal"
;;
"AI Thinker ra-01sh")
radio="femto_sx1262_xtal"
;;
"LoRa Meshstick 1262")
radio="lora-meshstick-1262"
;;
"Simulated radio")
radio="none"
;;
"Cancel")
return
;;
esac
if [ -n "$radio" ]; then #if a radio was selected
femto-meshtasticd-config.sh -l "$radio" -s # set the radio, then restart meshtasticd
dialog --no-collapse --colors --title "$title" --msgbox "$(echo -e "Radio \Zu$choice\Zn selected.\nMeshtasticd service restarted.\Zn")" 7 45
break
fi
done
}
# Function to handle Meshtasticd settings
meshtastic_settings() {
local title="Meshtastic Settings"
while true; do
echo "Checking Meshtasticd service state..."
meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 18 50 4 \
meshtastic_choice=$(dialog --no-collapse --colors --title "$title" --cancel-label "Back" --default-item "$meshtastic_choice" --item-help --menu "Meshtasticd service is $(femto-utils.sh -R "$(femto-utils.sh -C "meshtasticd")")$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Warning: using simulated radio\Zn')" 20 50 4 \
1 "View node info" "" \
2 "View configuration URL & QR code" "" \
3 "LoRa settings" "" \
4 "Security settings" "" \
5 "Mesh connectivity test" "" \
6 "Manage Meshtasticd service" "" \
7 "Enable/disable i2c support" "" \
8 "Upgrade/install Meshtasticd" "" \
9 "Uninstall Meshtasticd" "" \
2 "Set LoRa radio model" "" \
3 "View configuration URL & QR code" "" \
4 "Set configuration URL" "" \
5 "Full Meshtastic settings" "" \
6 "Mesh connectivity test" "" \
7 "Manage Meshtasticd service" "" \
8 "Enable/disable i2c support" "" \
9 "Upgrade/install Meshtasticd" "" \
10 "Uninstall Meshtasticd" "" \
" " "" "" \
10 "Back to main menu" "" 3>&1 1>&2 2>&3)
11 "Back to main menu" "" 3>&1 1>&2 2>&3)
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
case $meshtastic_choice in
1) # view node info)
@ -445,94 +514,31 @@ meshtastic_settings() {
loading "Getting node info..."
dialog --no-collapse --colors --title "Meshtastic node info" --msgbox "$(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0
)
;;
2) # get current configuration URL & QR code)
;;
2) # Set LoRa radio model)
set_lora_radio
;;
3) # get current configuration URL & QR code)
check_meshtasticd_running && (
loading "Getting Meshtastic QR code and URL..."
femto-meshtasticd-config.sh -g
pause
)
;;
3) # LoRa settings)
femto-meshtasticd-lora-dialogs.sh
;;
4) # remote admin)
4) # Configure automatically with URL)
check_meshtasticd_running && (
choice="" # zero the choice before loading the submenu
while true; do
choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --title "Meshtastic Security Settings" --item-help --menu "" 16 40 5 \
1 "View/change public key" "" \
2 "View/change private key" "" \
" " "" "" \
3 "View admin keys" "" \
4 "Set admin key" "" \
5 "Clear admin keys" "" \
6 "Legacy admin channel" "" \
" " "" "" \
7 "Return to previous menu" "" 3>&1 1>&2 2>&3)
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
case $choice in
1) # view/change public key)
loading "Getting current public key..."
key=$(femto-meshtasticd-config.sh -u)
if [ -n "$key" ]; then
dialog --no-collapse --title "Meshtastic public key" --yesno "Current public key:\n$key\n\nSet new key?" 9 55
if [ $? -eq 0 ]; then #unless cancel/no
key=$(dialog --no-collapse --title "Meshtastic public key" --inputbox "New Meshtastic public key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then #unless cancel/no
loading "Sending command..."
dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "$(femto-meshtasticd-config.sh -U "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
fi
fi
else
dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0
fi
;;
2) # view/change private key)
loading "Getting current private key..."
key=$(femto-meshtasticd-config.sh -r)
if [ -n "$key" ]; then
dialog --no-collapse --title "Meshtastic private key" --yesno "Current private key:\n$key\n\nSet new key?" 9 55
if [ $? -eq 0 ]; then #unless cancel/no
key=$(dialog --no-collapse --title "Meshtastic private key" --inputbox "New Meshtastic private key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then #unless cancel/no
loading "Sending command..."
dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "$(femto-meshtasticd-config.sh -R "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
fi
fi
else
dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0
fi
;;
3) # view admin keys)
loading "Getting Admin Keys..."
dialog --no-collapse --title "Admin keys" --msgbox "Up to 3 admin keys are permitted, more will be ignored.\n\nKeys:$(femto-meshtasticd-config.sh -a | tail -n 1 | sed 's/|n/\\n/g')" 0 0
;;
4) # set admin key)
key=$(dialog --no-collapse --title "Admin Keys" --inputbox "Meshtastic admin key - up to 3, more will be ignored.\n\n(SHIFT+INS to paste):" 11 40 3>&1 1>&2 2>&3)
if [ -n "$key" ]; then #if a key was entered
loading "Sending command..."
dialog --no-collapse --colors --title "Admin Keys" --msgbox "$(femto-meshtasticd-config.sh -A "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
fi
;;
5) # clear admin keys)
dialog --no-collapse --title "Admin Keys" --yesno "Meshtasticd can have up to 3 admin keys. If more are added, they will be ignored.\n\nClear admin key list?\n" 0 0
if [ $? -eq 0 ]; then #unless cancel/no
loading "Sending command..."
dialog --no-collapse --colors --title "Admin Keys" --msgbox "$(femto-meshtasticd-config.sh -c && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
fi
;;
6) # legacy admin)
legacy_admin
;;
7) # return to previous menu)
break
;;
esac
done
meshtastic_config_url
)
;;
5) #test mesh connectivity)
5) # Meshtastic settings)
check_meshtasticd_running && (
dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nStopping conflicting services, will restart after exit...\n\nThis can take up to a minute." 9 50
femto-utils.sh -A stop
python /opt/control/main.py --host
femto-utils.sh -A start
)
;;
6) #test mesh connectivity)
check_meshtasticd_running && (
dialog --no-collapse --title "Meshtastic Connectivity Test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45
if [ $? -eq 0 ]; then #unless cancel/no
@ -541,7 +547,7 @@ meshtastic_settings() {
fi
)
;;
6) #manage meshtasticd service)
7) #manage meshtasticd service)
choice="" # zero the choice before loading the submenu
while true; do
echo "Checking Meshtasticd service state..."
@ -594,7 +600,7 @@ meshtastic_settings() {
esac
done
;;
7) #i2c)
8) #i2c)
choice="" # zero the choice before loading the submenu
while true; do
i2c_state=$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -I check)")
@ -621,21 +627,21 @@ meshtastic_settings() {
esac
done
;;
8) #Upgrade meshtasticd)
9) #Upgrade meshtasticd)
dialog --no-collapse --title "$title" --yesno "Upgrade Meshtasticd?\nRequires internet connection." 0 0
if [ $? -eq 0 ]; then #unless cancel/no
femto-meshtasticd-config.sh -z
pause
fi
;;
9) #uninstall meshtasticd)
10) #uninstall meshtasticd)
dialog --no-collapse --colors --title "$title" --yesno "Uninstall Meshtasticd?\n\nFoxbuntu was designed with Meshtasticd integration in mind, and may behave unexpectedly if Meshtasticd is removed.\n\nThis will take the node \Zu\Z1OFFLINE\Zn and will not restart!" 0 0
if [ $? -eq 0 ]; then
femto-meshtasticd-config.sh -x
dialog --no-collapse --colors --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`\Zusudo apt purge\Zn\`." 8 40
fi
;;
10)
11)
return
;;
esac
@ -714,13 +720,16 @@ Options are:\n\
-w Set Wi-Fi config menu\
-c Check if Meshtasticd is running and warn the user if not\
"
while getopts ":hlLwc" opt; do
while getopts ":hluLwc" opt; do
case ${opt} in
h) # Option -h (help)
echo -e $help
;;
;;
l) # Option -l (set lora radio)
femto-meshtasticd-lora-dialogs.sh # this function has moved
set_lora_radio
;;
u) # Option -u (set meshtastic URL)
meshtastic_config_url
;;
L) # Option -L (Meshtastic legacy admin menu)
legacy_admin

View file

@ -25,55 +25,66 @@ wizard() {
dialog --title "Hostname" --msgbox "\nFemtofox is now reachable at\n$new_hostname.local" 8 40
fi
dialog --title "$title" --cancel-label "Skip" --yesno "Configure Wi-Fi settings?" 6 40
dialog --title "$title" --yesno "Configure Wi-Fi settings?" 6 40
if [ $? -eq 0 ]; then #unless cancel/no
femto-config -w
fi
dialog --title "$title" --cancel-label "Skip" --yesno "Configure Meshtastic?" 6 40
dialog --title "$title" --yesno "Configure Meshtastic?" 6 40
if [ $? -eq 0 ]; then #unless cancel/no
femto-meshtasticd-lora-dialogs.sh -w
# public key
loading "Getting current public key..."
key=$(femto-meshtasticd-config.sh -u)
if [ -n "$key" ]; then
dialog --no-collapse --title "Meshtastic public key" --yesno "Current public key:\n$key\n\nSet new key?" 9 55
if [ $? -eq 0 ]; then #unless cancel/no
key=$(dialog --no-collapse --title "Meshtastic public key" --inputbox "New Meshtastic public key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then #unless cancel/no
loading "Sending command..."
dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "$(femto-meshtasticd-config.sh -U "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
fi
fi
else
dialog --no-collapse --colors --title "Meshtastic public key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0
if femto-config -c; then
while true; do
meshtastic_menu_choice=$(dialog --no-collapse --colors --cancel-label "Continue" --default-item "$meshtastic_menu_choice" --title "Meshtastic Configuration" --item-help --menu "Currently configured LoRa radio:\n$(femto-utils.sh -R "$(femto-meshtasticd-config.sh -k)")" 16 40 5 \
1 "Set LoRa radio model" "" \
2 "Set configuration URL" "" \
3 "Set private key" "" \
4 "Set public key" "" \
" " "" "" \
5 "Full Meshtastic settings menu" "" \
" " "" "" \
6 "Continue" "" 3>&1 1>&2 2>&3)
[ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
case $meshtastic_menu_choice in
1) # Set LoRa radio model)
femto-config -l
;;
2) # Configure automatically with URL)
femto-config -c && (
femto-config -u
)
;;
3) # view/change private key)
femto-config -c && (
key=$(dialog --no-collapse --colors --title "Meshtastic Private Key" --cancel-label "Cancel" --inputbox "The private key of the device, used to create a shared key with a remote device for secure communication.\n\n\Z1This key should be kept confidential.\nSetting an invalid key will lead to unexpected behaviors.\Zn\n\nPrivate key (default: random)" 15 60 3>&1 1>&2 2>&3)
if [ $? -eq 0 ] && [[ -n "$key" ]]; then #unless cancel/no
loading "Sending command..."
dialog --no-collapse --colors --title "Meshtastic Private Key" --msgbox "$(femto-meshtasticd-config.sh -R "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
fi
)
;;
4) # view/change public key)
femto-config -c && (
key=$(dialog --no-collapse --colors --title "Meshtastic Public Key" --cancel-label "Cancel" --inputbox "The public key of the device, shared with other nodes on the mesh to allow them to compute a shared secret key for secure communication.\n\n\ZuGenerated automatically\Zn to match private key.\n\n\Z1Don't change this if you don't know what you're doing.\Zn\n\nPublic key (default: generated from private key)" 16 60 3>&1 1>&2 2>&3)
if [ $? -eq 0 ] && [[ -n "$key" ]]; then #unless cancel/no
loading "Sending command..."
dialog --no-collapse --colors --title "Meshtastic Public Key" --msgbox "$(femto-meshtasticd-config.sh -U "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
fi
)
;;
5) # Full Meshtastic settings menu)
femto-config -c && (
dialog --no-collapse --infobox "Loading Meshtastic settings menu...\n\nStopping conflicting services, will restart after exit...\n\nThis can take up to a minute." 9 50
femto-utils.sh -A stop
python /opt/control/main.py --host
femto-utils.sh -A start
)
;;
6) # return to previous menu)
break
;;
esac
done
fi
# private key
loading "Getting current private key..."
key=$(femto-meshtasticd-config.sh -u)
if [ -n "$key" ]; then
dialog --no-collapse --title "Meshtastic private key" --yesno "Current private key:\n$key\n\nSet new key?" 9 55
if [ $? -eq 0 ]; then #unless cancel/no
key=$(dialog --no-collapse --title "Meshtastic private key" --inputbox "New Meshtastic private key (SHIFT+INS to paste):" 8 60 3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then #unless cancel/no
loading "Sending command..."
dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "$(femto-meshtasticd-config.sh -R "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
fi
fi
else
dialog --no-collapse --colors --title "Meshtastic private key" --msgbox "\Z1Failed to communicate with Meshtasticd.\Zn\n\nIs the service running?\n" 0 0
fi
key=$(dialog --title "Meshtastic admin key" --cancel-label "Skip" --inputbox "Enter Meshtastic admin key (optional). If 3 admin keys are already in Meshtastic, more will be ignored.\n(SHIFT+INS to paste):" 11 50 3>&1 1>&2 2>&3)
if [ -n "$key" ]; then #if a URL was entered
loading "Sending key..."
dialog --no-collapse --colors --title "Meshtastic URL" --msgbox "$(femto-meshtasticd-config.sh -A "$key" && echo -e "\n\Z4Command successful!\Zn\n" || echo -e "\n\Z1Command failed.\Zn\n")" 0 0
fi
femto-config -L # legacy admin menu
fi
dialog --title "$title" --msgbox "Setup wizard complete!" 6 40

View file

@ -22,6 +22,7 @@ Options are:
-E Generate/overwrite SSH encryption keys
-C "service" Check if service is enabled, disabled, running
-R "command" Replace colors for dialog menus
-A "stop" Stop/start services that are using the meshtastic API so the Control for Meshtastic settings UI can run without interference. Options: "stop" "start"
-v Get Foxbuntu version
EOF
)
@ -222,7 +223,7 @@ replace_colors() {
echo "$input"
}
while getopts ":harsl:ipcnoSEC:R:v" opt; do
while getopts ":harsl:ipcnoSEC:R:A:v" opt; do
case ${opt} in
h) # Option -h (help)
echo -e "$help"
@ -285,6 +286,36 @@ while getopts ":harsl:ipcnoSEC:R:v" opt; do
R) # replace colors)
replace_colors "$OPTARG"
;;
A) # Stop/start services that are using the meshtastic API)
# this code cycles through all the software packages and looks for ones that are installed, conflict with Control and have a service that is enabled. If it finds such a software package, it either stops or starts it, according to $OPTARG
if [[ $OPTARG == "stop" ]]; then
action_text="Stopping"
action="s"
elif [[ $OPTARG == "start" ]]; then
action_text="Starting"
action="r"
else
echo "\`$OPTARG\` is not a valid argument for -A. Options are \"stop\" and \"start\"."
echo -e "$help"
exit 1
fi
for file in /usr/local/bin/packages/*.sh; do
filename=$(basename "$file")
[[ "$filename" == femto_* ]] && continue # Skip files starting with "femto_"
if sudo "$file" -I; then
if echo "$(sudo "$file" -C)" | grep -q "\"full control\" Meshtastic software"; then
service_state=$(sudo femto-utils.sh -C "$(sudo $file -E)")
if [[ $service_state =~ "enabled" ]] ; then
echo "$action_text $(sudo $file -N) service..."
eval "sudo $file -$action"
fi
fi
fi
done
;;
v) # get foxbuntu version)
echo "Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'patch=\K[0-9]+' /etc/foxbuntu-release)$(grep -oP 'hotfix=\K\S+' /etc/foxbuntu-release)"
;;

View file

@ -0,0 +1,74 @@
#!/bin/bash
### For package maintainer:
# Fill the following fields and choose the options that are in use by this package
# Populate the install, uninstall and upgrade functions
# Remember that this script may be launched in terminal, via web UI or another method, so inputs aren't always possible
# This system supports both interactive and non-interactive installs. For non-interactive installs, $interaction="false". In this cause special instructions to the user should be given as user_message, such as `After installation, edit /opt/software/config.ini`
# 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
name="Control for Meshtastic" # software name
author="pdxlocations" # software author - OPTIONAL
description="Control for Meshtastic is a fully-featured Meshtastic configuration tool made for running in console, utilizing Curses.\n\nControl is installed by default on Femtofox and is used for Meshtastic configuration in femto-config. Uninstallation is not recommended." # software description - OPTIONAL (but strongly recommended!)
URL="https://github.com/pdxlocations/control" # software URL. Can contain multiple URLs - OPTIONAL
options="hxiuglNADUOLGTIC" # script options in use by software package. For example, for a package with no service, exclude `edsrS`
launch="python /opt/control/main.py --host" # command to launch software, if applicable
license="/opt/control/LICENSE" # file to cat to display license
location="/opt/control" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name`
license="$location/LICENSE" # file to cat to display license
license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string
conflicts="\"Full control\" Meshtastic software, such as TC²-BBS and Meshing Around - but only while running." # 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() {
if ! git clone https://github.com/pdxlocations/control.git /opt/control; then
echo "user_message: Git clone failed. Is internet connected?"
exit 1
fi
pip install -r $location/requirements.txt
chown -R femto $location #give ownership of installation directory to $user
git config --global --add safe.directory $location # prevents git error when updating
echo "user_message: To launch, go to Meshtastic settings. Launching manually may conflict with \`full control\` Meshtastic software such as BBS."
exit 0 # should be `exit 1` if operation failed
}
# uninstall script
uninstall() {
rm -rf $location
echo "Removed \`$location\`."
echo "user_message: All files removed."
exit 0 # should be `exit 1` if operation failed
}
#upgrade script
upgrade() {
cd $location
if ! git pull; then
echo "user_message: Git pull failed. Is internet connected?"
exit 1
fi
exit 0
}
# Check if already installed. `exit 0` if yes, `exit 1` if no
check() {
#the following works for cloned repos, but not for apt installs
if [ -d "$location" ]; then
#echo "Already installed"
exit 0
else
#echo "Not installed"
exit 1
fi
}
# display license
license() {
echo -e "Contents of $license:\n\n $([[ -f "$license" ]] && awk -v max=2000 -v file="$license" '{ len += length($0) + 1; if (len <= max) print; else if (!cut) { cut=1; printf "%s...\n\nFile truncated, see %s for complete license.", substr($0, 1, max - len + length($0)), file; exit } }' "$license")"
}
# parse arguments
source /usr/local/bin/packages/femto_argument_parse.sh "$@"
exit 0

View file

@ -19,7 +19,7 @@ service_name="mesh_bot" # the name of the service, such as `chrony`. REQUIRED if
location="/opt/meshing-around" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name`
license="$location/LICENSE" # file to cat to display license
license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string
conflicts="TC²-BBS, any other \"full control\" style bots" # comma delineated plain-text list of packages with which this package conflicts. 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"
conflicts="TC²-BBS, other \"full control\" Meshtastic software, Control (only when running)." # comma delineated plain-text list of packages with which this package conflicts. 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() {

View file

@ -20,7 +20,7 @@ service_name="mesh-bbs" # the name of the service/s, such as `chrony`. REQUIRE
location="/opt/TC2-BBS-mesh" # install location REQUIRED if not apt installed. Generally, we use `/opt/software-name`
license="$location/LICENSE" # file to cat to display license
license_name="GPL3" # license name, such as MIT, GPL3, custom, whatever. short text string
conflicts="Meshing Around, other \"full control\" packages" # 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"
conflicts="Meshing Around, other \"full control\" Meshtastic software, Control (only when running)." # 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() {