When entering pkg_mgr_install the filesystem was being mounted rw and a backup made of the config, even if the case was "showlog" or "installedinfo". This resulted in:
a) an extra "backup" of the config being made after an install - it could be seen in Diagnostics, Backup Restore, Config History
b) Unnecessary conf_mount_rw and conf_mount_ro calls. These slow down the process on nanobsd-like systems.
This change fixes both these issues.
A variable not changed in a cut-paste.
When on console, update_progress_bar should also only be called for 1-9 then every 10% progress, to reduce serial output volume.
On nanobsd, running /etc/rc.update_bogons.sh gives:
[2.1-BETA0][admin@test02.homedomain]/tmp(12): /etc/rc.update_bogons.sh 1
/etc/rc.update_bogons.sh: cannot create /etc/bogonsv6: Read-only file system
The code does 1 conf_mount_rw but 2 conf_mount_ro
This is also seen in system.log:
Aug 2 17:47:59 test02 admin: rc.update_bogons.sh is starting up.
Aug 2 17:47:59 test02 admin: rc.update_bogons.sh is beginning the update cycle.
Aug 2 17:49:27 test02 admin: Bogons file downloaded: 1 addresses added.
Aug 2 17:49:29 test02 php: : Reference 1000 is going negative, not doing unreference.
Aug 2 17:49:29 test02 admin: Bogons files downloaded: no changes.
Aug 2 17:49:29 test02 admin: rc.update_bogons.sh is ending the update cycle.
The V6 bogons file does not get applied because the filesystem is RO by that point.
I have reviewed the whole logic of this shell script. I believe it handles the various cases correctly now. On nanobsd I get the following in system.log:
Aug 2 18:17:13 test02 admin: rc.update_bogons.sh is starting up.
Aug 2 18:17:13 test02 admin: rc.update_bogons.sh is beginning the update cycle.
Aug 2 18:18:02 test02 admin: Bogons V4 file downloaded: no changes.
Aug 2 18:18:10 test02 admin: Bogons V6 file downloaded: 58959 addresses added.
Aug 2 18:18:52 test02 admin: rc.update_bogons.sh is ending the update cycle.
The "renew" button on a DHCP connection ends up calling function interface_dhcpv6_configure() in interfaces.inc, which in turn calls filter_configure() (in filter.inc) but gives the error:
Fatal error: Call to undefined function filter_configure() in /etc/inc/interfaces.inc on line 3350
See forum post: http://forum.pfsense.org/index.php/topic,52046.0.html
Add a "done." and newline after "Cleaning up..."
Then when output is going to the serial console the next line will start cleanly and %age figures will not write over the top of "Clean".
When on the console, the code only intended to update the percentage downloaded every 10%. Due to string-and-int type differences, the test was not working, all percentages were being logged. This is fixed.
Also, add a newline after 100% - then whatever outputs next gets a clean start on a new line of output.
Tidies up the console output during a post-firmware-upgrade package install.
Every time System:Packages is selected, the code does a conf_mount_rw, checks for existence of some dirs, then does conf_mount_ro. This makes navigating the package install GUI slow on nanobsd, and it is not needed.
Do is_dir checks first, then conf_mount_rw only if they need to be created. The is_dir function works fine on a read-only filesystem.
Use lock and unlock to make sure that all incrementing and decrementing of the reference count in the shared memory section is atomic. This ensures that there are not unusual timing conditions that could see 2 callers trying to update the reference count at the same time, which could result in the count never returning to zero. If that happened, then the filesystems would never be restored to read-only. (this is really just relevant to nanobsd) (note that shmop_* calls in php do not do any locking themselves - callers must coordinate their own access to the shared memory section)
I also made the number stored in the shared memory be an ordinary integer followed by null chars to pad out the rest of the shared memory section. This makes the numbers stored look normal, and ensures that there is no other rubbish left in memory after them to cause problems on reading.