Index: www/chromium/Makefile =================================================================== --- www/chromium/Makefile +++ www/chromium/Makefile @@ -300,6 +300,7 @@ ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/swiftshader/${g} \ ${STAGEDIR}${DATADIR}/swiftshader .endfor + ${INSTALL_SCRIPT} ${FILESDIR}/fix-hanging-tabs.sh ${STAGEDIR}${DATADIR} post-install-DEBUG-on: ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/*.so \ Index: www/chromium/files/fix-hanging-tabs.sh =================================================================== --- /dev/null +++ www/chromium/files/fix-hanging-tabs.sh @@ -0,0 +1,45 @@ +#! /bin/sh - +# +# Chromium has a known problem of hanging tabs. The workaround for this +# problem is to mount ~/.cache/chromium as memory-fs. In order to do this, +# before you run Chromium, please run this script as root once for each user +# who uses Chromium. +# +# $FreeBSD$ + +set -e + +# Make sure that the user specified both the user and the group. +if [ ${#} -ne 2 ]; then + printf 'Usage: %s user group\n' "${0}" >&2 + exit 1 +fi + +user="${1}" +group="${2}" +home="$(awk -F: -v user="${user}" '{if ($1==user) print $6}' /etc/passwd)" +cachedir="${home}/.cache/chromium" +fstabrecord="md ${cachedir} mfs rw,late,-w${user}:${group},-s300m 2 0" + +# Make sure that the provided user and group are valid. +if ! id "${user}" >/dev/null 2>&1; then + printf 'Invalid user "%s"\n' "${user}" >&2 + exit 1 +elif [ ! -d "${home}" ]; then + printf 'Cannot locate home directory of user "%s"\n' "${user}" >&2 + exit 1 +elif ! grep "^${group}:" /etc/group >/dev/null; then + printf 'Invalid group "%s"\n' "${group}" >&2 + exit 1 +fi + +if grep "${fstabrecord}" /etc/fstab >/dev/null; then + printf 'Workaround already configured for user "%s"\n' "${user}" >&2 + exit 1 +fi + +if [ ! -d "${cachedir}" ]; then + su -l "${user}" -c 'mkdir "${cachedir}"' +fi +printf '%s\n' "${fstabrecord}" >> /etc/fstab +mount "${cachedir}" Index: www/chromium/pkg-message =================================================================== --- www/chromium/pkg-message +++ www/chromium/pkg-message @@ -1,23 +1,21 @@ --I-- For correct operation, shared memory support has to be enabled -in Chromium by performing the following command as root : +in Chromium by performing the following command as root: -# sysctl kern.ipc.shm_allow_removed=1 + # sysctl kern.ipc.shm_allow_removed=1 To preserve this setting across reboots, append the following -to /etc/sysctl.conf : +to /etc/sysctl.conf: -kern.ipc.shm_allow_removed=1 + kern.ipc.shm_allow_removed=1 -FreeBSD 11.0-R and newer have this set by default. +FreeBSD 11.0-RELEASE and newer have this set by default. --II-- Chromium has a known problem of hanging tabs. The workaround for this problem is to mount ~/.cache/chromium as memory-fs. -In order to do this, before you run chromium, please run these -commands once as root for each user who uses chromium (replace -{user}/{group} with your user/group names): - -# [ -d ~{user}/.cache/chromium ] || mkdir ~{user}/.cache/chromium -# echo "md $(echo ~{user})/.cache/chromium mfs rw,late,-w{user}:{group},-s300m 2 0" >> /etc/fstab -# mount ~{user}/.cache/chromium +In order to do this, before you run Chromium, please run the +following script as root once for each user who uses Chromium +(replace {user}/{group} with your user/group names): + + # %%DATADIR%%/fix-hanging-tabs.sh {user} {group} Index: www/chromium/pkg-plist =================================================================== --- www/chromium/pkg-plist +++ www/chromium/pkg-plist @@ -3,6 +3,7 @@ %%DATADIR%%/chrome-wrapper %%DATADIR%%/chrome_100_percent.pak %%DATADIR%%/chrome_200_percent.pak +%%DATADIR%%/fix-hanging-tabs.sh %%DATADIR%%/font_service.service %%DATADIR%%/headless_lib.pak %%DATADIR%%/icudtl.dat