Project

General

Profile

« Previous | Next » 

Revision 06aa745e

Added by Phil Davis almost 13 years ago

pkg_mgr_install - only mount rw when needed

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.

View differences:

usr/local/www/pkg_mgr_install.php
120 120

  
121 121
ob_flush();
122 122

  
123
// Write out configuration to creatae a backup prior to pkg install
124
write_config(gettext("Creating restore point before package installation."));
125

  
126
/* mount rw fs */
127
conf_mount_rw();
123
switch($_GET['mode']) {
124
	case "showlog":
125
	case "installedinfo":
126
		/* These cases do not make changes. */
127
		$fs_mounted_rw = false;
128
		break;
129
	default:
130
		/* All other cases make changes, so mount rw fs */
131
		conf_mount_rw();
132
		$fs_mounted_rw = true;
133
		/* Write out configuration to create a backup prior to pkg install. */
134
		write_config(gettext("Creating restore point before package installation."));
135
		break;
136
}
128 137

  
129 138
switch($_GET['mode']) {
130 139
	case "delete":
......
213 222
if($fd_log)
214 223
        fclose($fd_log);
215 224

  
216
/* read only fs */
217
conf_mount_ro();
218

  
225
if($fs_mounted_rw) {
226
	/* Restore to read only fs */
227
	conf_mount_ro();
228
}
219 229
?>

Also available in: Unified diff