Skip to content

Commit

Permalink
Merge pull request #424 from Stefal/dev
Browse files Browse the repository at this point in the history
Merge v2.6.1 to master
  • Loading branch information
Stefal authored Aug 26, 2024
2 parents e434f19 + aa8747f commit 6a5a7ad
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 26 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [2.6.1] - 2024-08-26
### Changed
- More tests before installing prebuilt RTKLib cli tools.
### Fixed
- Build rtklib if previous installed release is not working. #418
- Insert new release into settings.conf before restarting services. #411
- Custom web_port setting was not used. #419
- Cellular modem: nmcli connection was not updated after a switch to public ip address.

## [2.6.0] - 2024-07-05
### Added
- Septentrio Mosaic-X5 detection and configuration
Expand Down
2 changes: 1 addition & 1 deletion settings.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[general]
# Version
version=2.6.0
version=2.6.1
# Rtkbase upgrade mandatory "checkpoint"
checkpoint_version=2.7.0
# User who runs str2str_file service
Expand Down
3 changes: 2 additions & 1 deletion tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ install_rtklib() {
#test if computer_model in sbc_array (https://stackoverflow.com/questions/3685970/check-if-a-bash-array-contains-a-value)
if printf '%s\0' "${sbc_array[@]}" | grep -Fxqz -- "${computer_model}" \
&& [[ -f "${rtkbase_path}"'/tools/bin/rtklib_b34j/'"${arch_package}"'/str2str' ]] \
&& lsb_release -c | grep -qE 'buster|bullseye|bookworm'
&& lsb_release -c | grep -qE 'bullseye|bookworm' \
&& "${rtkbase_path}"'/tools/bin/rtklib_b34j/'"${arch_package}"/str2str --version > /dev/null 2>&1
then
echo 'Copying new rtklib binary for ' "${computer_model}" ' - ' "${arch_package}"
cp "${rtkbase_path}"'/tools/bin/rtklib_b34j/'"${arch_package}"/str2str /usr/local/bin/
Expand Down
32 changes: 19 additions & 13 deletions tools/modem_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def get_public_ip_address():
try:
modem = Modem(MODEM_PORT)
public_ip = modem.get_ip_address()
public_ip = None if public_ip == '0.0.0.0' else public_ip

except Exception as e:
print (e)
Expand All @@ -76,6 +77,24 @@ def ping(host):
public_ip = get_public_ip_address()
ping_host = ping('caster.centipede.fr') or ping('pch.net')

if USE_PUBLIC_IP and ip_in_use != public_ip and public_ip is not None:
try:
print("Internal Ip address in use: ", ip_in_use)
print("Modem public Ip address: ", public_ip)
modem = Modem(MODEM_PORT)
modem.set_usbnetip_mode(1)
print("Request to switch to public IP address done!")
print("It could take a few minutes to be active")
time.sleep(5)
nmcli.connection.down(CONN_NAME)
time.sleep(5)
nmcli.connection.up(CONN_NAME)
except Exception as e:
print(e)
finally:
print("closing modem connexion")
modem.close()

if ip_in_use == None or public_ip == None or network_reg == False or ping_host == False:
print("Internal Ip address in use: ", ip_in_use)
print("Modem public Ip address: ", public_ip)
Expand All @@ -94,19 +113,6 @@ def ping(host):
finally:
modem.close()

elif USE_PUBLIC_IP and ip_in_use != public_ip:
try:
print("Internal Ip address in use: ", ip_in_use)
print("Modem public Ip address: ", public_ip)
modem = Modem(MODEM_PORT)
modem.set_usbnetip_mode(1)
print("Request to switch to public IP address done!")
print("It could take a few minutes to be active")
except Exception as e:
print(e)
finally:
print("closing modem connexion")
modem.close()
#else:
# print("We are already using the public Ip")

22 changes: 14 additions & 8 deletions rtkbase_update.sh → tools/rtkbase_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,14 @@ upd_2.5.0 () {

}

#this update function is here only for testing update, but could be useful in case of a failed 2.5 to 2.6 update.
upd_2.6.0() {
upd_2.5.0
# update modem_check_service file (see https://github.com/Stefal/rtkbase/commit/cfad1981e483d74da04f53b8d7b354661100d610)
"${destination_directory}"/tools/install.sh --user "${standard_user}" --unit-files
# build rtklib if current release doesn't work
if ! str2str --version > /dev/null 2>&1
then
"${destination_directory}"/tools/install.sh --user "${standard_user}" --rtklib
fi
}

#check if we can apply the update
Expand All @@ -219,9 +224,10 @@ upd_"${old_version/b*/b}" "$@" || { echo 'Update failed (upd_release_number)' ;
#When dealing with beta version, "${oldversion/b*/b}" will call function 2.4b when we use a release 2.4b1 or 2.4b2 or 2.4beta99

# The new version numbers will be imported from settings.conf.default during the web server startup.
echo "Delete the line version= and checkpoint_version= in settings.conf"
echo "update the line version= and delete checkpoint_version= in settings.conf"
sed -i '/^checkpoint_version=/d' ${destination_directory}/settings.conf
sed -i '/^version=/d' ${destination_directory}/settings.conf
new_version=$(grep '^version' ${destination_directory}/settings.conf.default | awk -F '=' '{ print $2 }')
sed -i 's/^version=.*/version='$new_version'/' ${destination_directory}/settings.conf
echo 'Insert updated status in settings.conf'
sed -i '/^\[general\]/a updated=true' ${destination_directory}/settings.conf

Expand All @@ -230,9 +236,10 @@ chown -R ${standard_user}:${standard_user} ${destination_directory}

#restart str2str if it was active before upgrading rtklib
# restart not nedeed if RTKlib was not upgraded
[ $str2str_active = 'active' ] && systemctl restart str2str_tcp
[ $str2str_file = 'active' ] && systemctl restart str2str_file
[ $rtkrcv_raw2nmea = 'active' ] && systemctl restart rtkbase_raw2nmea
#[ $str2str_active = 'active' ] && systemctl restart str2str_tcp
#[ $str2str_file = 'active' ] && systemctl restart str2str_file
#[ $rtkrcv_raw2nmea = 'active' ] && systemctl restart rtkbase_raw2nmea

# restart previously running services
# restart needed with all update to propagate the release number in the rtcm stream
[ $str2str_ntrip_A_active = 'active' ] && systemctl restart str2str_ntrip_A
Expand All @@ -241,7 +248,6 @@ chown -R ${standard_user}:${standard_user} ${destination_directory}
[ $str2str_rtcm = 'active' ] && systemctl restart str2str_rtcm_svr
[ $str2str_serial = 'active' ] && systemctl restart str2str_rtcm_serial


#if a reboot is needed
#systemctl reboot
echo 'RTKBase update ending...'
Expand Down
2 changes: 1 addition & 1 deletion unit/modem_check.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Wants=network-online.target

[Service]
Type=simple
User={user}
User=root
ExecStart={python_path} {script_path}/tools/modem_check.py
Restart=on-failure
RestartSec=30
Expand Down
4 changes: 2 additions & 2 deletions web_app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,8 @@ def arg_parse():
app.secret_key = rtkbaseconfig.get_secret_key()
#socketio.run(app, host = "::", port = args.port or rtkbaseconfig.get("general", "web_port", fallback=80), debug=args.debug) # IPv6 "::" is mapped to IPv4
gunicorn_options = {
'bind': ['%s:%s' % ('0.0.0.0', args.port or rtkbaseconfig.get("main", "web_port", fallback=80)),
'%s:%s' % ('[::1]', args.port or rtkbaseconfig.get("main", "web_port", fallback=80)) ],
'bind': ['%s:%s' % ('0.0.0.0', args.port or rtkbaseconfig.get("general", "web_port", fallback=80)),
'%s:%s' % ('[::1]', args.port or rtkbaseconfig.get("general", "web_port", fallback=80)) ],
'workers': 1,
'worker_class': 'gevent',
'graceful_timeout': 10,
Expand Down

0 comments on commit 6a5a7ad

Please sign in to comment.