chrome 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. # $OpenBSD: chrome,v 1.14 2016/06/02 21:03:38 sthen Exp $
  3. DATASIZE="716800"
  4. OPENFILES="400"
  5. xm_log() {
  6. echo -n "$@\nDo you want to run Chromium anyway?\n\
  7. (If you don't increase these limits, Chromium might fail to work properly.)" | \
  8. ${X11BASE}/bin/xmessage -file - -center -buttons yes:0,no:1 -default no
  9. }
  10. if [ $(ulimit -Sd) -lt ${DATASIZE} ]; then
  11. ulimit -Sd ${DATASIZE} || \
  12. xm_log "Cannot increase datasize-cur to at least ${DATASIZE}"
  13. [ $? -eq 0 ] || exit
  14. fi
  15. if [ $(ulimit -Sn) -lt ${OPENFILES} ]; then
  16. ulimit -Sn ${OPENFILES} || \
  17. xm_log "Cannot increase openfiles-cur to at least ${OPENFILES}"
  18. [ $? -eq 0 ] || exit
  19. fi
  20. if ! mount | grep `df -h ${TRUEPREFIX} | tail -1 | awk '{print $6}'` |
  21. grep -q wxallowed; then
  22. echo "Filesystem containing ${TRUEPREFIX} must have the 'wxallowed' flag" |
  23. ${X11BASE}/bin/xmessage -file - -center -buttons exit:0 -default exit
  24. exit
  25. fi
  26. #
  27. # Temporary workaround for the case when chromium crashes and leaves
  28. # the SingletonLock, which prevents chromium to start up.
  29. #
  30. if [ -h ${HOME}/.config/chromium/SingletonLock ]; then
  31. _pid=`readlink ${HOME}/.config/chromium/SingletonLock | cut -d '-' -f 2`
  32. kill -0 ${_pid} 2>/dev/null
  33. if [ $? -gt 0 ]; then
  34. rm ${HOME}/.config/chromium/SingletonLock
  35. fi
  36. fi
  37. #
  38. # Issue #395446
  39. # https://code.google.com/p/chromium/issues/detail?id=395446
  40. #
  41. [ -z ${LANG} ] && _l=en_US.UTF-8 || _l=${LANG}
  42. LANG=${_l} exec "${TRUEPREFIX}/chrome/chrome" "${@}"