Project

General

Profile

« Previous | Next » 

Revision d9554e41

Added by Brad Davis 5 months ago

Reorganize how RAM disks are created

This improves things by moving the read of the sizes for the RAM disks
up before things are unmounted and so we have a good linker cache for
xmllint to run and also avoids spawning another shell just to mount the
RAM disks.

View differences:

src/etc/pfSense-rc
220 220
[ ! -f /var/run/ld-elf.so.hints ] && /etc/rc.d/ldconfig start
221 221

  
222 222
# Check if RAM disks are enabled, store for repeated use
223
if ramdisk_check_enabled; then
223
if ramdisk_check_enabled && ramdisk_check_size; then
224 224
	USE_RAMDISK=true
225 225
fi
226 226

  
......
236 236

  
237 237
# Attempt to create and mount RAM disks
238 238
if [ -n "${USE_RAMDISK}" ]; then
239
	/etc/rc.embedded
239
	echo -n "Setting up memory disks..."
240
	if ramdisk_try_mount tmp && ramdisk_try_mount var; then
241
		/bin/rm -f "${RAMDISK_FLAG_FILE}"
242
		# Create some needed directories
243
		/bin/mkdir -p /var/db /var/spool/lock
244
		/usr/sbin/chown uucp:dialer /var/spool/lock
245
		# Ensure vi's recover directory is present
246
		/bin/mkdir -p /var/tmp/vi.recover
247
		/bin/mkdir -p /var/crash
248
		/bin/mkdir -p /var/run
249
		/bin/mkdir -p /var/log
250
		echo " done."
251
	else
252
		/usr/bin/touch "${RAMDISK_FLAG_FILE}"
253
		/sbin/umount -f /tmp /var 2>/dev/null
254
		echo " failed."
255
	fi
240 256
	# Remount the correct subordinate ZFS datasets to ensure they are used properly
241 257
	[ -n "${USE_ZFS}" ] && _be_mount_zfs
242 258
fi
......
290 306
# Use php -n here because we are not ready to load extensions yet
291 307
varrunpath=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var varrun_path "/var/run")
292 308

  
293
if ! ramdisk_is_active; then
309
if [ -z "${USE_RAMDISK}" ]; then
294 310
	/sbin/mount -o rw,size=4m,mode=1777 -t tmpfs tmpfs "$varrunpath"
295 311
fi
296 312

  
......
323 339
fi
324 340

  
325 341
# make some directories in /var
326
/bin/mkdir -p "$varrunpath" /var/log /var/etc /var/db/entropy /var/db/rrd /var/at/jobs/ /var/empty /var/log/nginx 2>/dev/null
342
/bin/mkdir -p "$varrunpath" /var/etc /var/db/entropy /var/db/rrd /var/at/jobs/ /var/empty /var/log/nginx 2>/dev/null
327 343

  
328 344
# turn off the immutable flag, set /var/empty to read-only, make it immutable again
329 345
chflags noschg /var/empty

Also available in: Unified diff