Add a "varshm" check/fix to make sure /var/shm is mentioned in /etc/fstab

(and add a default of tmpfs with 25% of available ram limit if not).
To avoid the warning but not mount the tmpfs, just comment out the line
for /var/shm.

Also move "obsolete" to the end of the list again, as it should be run
last.
This commit is contained in:
martin 2013-12-05 15:41:23 +00:00
parent 31096de6e5
commit 0c88e27e4c
1 changed files with 58 additions and 29 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: postinstall,v 1.158 2013/09/09 15:04:12 prlw1 Exp $
# $NetBSD: postinstall,v 1.159 2013/12/05 15:41:23 martin Exp $
#
# Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
# All rights reserved.
@ -1749,34 +1749,6 @@ do_catpages()
return $failed
}
#
# obsolete
# (this item is last to allow other items to move obsolete files)
#
additem obsolete "remove obsolete file sets and minor libraries"
do_obsolete()
{
[ -n "$1" ] || err 3 "USAGE: do_obsolete fix|check"
op="$1"
failed=0
sort -ru "${DEST_DIR}"/var/db/obsolete/* | obsolete_paths "${op}"
failed=$(( ${failed} + $? ))
(
obsolete_libs /lib
obsolete_libs /usr/lib
obsolete_libs /usr/lib/i18n
obsolete_libs /usr/X11R6/lib
obsolete_libs /usr/X11R7/lib
[ "$MACHINE" = "amd64" ] && obsolete_libs /usr/lib/i386
[ "$MACHINE" = "sparc64" ] && obsolete_libs /usr/lib/sparc
) | obsolete_paths "${op}"
failed=$(( ${failed} + $? ))
return ${failed}
}
#
# ptyfsoldnodes
@ -1863,6 +1835,63 @@ do_ptyfsoldnodes()
}
#
# varshm
#
additem varshm "check for a tmpfs mounted on /var/shm"
do_varshm()
{
[ -n "$1" ] || err 3 "USAGE: do_varshm fix|check"
op="$1"
failed=0
if ${GREP} -w "/var/shm" "${DEST_DIR}/etc/fstab" >/dev/null 2>&1;
then
failed = 0;
else
if [ "${op}" = "check" ]; then
failed=1
echo "No /var/shm mount found in ${DEST_DIR}/etc/fstab"
elif [ "${op}" = "fix" ]; then
printf '\ntmpfs\t/var/shm\ttmpfs\trw,-m1777,-sram%%25\n' \
>> "${DEST_DIR}/etc/fstab"
echo "Added tmpfs with 25% ram limit as /var/shm"
fi
fi
return ${failed}
}
#
# obsolete
# (this item is last to allow other items to move obsolete files)
#
additem obsolete "remove obsolete file sets and minor libraries"
do_obsolete()
{
[ -n "$1" ] || err 3 "USAGE: do_obsolete fix|check"
op="$1"
failed=0
sort -ru "${DEST_DIR}"/var/db/obsolete/* | obsolete_paths "${op}"
failed=$(( ${failed} + $? ))
(
obsolete_libs /lib
obsolete_libs /usr/lib
obsolete_libs /usr/lib/i18n
obsolete_libs /usr/X11R6/lib
obsolete_libs /usr/X11R7/lib
[ "$MACHINE" = "amd64" ] && obsolete_libs /usr/lib/i386
[ "$MACHINE" = "sparc64" ] && obsolete_libs /usr/lib/sparc
) | obsolete_paths "${op}"
failed=$(( ${failed} + $? ))
return ${failed}
}
#
# end of items
# ------------