pre-create the .cache/chromium and .local/share/applications directories

so that unveil will not fail on them if they do not exist yet
This commit is contained in:
robert 2019-01-06 19:49:53 +00:00
parent bbeb9bdcbb
commit ecf81ba16e
3 changed files with 26 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.403 2019/01/04 13:25:08 robert Exp $
# $OpenBSD: Makefile,v 1.404 2019/01/06 19:49:53 robert Exp $
.include <bsd.port.arch.mk>
@ -10,7 +10,7 @@ COMMENT= Chromium browser
V= 71.0.3578.98
REVISION= 1
REVISION= 2
DISTNAME= chromium-${V}

View File

@ -1,4 +1,4 @@
# $OpenBSD: unveil.main,v 1.5 2018/12/25 17:32:43 robert Exp $
# $OpenBSD: unveil.main,v 1.6 2019/01/06 19:49:53 robert Exp $
# needed for chromium
/etc/chromium r
@ -60,7 +60,7 @@
~/.config/mimeapps.list r
~/.config/user-dirs.dirs r
~/.local/share/applications r
~/.local/share/applications rwc
~/.local/share/applnk r
~/.local/share/fonts r
~/.local/share/glib-2.0 r

View File

@ -1,7 +1,7 @@
Index: services/service_manager/sandbox/openbsd/sandbox_openbsd.cc
--- services/service_manager/sandbox/openbsd/sandbox_openbsd.cc.orig
+++ services/service_manager/sandbox/openbsd/sandbox_openbsd.cc
@@ -0,0 +1,292 @@
@@ -0,0 +1,313 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
@ -28,10 +28,13 @@ Index: services/service_manager/sandbox/openbsd/sandbox_openbsd.cc
+#include "base/command_line.h"
+#include "base/debug/stack_trace.h"
+#include "base/feature_list.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/files/scoped_file.h"
+#include "base/logging.h"
+#include "base/macros.h"
+#include "base/memory/singleton.h"
+#include "base/path_service.h"
+#include "base/posix/eintr_wrapper.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/sys_info.h"
@ -108,6 +111,24 @@ Index: services/service_manager/sandbox/openbsd/sandbox_openbsd.cc
+ crypto::EnsureNSSInit();
+#endif
+
+ if (process_type.empty()) {
+ base::FilePath cache_directory, local_directory;
+
+ base::PathService::Get(base::DIR_CACHE, &cache_directory);
+ base::PathService::Get(base::DIR_HOME, &local_directory);
+
+ cache_directory = cache_directory.AppendASCII("chromium");
+ local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications");
+
+ if (!base::CreateDirectory(cache_directory)) {
+ LOG(ERROR) << "Failed to create " << cache_directory.value() << " directory.";
+ }
+
+ if (!base::CreateDirectory(local_directory)) {
+ LOG(ERROR) << "Failed to create " << local_directory.value() << " directory.";
+ }
+ }
+
+ if (!command_line->HasSwitch(switches::kDisableUnveil))
+ SetUnveil(process_type);
+