Skip to content

Commit 6a5a7ad

Browse files
authored
Merge pull request #424 from Stefal/dev
Merge v2.6.1 to master
2 parents e434f19 + aa8747f commit 6a5a7ad

7 files changed

+48
-26
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## [2.6.1] - 2024-08-26
4+
### Changed
5+
- More tests before installing prebuilt RTKLib cli tools.
6+
### Fixed
7+
- Build rtklib if previous installed release is not working. #418
8+
- Insert new release into settings.conf before restarting services. #411
9+
- Custom web_port setting was not used. #419
10+
- Cellular modem: nmcli connection was not updated after a switch to public ip address.
11+
312
## [2.6.0] - 2024-07-05
413
### Added
514
- Septentrio Mosaic-X5 detection and configuration

settings.conf.default

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[general]
44
# Version
5-
version=2.6.0
5+
version=2.6.1
66
# Rtkbase upgrade mandatory "checkpoint"
77
checkpoint_version=2.7.0
88
# User who runs str2str_file service

tools/install.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ install_rtklib() {
167167
#test if computer_model in sbc_array (https://stackoverflow.com/questions/3685970/check-if-a-bash-array-contains-a-value)
168168
if printf '%s\0' "${sbc_array[@]}" | grep -Fxqz -- "${computer_model}" \
169169
&& [[ -f "${rtkbase_path}"'/tools/bin/rtklib_b34j/'"${arch_package}"'/str2str' ]] \
170-
&& lsb_release -c | grep -qE 'buster|bullseye|bookworm'
170+
&& lsb_release -c | grep -qE 'bullseye|bookworm' \
171+
&& "${rtkbase_path}"'/tools/bin/rtklib_b34j/'"${arch_package}"/str2str --version > /dev/null 2>&1
171172
then
172173
echo 'Copying new rtklib binary for ' "${computer_model}" ' - ' "${arch_package}"
173174
cp "${rtkbase_path}"'/tools/bin/rtklib_b34j/'"${arch_package}"/str2str /usr/local/bin/

tools/modem_check.py

+19-13
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def get_public_ip_address():
5353
try:
5454
modem = Modem(MODEM_PORT)
5555
public_ip = modem.get_ip_address()
56+
public_ip = None if public_ip == '0.0.0.0' else public_ip
5657

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

80+
if USE_PUBLIC_IP and ip_in_use != public_ip and public_ip is not None:
81+
try:
82+
print("Internal Ip address in use: ", ip_in_use)
83+
print("Modem public Ip address: ", public_ip)
84+
modem = Modem(MODEM_PORT)
85+
modem.set_usbnetip_mode(1)
86+
print("Request to switch to public IP address done!")
87+
print("It could take a few minutes to be active")
88+
time.sleep(5)
89+
nmcli.connection.down(CONN_NAME)
90+
time.sleep(5)
91+
nmcli.connection.up(CONN_NAME)
92+
except Exception as e:
93+
print(e)
94+
finally:
95+
print("closing modem connexion")
96+
modem.close()
97+
7998
if ip_in_use == None or public_ip == None or network_reg == False or ping_host == False:
8099
print("Internal Ip address in use: ", ip_in_use)
81100
print("Modem public Ip address: ", public_ip)
@@ -94,19 +113,6 @@ def ping(host):
94113
finally:
95114
modem.close()
96115

97-
elif USE_PUBLIC_IP and ip_in_use != public_ip:
98-
try:
99-
print("Internal Ip address in use: ", ip_in_use)
100-
print("Modem public Ip address: ", public_ip)
101-
modem = Modem(MODEM_PORT)
102-
modem.set_usbnetip_mode(1)
103-
print("Request to switch to public IP address done!")
104-
print("It could take a few minutes to be active")
105-
except Exception as e:
106-
print(e)
107-
finally:
108-
print("closing modem connexion")
109-
modem.close()
110116
#else:
111117
# print("We are already using the public Ip")
112118

rtkbase_update.sh tools/rtkbase_update.sh

+14-8
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,14 @@ upd_2.5.0 () {
199199

200200
}
201201

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

207212
#check if we can apply the update
@@ -219,9 +224,10 @@ upd_"${old_version/b*/b}" "$@" || { echo 'Update failed (upd_release_number)' ;
219224
#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
220225

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

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

231237
#restart str2str if it was active before upgrading rtklib
232238
# restart not nedeed if RTKlib was not upgraded
233-
[ $str2str_active = 'active' ] && systemctl restart str2str_tcp
234-
[ $str2str_file = 'active' ] && systemctl restart str2str_file
235-
[ $rtkrcv_raw2nmea = 'active' ] && systemctl restart rtkbase_raw2nmea
239+
#[ $str2str_active = 'active' ] && systemctl restart str2str_tcp
240+
#[ $str2str_file = 'active' ] && systemctl restart str2str_file
241+
#[ $rtkrcv_raw2nmea = 'active' ] && systemctl restart rtkbase_raw2nmea
242+
236243
# restart previously running services
237244
# restart needed with all update to propagate the release number in the rtcm stream
238245
[ $str2str_ntrip_A_active = 'active' ] && systemctl restart str2str_ntrip_A
@@ -241,7 +248,6 @@ chown -R ${standard_user}:${standard_user} ${destination_directory}
241248
[ $str2str_rtcm = 'active' ] && systemctl restart str2str_rtcm_svr
242249
[ $str2str_serial = 'active' ] && systemctl restart str2str_rtcm_serial
243250

244-
245251
#if a reboot is needed
246252
#systemctl reboot
247253
echo 'RTKBase update ending...'

unit/modem_check.service

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Wants=network-online.target
55

66
[Service]
77
Type=simple
8-
User={user}
8+
User=root
99
ExecStart={python_path} {script_path}/tools/modem_check.py
1010
Restart=on-failure
1111
RestartSec=30

web_app/server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -986,8 +986,8 @@ def arg_parse():
986986
app.secret_key = rtkbaseconfig.get_secret_key()
987987
#socketio.run(app, host = "::", port = args.port or rtkbaseconfig.get("general", "web_port", fallback=80), debug=args.debug) # IPv6 "::" is mapped to IPv4
988988
gunicorn_options = {
989-
'bind': ['%s:%s' % ('0.0.0.0', args.port or rtkbaseconfig.get("main", "web_port", fallback=80)),
990-
'%s:%s' % ('[::1]', args.port or rtkbaseconfig.get("main", "web_port", fallback=80)) ],
989+
'bind': ['%s:%s' % ('0.0.0.0', args.port or rtkbaseconfig.get("general", "web_port", fallback=80)),
990+
'%s:%s' % ('[::1]', args.port or rtkbaseconfig.get("general", "web_port", fallback=80)) ],
991991
'workers': 1,
992992
'worker_class': 'gevent',
993993
'graceful_timeout': 10,

0 commit comments

Comments
 (0)