diff options
author | Ermal <eri@pfsense.org> | 2010-03-17 14:17:10 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-03-17 14:17:10 +0000 |
commit | a45e27ba70e30d67e380da33f332cd686441788c (patch) | |
tree | 650c4238e46ef064ad220c564adcea5c6dd27823 /etc | |
parent | 2ae24c22b8cadc261721425c629a10b604f5070e (diff) | |
download | pfsense-a45e27ba70e30d67e380da33f332cd686441788c.zip pfsense-a45e27ba70e30d67e380da33f332cd686441788c.tar.gz |
Ticket #417. Fix installation on embedded by using a refcount system for the mount command.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/config.lib.inc | 32 | ||||
-rw-r--r-- | etc/inc/util.inc | 6 |
2 files changed, 13 insertions, 25 deletions
diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index 0de03a7..61f76ea 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -43,8 +43,6 @@ pfSense_MODULE: config */ -$config_parsed = false; - /****f* config/encrypted_configxml * NAME * encrypted_configxml - Checks to see if config.xml is encrypted and if so, prompts to unlock. @@ -296,8 +294,8 @@ function conf_mount_rw() { /* do not mount on cdrom platform */ if($g['platform'] == "cdrom" or $g['platform'] == "pfSense") return; - - if (is_subsystem_dirty('mount')) + + if (refcount_reference(1000) > 1) return; $status = mwexec("/sbin/mount -u -w {$g['cf_path']}"); @@ -311,15 +309,12 @@ function conf_mount_rw() { /* if the platform is soekris or wrap or pfSense, lets mount the * compact flash cards root. */ - if($g['platform'] == "wrap" or $g['platform'] == "net45xx" - or $g['platform'] == "embedded" or $g['platform'] == "nanobsd") { + $status = mwexec("/sbin/mount -u -w /"); + /* we could not mount this correctly. kick off fsck */ + if($status <> 0) { + log_error("File system is dirty. Launching FSCK for /"); + mwexec("/sbin/fsck -y /"); $status = mwexec("/sbin/mount -u -w /"); - /* we could not mount this correctly. kick off fsck */ - if($status <> 0) { - log_error("File system is dirty. Launching FSCK for /"); - mwexec("/sbin/fsck -y /"); - $status = mwexec("/sbin/mount -u -w /"); - } } mark_subsystem_dirty('mount'); @@ -334,22 +329,11 @@ function conf_mount_rw() { function conf_mount_ro() { global $g; - if($g['booting'] == true) - return; - /* do not umount on cdrom or pfSense platforms */ if($g['platform'] == "cdrom" or $g['platform'] == "pfSense") return; - /* firmare upgrade in progress */ - if (is_subsystem_dirty('firmwarelock')) - return; - - /* do not umount if generating ssh keys */ - if (is_subsystem_dirty('sshdkeys')) - return; - - if (!is_subsystem_dirty('mount')) + if (refcount_unreference(1000) > 0) return; clear_subsystem_dirty('mount'); diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 81051f3..79d6f4b 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -149,7 +149,11 @@ function refcount_init($reference) { } function refcount_reference($reference) { - $shmid = shmop_open($reference, "w", 0644, 10); + $shmid = @shmop_open($reference, "w", 0644, 10); + if (!$shmid) { + refcount_init($reference); + $shmid = shmop_open($reference, "w", 0644, 10); + } $shm_data = shmop_read($shmid, 0, 10); $shm_data = intval($shm_data) + 1; shmop_write($shmid, $shm_data, 0); |