--- a/scripts/xdg-desktop-menu.in +++ b/scripts/xdg-desktop-menu.in @@ -32,7 +32,7 @@ { # echo Update desktop database: $mode if [ "$mode" = "system" ] ; then - for x in `echo $PATH | sed 's/:/ /g'` /opt/gnome/bin; do + for x in `echo $PATH | sed 's/:/ /g'` @TERMUX_PREFIX@/opt/gnome/bin; do if [ -x $x/update-desktop-database ] ; then DEBUG 1 "Running $x/update-desktop-database" eval '$x/update-desktop-database'$xdg_redirect_output @@ -67,7 +67,7 @@ for MIME in $mimetypes ; do xdg_default_dirs="$XDG_DATA_DIRS" - [ -n "$xdg_default_dirs" ] || xdg_default_dirs=/usr/local/share/:/usr/share/ + [ -n "$xdg_default_dirs" ] || xdg_default_dirs=@TERMUX_PREFIX@/share/ if [ x"$mode" = x"user" ] ; then xdg_user_dir="$XDG_DATA_HOME" [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" @@ -112,7 +112,7 @@ xdg_user_dir="$xdg_user_dir/$xdg_dir_name" xdg_system_dirs="$XDG_CONFIG_DIRS" - [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/etc/xdg + [ -n "$xdg_system_dirs" ] || xdg_system_dirs=@TERMUX_PREFIX@/etc/xdg xdg_global_dir= for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do if [ -w $x/$xdg_dir_name ] ; then @@ -165,7 +165,7 @@ eval 'ln -s "applications-merged" "$mandrake_xdg_dir"'$xdg_redirect_output fi fi - if [ $action = "install" ] && [ x"$mode" = x"user" ] && [ -d "/etc/xdg/menus/kde-applications-merged" ] ; then + if [ $action = "install" ] && [ x"$mode" = x"user" ] && [ -d "@TERMUX_PREFIX@/etc/xdg/menus/kde-applications-merged" ] ; then # Work around for Fedora Core 5 + patched KDE kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-applications-merged^'` if [ ! -e "$kde_xdg_dir" ] ; then @@ -174,7 +174,7 @@ eval 'ln -s "applications-merged" "$kde_xdg_dir"'$xdg_redirect_output fi fi - if [ $action = "install" ] && [ x"$mode" = x"system" ] && [ -d "/etc/xdg/menus/kde-applications-merged" ] && [ ! -d "/etc/xdg/menus/applications-merged" ] ; then + if [ $action = "install" ] && [ x"$mode" = x"system" ] && [ -d "@TERMUX_PREFIX@/etc/xdg/menus/kde-applications-merged" ] && [ ! -d "@TERMUX_PREFIX@/etc/xdg/menus/applications-merged" ] ; then # Work around for Kubuntu 6.06 kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-applications-merged^'` DEBUG 1 "Kubuntu Workaround: Link '$xdg_dir' to 'kde-applications-merged'" @@ -185,7 +185,7 @@ DEBUG 1 "Updating $orig_menu_file ($action)" - test "${TMPDIR+set}" = set || TMPDIR=/tmp + test "${TMPDIR+set}" = set || TMPDIR=@TERMUX_PREFIX@/tmp tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` orig_desktop_files= if [ -r "$orig_menu_file" ] ; then @@ -235,7 +235,7 @@ if [ -n "$new_desktop_files" ] ; then # Install/update - test "${TMPDIR+set}" = set || TMPDIR=/tmp + test "${TMPDIR+set}" = set || TMPDIR=@TERMUX_PREFIX@/tmp tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` ( echo ' /dev/null 2> /dev/null; then @@ -464,7 +464,7 @@ xdg_user_dir="$xdg_user_dir/$xdg_dir_name" xdg_system_dirs="$XDG_DATA_DIRS" -[ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ +[ -n "$xdg_system_dirs" ] || xdg_system_dirs=@TERMUX_PREFIX@/share/ xdg_global_dir= for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do if [ -w $x/$xdg_dir_name ] ; then @@ -527,7 +527,7 @@ xdg_user_dir="$xdg_user_dir/$xdg_dir_name" xdg_system_dirs="$XDG_DATA_DIRS" -[ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ +[ -n "$xdg_system_dirs" ] || xdg_system_dirs=@TERMUX_PREFIX@/share/ xdg_global_dir= for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do if [ -w $x/$xdg_dir_name ] ; then --- a/scripts/xdg-icon-resource.in +++ b/scripts/xdg-icon-resource.in @@ -37,7 +37,7 @@ [ -n "$GTK_UPDATE_ICON_CACHE" ] && return; GTK_UPDATE_ICON_CACHE="-" - for x in `echo "$PATH:/opt/gnome/bin" | sed 's/:/ /g'`; do + for x in `echo "$PATH:@TERMUX_PREFIX@/opt/gnome/bin" | sed 's/:/ /g'`; do DEBUG 3 "Checking $x for gtk-update-icon-cache" if [ -x "$x/gtk-update-icon-cache" ] ; then DEBUG 1 "Found $x/gtk-update-icon-cache" @@ -222,7 +222,7 @@ xdg_global_dir= xdg_global_prefix= xdg_system_dirs="$XDG_DATA_DIRS" -[ -n "$xdg_system_dirs" ] || xdg_system_dirs="/usr/local/share/:/usr/share/" +[ -n "$xdg_system_dirs" ] || xdg_system_dirs="@TERMUX_PREFIX@/local/share/:@TERMUX_PREFIX@/share/" for x in `echo "$xdg_system_dirs" | sed 's/:/ /g'`; do if [ -w "$x/$xdg_dir_name" ] ; then xdg_global_prefix="$x/icons" --- a/scripts/xdg-mime.in +++ b/scripts/xdg-mime.in @@ -50,7 +50,7 @@ fi old_ifs="$IFS" IFS=: - for x in $PATH /opt/gnome/bin ; do + for x in $PATH @TERMUX_PREFIX@/opt/gnome/bin ; do IFS="$old_ifs" if [ -x "$x/update-mime-database" ] ; then DEBUG 1 "Running $x/update-mime-database $1" @@ -133,7 +133,7 @@ mimetype --brief --dereference "$1" else DEBUG 1 "Running file --brief --dereference --mime-type \"$1\"" - /usr/bin/file --brief --dereference --mime-type "$1" 2> /dev/null + @TERMUX_PREFIX@/bin/file --brief --dereference --mime-type "$1" 2> /dev/null fi if [ $? -eq 0 ]; then @@ -377,7 +377,7 @@ [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" xdg_system_dirs="$XDG_DATA_DIRS" - [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ + [ -n "$xdg_system_dirs" ] || xdg_system_dirs=@TERMUX_PREFIX@/share/ preference=-1 desktop_file="" @@ -463,11 +463,11 @@ [ -n "$xdg_config_home" ] || xdg_config_home="$HOME/.config" #shellcheck disable=SC2153 # not misspelled xdg_config_dirs="$XDG_CONFIG_DIRS" - [ -n "$xdg_config_dirs" ] || xdg_config_dirs="/etc/xdg" + [ -n "$xdg_config_dirs" ] || xdg_config_dirs="@TERMUX_PREFIX@/etc/xdg" xdg_user_dir="$XDG_DATA_HOME" [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" xdg_system_dirs="$XDG_DATA_DIRS" - [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ + [ -n "$xdg_system_dirs" ] || xdg_system_dirs=@TERMUX_PREFIX@/share/ local oldifs dir @@ -684,7 +684,7 @@ detectDE if [ x"$DE" = x"" ]; then - if [ -x /usr/bin/file ]; then + if [ -x @TERMUX_PREFIX@/bin/file ]; then DE=generic fi fi @@ -810,7 +810,7 @@ xdg_user_dir="$xdg_user_dir/$xdg_dir_name" xdg_system_dirs="$XDG_DATA_DIRS" -[ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ +[ -n "$xdg_system_dirs" ] || xdg_system_dirs=@TERMUX_PREFIX@/share/ old_ifs="$IFS" IFS=: @@ -849,7 +849,7 @@ # TODO: Gnome legacy support # See http://forums.fedoraforum.org/showthread.php?t=26875 gnome_user_dir="$HOME/.gnome/apps" -gnome_global_dir=/usr/share/gnome/apps +gnome_global_dir=@TERMUX_PREFIX@/share/gnome/apps [ -w $gnome_global_dir ] || gnome_global_dir= DEBUG 3 "gnome_user_dir: $gnome_user_dir" DEBUG 3 "gnome_global_dir: $gnome_global_dir" --- a/scripts/xdg-open.in +++ b/scripts/xdg-open.in @@ -113,8 +113,8 @@ file=${file%%#*} file=${file%%\?*} local printf=printf - if [ -x /usr/bin/printf ]; then - printf=/usr/bin/printf + if [ -x @TERMUX_PREFIX@/bin/printf ]; then + printf=@TERMUX_PREFIX@/bin/printf fi file=$($printf "$(echo "$file" | sed -e 's@%\([a-f0-9A-F]\{2\}\)@\\x\1@g')") fi @@ -398,7 +398,7 @@ [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" xdg_system_dirs="$XDG_DATA_DIRS" - [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ + [ -n "$xdg_system_dirs" ] || xdg_system_dirs=@TERMUX_PREFIX@/share/ search_dirs="$xdg_user_dir:$xdg_system_dirs" DEBUG 3 "$search_dirs" --- a/scripts/xdg-screensaver.in +++ b/scripts/xdg-screensaver.in @@ -31,7 +31,7 @@ # We can securely move files in /tmp with mv -T DEBUG 1 "mv -T available" MV="mv -T" - screensaver_file="/tmp/xdg-screensaver-$USER-"`echo $DISPLAY | sed 's/:/-/g'` + screensaver_file="@TERMUX_PREFIX@/tmp/xdg-screensaver-$USER-"`echo $DISPLAY | sed 's/:/-/g'` else # No secure moves available, use home dir DEBUG 1 "mv -T not available" @@ -131,7 +131,7 @@ if [ -n "$DISPLAY" ] && [ "$1" = "suspend" ] ; then # Save DPMS state if xset -q | grep 'DPMS is Enabled' > /dev/null 2> /dev/null; then - test "${TMPDIR+set}" = set || TMPDIR=/tmp + test "${TMPDIR+set}" = set || TMPDIR=@TERMUX_PREFIX@/tmp tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` $MV "$tmpfile" "$screensaver_file.dpms" # Disable DPMS @@ -144,7 +144,7 @@ cleanup_suspend() { lockfile - test "${TMPDIR+set}" = set || TMPDIR=/tmp + test "${TMPDIR+set}" = set || TMPDIR=@TERMUX_PREFIX@/tmp tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` grep -v "$window_id:$xprop_pid\$" "$screensaver_file" > "$tmpfile" 2> /dev/null $MV "$tmpfile" "$screensaver_file" @@ -196,7 +196,7 @@ fi lockfile - test "${TMPDIR+set}" = set || TMPDIR=/tmp + test "${TMPDIR+set}" = set || TMPDIR=@TERMUX_PREFIX@/tmp tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` # Filter stale entries from the xdg-screensaver status file # Return if $window_id is being tracked already @@ -420,7 +420,7 @@ screensaver_suspend_loop() { lockfile - test "${TMPDIR+set}" = set || TMPDIR=/tmp + test "${TMPDIR+set}" = set || TMPDIR=@TERMUX_PREFIX@/tmp tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` # Filter stale entries from the xdg-screensaver status file cat "$screensaver_file" 2> /dev/null | ( --- a/scripts/xdg-settings.in +++ b/scripts/xdg-settings.in @@ -472,7 +472,7 @@ get_browser_xfce() { - search="${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-/etc/xdg}" + search="${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-@TERMUX_PREFIX@/etc/xdg}" IFS=: for dir in $search; do unset IFS @@ -505,7 +505,7 @@ # "Type" must be "X-XFCE-Helper" # "X-XFCE-Category" must be "WebBrowser" (for web browsers, anyway) # "X-XFCE-Commands" and "X-XFCE-CommandsWithParameter" must be set - search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-@TERMUX_PREFIX@/share}" IFS=: for dir in $search; do unset IFS --- a/scripts/xdg-utils-common.in +++ b/scripts/xdg-utils-common.in @@ -24,7 +24,7 @@ # map a binary to a .desktop file binary_to_desktop_file() { - search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-@TERMUX_PREFIX@/share}" binary="$(command -v "$1")" binary="$(xdg_realpath "$binary")" base="$(basename "$binary")" @@ -54,7 +54,7 @@ # map a .desktop file to a binary desktop_file_to_binary() { - search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-@TERMUX_PREFIX@/share}" desktop="$(basename "$1")" IFS=: for dir in $search; do