wrapGAppsHook: Fix #78803

Add to gappsWrapperArgs in preFixupPhases.
This commit is contained in:
worldofpeace 2020-03-01 18:14:36 -05:00
parent 3973a3c79c
commit 29fc27b4ac
1 changed files with 66 additions and 61 deletions

View File

@ -9,18 +9,7 @@ find_gio_modules() {
addEnvHooks "${targetOffset:?}" find_gio_modules addEnvHooks "${targetOffset:?}" find_gio_modules
wrapGApp() { gappsWrapperArgsHook() {
local program="$1"
shift 1
wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@"
}
# Note: $gappsWrapperArgs still gets defined even if ${dontWrapGApps-} is set.
wrapGAppsHook() {
# guard against running multiple times (e.g. due to propagation)
[ -z "$wrapGAppsHookHasRun" ] || return 0
wrapGAppsHookHasRun=1
if [ -n "$GDK_PIXBUF_MODULE_FILE" ]; then if [ -n "$GDK_PIXBUF_MODULE_FILE" ]; then
gappsWrapperArgs+=(--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE") gappsWrapperArgs+=(--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE")
fi fi
@ -33,6 +22,7 @@ wrapGAppsHook() {
gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH") gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH")
fi fi
# Check for prefix as well
if [ -d "${prefix:?}/share" ]; then if [ -d "${prefix:?}/share" ]; then
gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "$prefix/share") gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "$prefix/share")
fi fi
@ -46,6 +36,21 @@ wrapGAppsHook() {
gappsWrapperArgs+=(--prefix "$v" : "${!v}") gappsWrapperArgs+=(--prefix "$v" : "${!v}")
fi fi
done done
}
preFixupPhases+=" gappsWrapperArgsHook"
wrapGApp() {
local program="$1"
shift 1
wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@"
}
# Note: $gappsWrapperArgs still gets defined even if ${dontWrapGApps-} is set.
wrapGAppsHook() {
# guard against running multiple times (e.g. due to propagation)
[ -z "$wrapGAppsHookHasRun" ] || return 0
wrapGAppsHookHasRun=1
if [[ -z "${dontWrapGApps:-}" ]]; then if [[ -z "${dontWrapGApps:-}" ]]; then
targetDirsThatExist=() targetDirsThatExist=()
@ -57,8 +62,8 @@ wrapGAppsHook() {
if [[ -d "${targetDir}" ]]; then if [[ -d "${targetDir}" ]]; then
targetDirsThatExist+=("${targetDir}") targetDirsThatExist+=("${targetDir}")
targetDirsRealPath+=("$(realpath "${targetDir}")/") targetDirsRealPath+=("$(realpath "${targetDir}")/")
find "${targetDir}" -type f -executable -print0 \ find "${targetDir}" -type f -executable -print0 |
| while IFS= read -r -d '' file; do while IFS= read -r -d '' file; do
echo "Wrapping program '${file}'" echo "Wrapping program '${file}'"
wrapGApp "${file}" wrapGApp "${file}"
done done
@ -69,8 +74,8 @@ wrapGAppsHook() {
# Note: links to binaries within targetDirs do not need # Note: links to binaries within targetDirs do not need
# to be wrapped as the binaries have already been wrapped # to be wrapped as the binaries have already been wrapped
if [[ ${#targetDirsThatExist[@]} -ne 0 ]]; then if [[ ${#targetDirsThatExist[@]} -ne 0 ]]; then
find "${targetDirsThatExist[@]}" -type l -xtype f -executable -print0 \ find "${targetDirsThatExist[@]}" -type l -xtype f -executable -print0 |
| while IFS= read -r -d '' linkPath; do while IFS= read -r -d '' linkPath; do
linkPathReal=$(realpath "${linkPath}") linkPathReal=$(realpath "${linkPath}")
for targetPath in "${targetDirsRealPath[@]}"; do for targetPath in "${targetDirsRealPath[@]}"; do
if [[ "$linkPathReal" == "$targetPath"* ]]; then if [[ "$linkPathReal" == "$targetPath"* ]]; then