Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 72 lines (61 sloc) 2.28 KB
#!/bin/bash
##
#
# script to exec chrome with ramdisk cache
# tmpfs on /tmp type tmpfs
#
# added: full GPU acceleration for all the things
# including GPU Rasterization
#
# tweaks: disable QUIC
# enable tabs to be muted (audio)
# enable smooth scrolling
# disable ugly material design bookmark management
#
# 02-04-2018 - removed all GPU hardware accel flags
# NVIDIA has huge problems with drivers
# causing screen to lockup etc
#
# 24-04-2018 - added in GPU accel flags as switched to nouveau drivers
#
##
# equk 2014 - equk.co.uk
##
## variables
profile_folder="$HOME/.chrome_profiles/default"
cache_folder="/tmp/chrome_cache"
chrome_bin="/usr/bin/chromium"
chromium_flags='--enable-webgl --ignore-gpu-blacklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --ssl-version-min=tls1 --force-device-scale-factor=1 --disable-quic --enable-tab-audio-muting --enable-smooth-scrolling --enable-features=MarkHttpAs --disable-features=MaterialDesignBookmarks'
## run command
if [ "x$DISPLAY" = "x" ]; then
echo "must be run within the X Window System." >&2
echo "Exiting." >&2
exit 1
fi
# Check for root ( quit if root :x )
if [ $(whoami) = "root" ]; then
exit 1
fi
# Check for custom flags
if [ -z ${chromium_flags+x} ]; then
echo "chromium_flags is not set";
echo "Exiting." >&2
exit 1
fi
# Check if user namespaces is enabled (for sandbox)
# Note: this is to enforce user namespaces for Layer-1 sandbox
if [[ ! (-r /proc/sys/kernel/unprivileged_userns_clone && $(< /proc/sys/kernel/unprivileged_userns_clone) == 1 && -n $(zcat /proc/config.gz | grep CONFIG_USER_NS=y) ) ]]; then
echo "User namespaces are not detected as enabled on your system, this is required for Layer-1 sandbox"
echo "No usable sandbox! Update your kernel or see https://github.com/chromium/chromium/blob/master/docs/linux_sandboxing.md for more information."
exit 1
fi
# Create cache directory if it doesn't exist
if [[ ! -e $cache_folder ]]; then
mkdir -p $cache_folder
fi
# Create profile directory if it doesn't exist
if [[ ! -e $profile_folder ]]; then
mkdir -p $profile_folder
fi
# Execute chrome
exec $chrome_bin --user-data-dir=$profile_folder --disk-cache-dir=$cache_folder $chromium_flags $1