Browse Source

dont put a '.pki' directory in $HOME

Noah Vogt 3 years ago
parent
commit
aaa4c47185
3 changed files with 98 additions and 8 deletions
  1. 6 4
      .SRCINFO
  2. 8 4
      PKGBUILD
  3. 84 0
      xdg-basedir.patch

+ 6 - 4
.SRCINFO

@@ -1,5 +1,5 @@
-pkgbase = ungoogled-chromium
-	pkgdesc = A lightweight approach to removing Google web service dependency
+pkgbase = ungoogled-chromium-xdg
+	pkgdesc = A lightweight approach to removing Google web service dependency - with Support for the XDG Base Directory Specification
 	pkgver = 95.0.4638.69
 	pkgrel = 1
 	url = https://github.com/Eloston/ungoogled-chromium
@@ -65,7 +65,8 @@ pkgbase = ungoogled-chromium
 	source = chromium-94-ffmpeg-roll.patch
 	source = unexpire-accelerated-video-decode-flag.patch
 	source = use-oauth2-client-switches-as-default.patch
-	source = ungoogled-chromium-95.0.4638.69-1.tar.gz::https://github.com/Eloston/ungoogled-chromium/archive/95.0.4638.69-1.tar.gz
+	source = xdg-basedir.patch
+	source = ungoogled-chromium-xdg-95.0.4638.69-1.tar.gz::https://github.com/Eloston/ungoogled-chromium/archive/95.0.4638.69-1.tar.gz
 	source = chromium-drirc-disable-10bpc-color-configs.conf
 	source = wayland-egl.patch
 	sha256sums = 38a37d737c6c9a7198402ca614746b2dbb7abbb793bb2cb02dc796b62a22efe7
@@ -83,8 +84,9 @@ pkgbase = ungoogled-chromium
 	sha256sums = 56acb6e743d2ab1ed9f3eb01700ade02521769978d03ac43226dec94659b3ace
 	sha256sums = 2a97b26c3d6821b15ef4ef1369905c6fa3e9c8da4877eb9af4361452a425290b
 	sha256sums = e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711
+	sha256sums = c332af43f4afb120c749319f3f2b1bcb38715ac5d9dbb376475702bd9ef95686
 	sha256sums = 35debe7f407a4749d4454fc78f52c18955f1d8400750fdc20b179f528106c658
 	sha256sums = babda4f5c1179825797496898d77334ac067149cac03d797ab27ac69671a7feb
 	sha256sums = 34d08ea93cb4762cb33c7cffe931358008af32265fc720f2762f0179c3973574
 
-pkgname = ungoogled-chromium
+pkgname = ungoogled-chromium-xdg

+ 8 - 4
PKGBUILD

@@ -8,12 +8,12 @@
 # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
 # Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
 
-pkgname=ungoogled-chromium
+pkgname=ungoogled-chromium-xdg
 pkgver=95.0.4638.69
 pkgrel=1
 _launcher_ver=8
 _gcc_patchset=4
-pkgdesc="A lightweight approach to removing Google web service dependency"
+pkgdesc="A lightweight approach to removing Google web service dependency - with Support for the XDG Base Directory Specification"
 arch=('x86_64')
 url="https://github.com/Eloston/ungoogled-chromium"
 license=('BSD')
@@ -40,7 +40,8 @@ source=(https://commondatastorage.googleapis.com/chromium-browser-official/chrom
         chromium-93-ffmpeg-4.4.patch
         chromium-94-ffmpeg-roll.patch
         unexpire-accelerated-video-decode-flag.patch
-        use-oauth2-client-switches-as-default.patch)
+        use-oauth2-client-switches-as-default.patch
+        xdg-basedir.patch)
 sha256sums=('38a37d737c6c9a7198402ca614746b2dbb7abbb793bb2cb02dc796b62a22efe7'
             '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a'
             'bc6373f2470a9e6d947a4deaee0612f730112f69552b933c54bb6e60b82dd6f1'
@@ -55,7 +56,8 @@ sha256sums=('38a37d737c6c9a7198402ca614746b2dbb7abbb793bb2cb02dc796b62a22efe7'
             '1a9e074f417f8ffd78bcd6874d8e2e74a239905bf662f76a7755fa40dc476b57'
             '56acb6e743d2ab1ed9f3eb01700ade02521769978d03ac43226dec94659b3ace'
             '2a97b26c3d6821b15ef4ef1369905c6fa3e9c8da4877eb9af4361452a425290b'
-            'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711')
+            'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711'
+            'c332af43f4afb120c749319f3f2b1bcb38715ac5d9dbb376475702bd9ef95686')
 provides=('chromium')
 conflicts=('chromium')
 source=(${source[@]}
@@ -148,6 +150,8 @@ prepare() {
   # Wayland/EGL regression (crbug #1071528 #1071550)
   patch -Np1 -i ../wayland-egl.patch
 
+  patch -Np1 -i ../xdg-basedir.patch
+
   # Ungoogled Chromium changes
   _ungoogled_repo="$srcdir/$pkgname-$pkgver-1"
   _utils="${_ungoogled_repo}/utils"

+ 84 - 0
xdg-basedir.patch

@@ -0,0 +1,84 @@
+diff -ruN a/base/nix/xdg_util.cc b/base/nix/xdg_util.cc
+--- a/base/nix/xdg_util.cc	2021-10-01 03:36:37.000000000 +0200
++++ b/base/nix/xdg_util.cc	2021-10-11 23:38:26.553638013 +0200
+@@ -29,6 +29,8 @@
+ const char kXdgConfigHomeEnvVar[] = "XDG_CONFIG_HOME";
+ const char kXdgCurrentDesktopEnvVar[] = "XDG_CURRENT_DESKTOP";
+ const char kXdgSessionTypeEnvVar[] = "XDG_SESSION_TYPE";
++const char kDotDataDir[] = ".local/share";
++const char kXdgDataHomeEnvVar[] = "XDG_DATA_HOME";
+ 
+ FilePath GetXDGDirectory(Environment* env, const char* env_name,
+                          const char* fallback_dir) {
+
+diff -ruN a/base/nix/xdg_util.h b/base/nix/xdg_util.h
+--- a/base/nix/xdg_util.h	2021-10-11 23:57:48.607012470 +0200
++++ b/base/nix/xdg_util.h	2021-10-12 00:04:46.457027239 +0200
+@@ -37,6 +37,12 @@
+ // The XDG session type environment variable.
+ BASE_EXPORT extern const char kXdgSessionTypeEnvVar[];
+ 
++// The default XDG data directory name.
++BASE_EXPORT extern const char kDotDataDir[];
++ 
++// The XDG data directory environment variable.
++BASE_EXPORT extern const char kXdgDataHomeEnvVar[];
++
+ // Utility function for getting XDG directories.
+ // |env_name| is the name of an environment variable that we want to use to get
+ // a directory path. |fallback_dir| is the directory relative to $HOME that we
+
+diff -ruN a/crypto/nss_util.cc b/crypto/nss_util.cc
+--- a/crypto/nss_util.cc	2021-10-01 03:36:49.000000000 +0200
++++ b/crypto/nss_util.cc	2021-10-12 12:45:52.235119130 +0200
+@@ -30,6 +30,9 @@
+ #include "build/chromeos_buildflags.h"
+ #include "crypto/nss_crypto_module_delegate.h"
+ #include "crypto/nss_util_internal.h"
++#include "base/environment.h"
++#include "base/nix/xdg_util.h"
++#include "chrome/common/chrome_constants.h"
+ 
+ namespace crypto {
+ 
+@@ -45,12 +48,21 @@
+ 
+ base::FilePath GetDefaultConfigDirectory() {
+   base::FilePath dir;
++#if defined(OS_LINUX)
++  std::unique_ptr<base::Environment> env(base::Environment::Create());
++  dir = base::nix::GetXDGDirectory(env.get(), base::nix::kXdgDataHomeEnvVar, base::nix::kDotDataDir);
++#else
+   base::PathService::Get(base::DIR_HOME, &dir);
++#endif
+   if (dir.empty()) {
+-    LOG(ERROR) << "Failed to get home directory.";
++    LOG(ERROR) << "Failed to get $HOME or $XDG_DATA_HOME directory.";
+     return dir;
+   }
++#if defined(OS_LINUX)
++  dir = dir.Append(chrome::kBrowserProcessExecutableName).AppendASCII("pki").AppendASCII("nssdb");
++#else
+   dir = dir.AppendASCII(".pki").AppendASCII("nssdb");
++#endif
+   if (!base::CreateDirectory(dir)) {
+     LOG(ERROR) << "Failed to create " << dir.value() << " directory.";
+     dir.clear();
+@@ -136,7 +148,7 @@
+   NSSInitSingleton() {
+     // Initializing NSS causes us to do blocking IO.
+     // Temporarily allow it until we fix
+-    //   http://code.google.com/p/chromium/issues/detail?id=59847
++    //   http://code.9oo91e.qjz9zk/p/chromium/issues/detail?id=59847
+     base::ThreadRestrictions::ScopedAllowIO allow_io;
+ 
+     EnsureNSPRInit();
+@@ -273,7 +285,7 @@
+ 
+   // Shouldn't need to const_cast here, but SECMOD doesn't properly declare
+   // input string arguments as const.  Bug
+-  // https://bugzilla.mozilla.org/show_bug.cgi?id=642546 was filed on NSS
++  // https://bugzilla.m0z111a.qjz9zk/show_bug.cgi?id=642546 was filed on NSS
+   // codebase to address this.
+   SECMODModule* module = SECMOD_LoadUserModule(
+       const_cast<char*>(modparams.c_str()), nullptr, PR_FALSE);