Merge pull request #128208 from liff/teams/fix-absolute-paths

teams: fix absolute path usages
This commit is contained in:
Ben Siraphob 2021-06-29 11:54:46 +07:00 committed by GitHub
commit fa0a222632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@
, gawk , gawk
, xdg-utils , xdg-utils
, systemd , systemd
, nodePackages
, enableRectOverlay ? false }: , enableRectOverlay ? false }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -24,7 +25,7 @@ stdenv.mkDerivation rec {
sha256 = "1kx4j837fd344zy90nl0j3r8cdvihy6i6gf56wd5n56zngx1fhjv"; sha256 = "1kx4j837fd344zy90nl0j3r8cdvihy6i6gf56wd5n56zngx1fhjv";
}; };
nativeBuildInputs = [ dpkg autoPatchelfHook wrapGAppsHook ]; nativeBuildInputs = [ dpkg autoPatchelfHook wrapGAppsHook nodePackages.asar ];
unpackCmd = "dpkg -x $curSrc ."; unpackCmd = "dpkg -x $curSrc .";
@ -40,11 +41,27 @@ stdenv.mkDerivation rec {
]; ];
preFixup = '' preFixup = ''
gappsWrapperArgs+=(--prefix PATH : "${coreutils}/bin:${gawk}/bin:${xdg-utils}/bin") gappsWrapperArgs+=(--prefix PATH : "${coreutils}/bin:${gawk}/bin")
gappsWrapperArgs+=(--add-flags --disable-namespace-sandbox) gappsWrapperArgs+=(--add-flags --disable-namespace-sandbox)
gappsWrapperArgs+=(--add-flags --disable-setuid-sandbox) gappsWrapperArgs+=(--add-flags --disable-setuid-sandbox)
''; '';
buildPhase = ''
runHook preBuild
asar extract share/teams/resources/app.asar "$TMP/work"
substituteInPlace $TMP/work/main.bundle.js \
--replace "/usr/share/pixmaps/" "$out/share/pixmaps" \
--replace "/usr/bin/xdg-mime" "${xdg-utils}/bin/xdg-mime" \
--replace "Exec=/usr/bin/" "Exec=" # Remove usage of absolute path in autostart.
asar pack --unpack='{*.node,*.ftz,rect-overlay}' "$TMP/work" share/teams/resources/app.asar
runHook postBuild
'';
preferLocalBuild = true;
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall