diff options
| -rw-r--r-- | meta/recipes-extended/xdg-utils/xdg-utils/0001-Reinstate-xdg-terminal.patch | 672 | ||||
| -rw-r--r-- | meta/recipes-extended/xdg-utils/xdg-utils_1.1.0-rc1.bb | 5 |
2 files changed, 676 insertions, 1 deletions
diff --git a/meta/recipes-extended/xdg-utils/xdg-utils/0001-Reinstate-xdg-terminal.patch b/meta/recipes-extended/xdg-utils/xdg-utils/0001-Reinstate-xdg-terminal.patch new file mode 100644 index 0000000000..6d5cc2f917 --- /dev/null +++ b/meta/recipes-extended/xdg-utils/xdg-utils/0001-Reinstate-xdg-terminal.patch | |||
| @@ -0,0 +1,672 @@ | |||
| 1 | From 174aa7206f4b308d4d2292bb8067a07d8cc715c0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
| 3 | Date: Tue, 29 Apr 2014 07:29:32 +0200 | ||
| 4 | Subject: [PATCH] Reinstate xdg-terminal | ||
| 5 | |||
| 6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
| 7 | |||
| 8 | Upstream-status: Inappropriate [Revert] | ||
| 9 | --- | ||
| 10 | scripts/Makefile.in | 6 +- | ||
| 11 | scripts/xdg-terminal | 622 +++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 12 | 2 files changed, 625 insertions(+), 3 deletions(-) | ||
| 13 | create mode 100755 scripts/xdg-terminal | ||
| 14 | |||
| 15 | diff --git a/scripts/Makefile.in b/scripts/Makefile.in | ||
| 16 | index 2c7d2ac..bef10d1 100644 | ||
| 17 | --- a/scripts/Makefile.in | ||
| 18 | +++ b/scripts/Makefile.in | ||
| 19 | @@ -20,11 +20,11 @@ SCRIPTS = \ | ||
| 20 | xdg-open \ | ||
| 21 | xdg-email \ | ||
| 22 | xdg-screensaver \ | ||
| 23 | - xdg-settings | ||
| 24 | + xdg-settings \ | ||
| 25 | + xdg-terminal | ||
| 26 | # xdg-su | ||
| 27 | # xdg-copy \ | ||
| 28 | # xdg-file-dialog | ||
| 29 | -# xdg-terminal | ||
| 30 | |||
| 31 | MANPAGES= $(SCRIPTS:%=man/%.1) | ||
| 32 | WEBPAGES= $(SCRIPTS:%=%.html) | ||
| 33 | @@ -42,7 +42,7 @@ release: scripts html man | ||
| 34 | rm -f xdg-*.in *~ HACKING generate-help-script.awk | ||
| 35 | rm -rf desc/ | ||
| 36 | rm -rf xsl/ | ||
| 37 | - rm -f xdg-file-dialog xdg-su xdg-copy xdg-terminal | ||
| 38 | + rm -f xdg-file-dialog xdg-su xdg-copy | ||
| 39 | |||
| 40 | distclean: clean | ||
| 41 | rm -f Makefile | ||
| 42 | diff --git a/scripts/xdg-terminal b/scripts/xdg-terminal | ||
| 43 | new file mode 100755 | ||
| 44 | index 0000000..4bd9205 | ||
| 45 | --- /dev/null | ||
| 46 | +++ b/scripts/xdg-terminal | ||
| 47 | @@ -0,0 +1,622 @@ | ||
| 48 | +#!/bin/sh | ||
| 49 | +#--------------------------------------------- | ||
| 50 | +# xdg-terminal | ||
| 51 | +# | ||
| 52 | +# Utility script to open the registered terminal emulator | ||
| 53 | +# | ||
| 54 | +# Refer to the usage() function below for usage. | ||
| 55 | +# | ||
| 56 | +# Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> | ||
| 57 | +# Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> | ||
| 58 | +# Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> | ||
| 59 | +# | ||
| 60 | +# LICENSE: | ||
| 61 | +# | ||
| 62 | +# Permission is hereby granted, free of charge, to any person obtaining a | ||
| 63 | +# copy of this software and associated documentation files (the "Software"), | ||
| 64 | +# to deal in the Software without restriction, including without limitation | ||
| 65 | +# the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 66 | +# and/or sell copies of the Software, and to permit persons to whom the | ||
| 67 | +# Software is furnished to do so, subject to the following conditions: | ||
| 68 | +# | ||
| 69 | +# The above copyright notice and this permission notice shall be included | ||
| 70 | +# in all copies or substantial portions of the Software. | ||
| 71 | +# | ||
| 72 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
| 73 | +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 74 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 75 | +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 76 | +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 77 | +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 78 | +# OTHER DEALINGS IN THE SOFTWARE. | ||
| 79 | +# | ||
| 80 | +#--------------------------------------------- | ||
| 81 | + | ||
| 82 | +manualpage() | ||
| 83 | +{ | ||
| 84 | +cat << _MANUALPAGE | ||
| 85 | +Name | ||
| 86 | + | ||
| 87 | + xdg-terminal - opens the user's preferred terminal emulator application | ||
| 88 | + | ||
| 89 | +Synopsis | ||
| 90 | + | ||
| 91 | + xdg-terminal [command] | ||
| 92 | + | ||
| 93 | + xdg-terminal { --help | --manual | --version } | ||
| 94 | + | ||
| 95 | +Description | ||
| 96 | + | ||
| 97 | + xdg-terminal opens the user's preferred terminal emulator application. If | ||
| 98 | + a command is provided the command will be executed by the shell within the | ||
| 99 | + newly opened terminal window. | ||
| 100 | + | ||
| 101 | + xdg-terminal is for use inside a desktop session only. It is not | ||
| 102 | + recommended to use xdg-terminal as root. | ||
| 103 | + | ||
| 104 | +Options | ||
| 105 | + | ||
| 106 | + --help | ||
| 107 | + Show command synopsis. | ||
| 108 | + | ||
| 109 | + --manual | ||
| 110 | + Show this manual page. | ||
| 111 | + | ||
| 112 | + --version | ||
| 113 | + Show the xdg-utils version information. | ||
| 114 | + | ||
| 115 | +Exit Codes | ||
| 116 | + | ||
| 117 | + An exit code of 0 indicates success while a non-zero exit code indicates | ||
| 118 | + failure. The following failure codes can be returned: | ||
| 119 | + | ||
| 120 | + 1 | ||
| 121 | + Error in command line syntax. | ||
| 122 | + | ||
| 123 | + 3 | ||
| 124 | + A required tool could not be found. | ||
| 125 | + | ||
| 126 | + 4 | ||
| 127 | + The action failed. | ||
| 128 | + | ||
| 129 | +Examples | ||
| 130 | + | ||
| 131 | + xdg-terminal | ||
| 132 | + | ||
| 133 | + Opens the user's default terminal emulator, just starting an interactive | ||
| 134 | + shell. | ||
| 135 | + | ||
| 136 | + xdg-terminal top | ||
| 137 | + | ||
| 138 | + Opens the user's default terminal emulator and lets it run the top | ||
| 139 | + executable. | ||
| 140 | +_MANUALPAGE | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +usage() | ||
| 144 | +{ | ||
| 145 | +cat << _USAGE | ||
| 146 | + xdg-terminal - opens the user's preferred terminal emulator application | ||
| 147 | + | ||
| 148 | +Synopsis | ||
| 149 | + | ||
| 150 | + xdg-terminal [command] | ||
| 151 | + | ||
| 152 | + xdg-terminal { --help | --manual | --version } | ||
| 153 | + | ||
| 154 | +_USAGE | ||
| 155 | +} | ||
| 156 | + | ||
| 157 | +#@xdg-utils-common@ | ||
| 158 | + | ||
| 159 | +#---------------------------------------------------------------------------- | ||
| 160 | +# Common utility functions included in all XDG wrapper scripts | ||
| 161 | +#---------------------------------------------------------------------------- | ||
| 162 | + | ||
| 163 | +DEBUG() | ||
| 164 | +{ | ||
| 165 | + [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0; | ||
| 166 | + [ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0; | ||
| 167 | + shift | ||
| 168 | + echo "$@" >&2 | ||
| 169 | +} | ||
| 170 | + | ||
| 171 | +# This handles backslashes but not quote marks. | ||
| 172 | +first_word() | ||
| 173 | +{ | ||
| 174 | + read first rest | ||
| 175 | + echo "$first" | ||
| 176 | +} | ||
| 177 | + | ||
| 178 | +#------------------------------------------------------------- | ||
| 179 | +# map a binary to a .desktop file | ||
| 180 | +binary_to_desktop_file() | ||
| 181 | +{ | ||
| 182 | + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" | ||
| 183 | + binary="`which "$1"`" | ||
| 184 | + binary="`readlink -f "$binary"`" | ||
| 185 | + base="`basename "$binary"`" | ||
| 186 | + IFS=: | ||
| 187 | + for dir in $search; do | ||
| 188 | + unset IFS | ||
| 189 | + [ "$dir" ] || continue | ||
| 190 | + [ -d "$dir/applications" ] || [ -d "$dir/applnk" ] || continue | ||
| 191 | + for file in "$dir"/applications/*.desktop "$dir"/applications/*/*.desktop "$dir"/applnk/*.desktop "$dir"/applnk/*/*.desktop; do | ||
| 192 | + [ -r "$file" ] || continue | ||
| 193 | + # Check to make sure it's worth the processing. | ||
| 194 | + grep -q "^Exec.*$base" "$file" || continue | ||
| 195 | + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). | ||
| 196 | + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue | ||
| 197 | + command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" | ||
| 198 | + command="`which "$command"`" | ||
| 199 | + if [ x"`readlink -f "$command"`" = x"$binary" ]; then | ||
| 200 | + # Fix any double slashes that got added path composition | ||
| 201 | + echo "$file" | sed -e 's,//*,/,g' | ||
| 202 | + return | ||
| 203 | + fi | ||
| 204 | + done | ||
| 205 | + done | ||
| 206 | +} | ||
| 207 | + | ||
| 208 | +#------------------------------------------------------------- | ||
| 209 | +# map a .desktop file to a binary | ||
| 210 | +## FIXME: handle vendor dir case | ||
| 211 | +desktop_file_to_binary() | ||
| 212 | +{ | ||
| 213 | + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" | ||
| 214 | + desktop="`basename "$1"`" | ||
| 215 | + IFS=: | ||
| 216 | + for dir in $search; do | ||
| 217 | + unset IFS | ||
| 218 | + [ "$dir" ] && [ -d "$dir/applications" ] || continue | ||
| 219 | + file="$dir/applications/$desktop" | ||
| 220 | + [ -r "$file" ] || continue | ||
| 221 | + # Remove any arguments (%F, %f, %U, %u, etc.). | ||
| 222 | + command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" | ||
| 223 | + command="`which "$command"`" | ||
| 224 | + readlink -f "$command" | ||
| 225 | + return | ||
| 226 | + done | ||
| 227 | +} | ||
| 228 | + | ||
| 229 | +#------------------------------------------------------------- | ||
| 230 | +# Exit script on successfully completing the desired operation | ||
| 231 | + | ||
| 232 | +exit_success() | ||
| 233 | +{ | ||
| 234 | + if [ $# -gt 0 ]; then | ||
| 235 | + echo "$@" | ||
| 236 | + echo | ||
| 237 | + fi | ||
| 238 | + | ||
| 239 | + exit 0 | ||
| 240 | +} | ||
| 241 | + | ||
| 242 | + | ||
| 243 | +#----------------------------------------- | ||
| 244 | +# Exit script on malformed arguments, not enough arguments | ||
| 245 | +# or missing required option. | ||
| 246 | +# prints usage information | ||
| 247 | + | ||
| 248 | +exit_failure_syntax() | ||
| 249 | +{ | ||
| 250 | + if [ $# -gt 0 ]; then | ||
| 251 | + echo "xdg-terminal: $@" >&2 | ||
| 252 | + echo "Try 'xdg-terminal --help' for more information." >&2 | ||
| 253 | + else | ||
| 254 | + usage | ||
| 255 | + echo "Use 'man xdg-terminal' or 'xdg-terminal --manual' for additional info." | ||
| 256 | + fi | ||
| 257 | + | ||
| 258 | + exit 1 | ||
| 259 | +} | ||
| 260 | + | ||
| 261 | +#------------------------------------------------------------- | ||
| 262 | +# Exit script on missing file specified on command line | ||
| 263 | + | ||
| 264 | +exit_failure_file_missing() | ||
| 265 | +{ | ||
| 266 | + if [ $# -gt 0 ]; then | ||
| 267 | + echo "xdg-terminal: $@" >&2 | ||
| 268 | + fi | ||
| 269 | + | ||
| 270 | + exit 2 | ||
| 271 | +} | ||
| 272 | + | ||
| 273 | +#------------------------------------------------------------- | ||
| 274 | +# Exit script on failure to locate necessary tool applications | ||
| 275 | + | ||
| 276 | +exit_failure_operation_impossible() | ||
| 277 | +{ | ||
| 278 | + if [ $# -gt 0 ]; then | ||
| 279 | + echo "xdg-terminal: $@" >&2 | ||
| 280 | + fi | ||
| 281 | + | ||
| 282 | + exit 3 | ||
| 283 | +} | ||
| 284 | + | ||
| 285 | +#------------------------------------------------------------- | ||
| 286 | +# Exit script on failure returned by a tool application | ||
| 287 | + | ||
| 288 | +exit_failure_operation_failed() | ||
| 289 | +{ | ||
| 290 | + if [ $# -gt 0 ]; then | ||
| 291 | + echo "xdg-terminal: $@" >&2 | ||
| 292 | + fi | ||
| 293 | + | ||
| 294 | + exit 4 | ||
| 295 | +} | ||
| 296 | + | ||
| 297 | +#------------------------------------------------------------ | ||
| 298 | +# Exit script on insufficient permission to read a specified file | ||
| 299 | + | ||
| 300 | +exit_failure_file_permission_read() | ||
| 301 | +{ | ||
| 302 | + if [ $# -gt 0 ]; then | ||
| 303 | + echo "xdg-terminal: $@" >&2 | ||
| 304 | + fi | ||
| 305 | + | ||
| 306 | + exit 5 | ||
| 307 | +} | ||
| 308 | + | ||
| 309 | +#------------------------------------------------------------ | ||
| 310 | +# Exit script on insufficient permission to write a specified file | ||
| 311 | + | ||
| 312 | +exit_failure_file_permission_write() | ||
| 313 | +{ | ||
| 314 | + if [ $# -gt 0 ]; then | ||
| 315 | + echo "xdg-terminal: $@" >&2 | ||
| 316 | + fi | ||
| 317 | + | ||
| 318 | + exit 6 | ||
| 319 | +} | ||
| 320 | + | ||
| 321 | +check_input_file() | ||
| 322 | +{ | ||
| 323 | + if [ ! -e "$1" ]; then | ||
| 324 | + exit_failure_file_missing "file '$1' does not exist" | ||
| 325 | + fi | ||
| 326 | + if [ ! -r "$1" ]; then | ||
| 327 | + exit_failure_file_permission_read "no permission to read file '$1'" | ||
| 328 | + fi | ||
| 329 | +} | ||
| 330 | + | ||
| 331 | +check_vendor_prefix() | ||
| 332 | +{ | ||
| 333 | + file_label="$2" | ||
| 334 | + [ -n "$file_label" ] || file_label="filename" | ||
| 335 | + file=`basename "$1"` | ||
| 336 | + case "$file" in | ||
| 337 | + [[:alpha:]]*-*) | ||
| 338 | + return | ||
| 339 | + ;; | ||
| 340 | + esac | ||
| 341 | + | ||
| 342 | + echo "xdg-terminal: $file_label '$file' does not have a proper vendor prefix" >&2 | ||
| 343 | + echo 'A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated' >&2 | ||
| 344 | + echo 'with a dash ("-"). An example '"$file_label"' is '"'example-$file'" >&2 | ||
| 345 | + echo "Use --novendor to override or 'xdg-terminal --manual' for additional info." >&2 | ||
| 346 | + exit 1 | ||
| 347 | +} | ||
| 348 | + | ||
| 349 | +check_output_file() | ||
| 350 | +{ | ||
| 351 | + # if the file exists, check if it is writeable | ||
| 352 | + # if it does not exists, check if we are allowed to write on the directory | ||
| 353 | + if [ -e "$1" ]; then | ||
| 354 | + if [ ! -w "$1" ]; then | ||
| 355 | + exit_failure_file_permission_write "no permission to write to file '$1'" | ||
| 356 | + fi | ||
| 357 | + else | ||
| 358 | + DIR=`dirname "$1"` | ||
| 359 | + if [ ! -w "$DIR" ] || [ ! -x "$DIR" ]; then | ||
| 360 | + exit_failure_file_permission_write "no permission to create file '$1'" | ||
| 361 | + fi | ||
| 362 | + fi | ||
| 363 | +} | ||
| 364 | + | ||
| 365 | +#---------------------------------------- | ||
| 366 | +# Checks for shared commands, e.g. --help | ||
| 367 | + | ||
| 368 | +check_common_commands() | ||
| 369 | +{ | ||
| 370 | + while [ $# -gt 0 ] ; do | ||
| 371 | + parm="$1" | ||
| 372 | + shift | ||
| 373 | + | ||
| 374 | + case "$parm" in | ||
| 375 | + --help) | ||
| 376 | + usage | ||
| 377 | + echo "Use 'man xdg-terminal' or 'xdg-terminal --manual' for additional info." | ||
| 378 | + exit_success | ||
| 379 | + ;; | ||
| 380 | + | ||
| 381 | + --manual) | ||
| 382 | + manualpage | ||
| 383 | + exit_success | ||
| 384 | + ;; | ||
| 385 | + | ||
| 386 | + --version) | ||
| 387 | + echo "xdg-terminal 1.1.0 rc1" | ||
| 388 | + exit_success | ||
| 389 | + ;; | ||
| 390 | + esac | ||
| 391 | + done | ||
| 392 | +} | ||
| 393 | + | ||
| 394 | +check_common_commands "$@" | ||
| 395 | + | ||
| 396 | +[ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; | ||
| 397 | +if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then | ||
| 398 | + # Be silent | ||
| 399 | + xdg_redirect_output=" > /dev/null 2> /dev/null" | ||
| 400 | +else | ||
| 401 | + # All output to stderr | ||
| 402 | + xdg_redirect_output=" >&2" | ||
| 403 | +fi | ||
| 404 | + | ||
| 405 | +#-------------------------------------- | ||
| 406 | +# Checks for known desktop environments | ||
| 407 | +# set variable DE to the desktop environments name, lowercase | ||
| 408 | + | ||
| 409 | +detectDE() | ||
| 410 | +{ | ||
| 411 | + # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 | ||
| 412 | + unset GREP_OPTIONS | ||
| 413 | + | ||
| 414 | + if [ -n "${XDG_CURRENT_DESKTOP}" ]; then | ||
| 415 | + case "${XDG_CURRENT_DESKTOP}" in | ||
| 416 | + ENLIGHTENMENT) | ||
| 417 | + DE=enlightenment; | ||
| 418 | + ;; | ||
| 419 | + GNOME) | ||
| 420 | + DE=gnome; | ||
| 421 | + ;; | ||
| 422 | + KDE) | ||
| 423 | + DE=kde; | ||
| 424 | + ;; | ||
| 425 | + LXDE) | ||
| 426 | + DE=lxde; | ||
| 427 | + ;; | ||
| 428 | + MATE) | ||
| 429 | + DE=mate; | ||
| 430 | + ;; | ||
| 431 | + XFCE) | ||
| 432 | + DE=xfce | ||
| 433 | + ;; | ||
| 434 | + esac | ||
| 435 | + fi | ||
| 436 | + | ||
| 437 | + if [ x"$DE" = x"" ]; then | ||
| 438 | + # classic fallbacks | ||
| 439 | + if [ x"$KDE_FULL_SESSION" != x"" ]; then DE=kde; | ||
| 440 | + elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | ||
| 441 | + elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate; | ||
| 442 | + elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome; | ||
| 443 | + elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce; | ||
| 444 | + elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>&1; then DE=xfce | ||
| 445 | + elif echo $DESKTOP | grep -q '^Enlightenment'; then DE=enlightenment; | ||
| 446 | + fi | ||
| 447 | + fi | ||
| 448 | + | ||
| 449 | + if [ x"$DE" = x"" ]; then | ||
| 450 | + # fallback to checking $DESKTOP_SESSION | ||
| 451 | + case "$DESKTOP_SESSION" in | ||
| 452 | + gnome) | ||
| 453 | + DE=gnome; | ||
| 454 | + ;; | ||
| 455 | + LXDE|Lubuntu) | ||
| 456 | + DE=lxde; | ||
| 457 | + ;; | ||
| 458 | + MATE) | ||
| 459 | + DE=mate; | ||
| 460 | + ;; | ||
| 461 | + xfce|xfce4|'Xfce Session') | ||
| 462 | + DE=xfce; | ||
| 463 | + ;; | ||
| 464 | + esac | ||
| 465 | + fi | ||
| 466 | + | ||
| 467 | + if [ x"$DE" = x"" ]; then | ||
| 468 | + # fallback to uname output for other platforms | ||
| 469 | + case "$(uname 2>/dev/null)" in | ||
| 470 | + Darwin) | ||
| 471 | + DE=darwin; | ||
| 472 | + ;; | ||
| 473 | + esac | ||
| 474 | + fi | ||
| 475 | + | ||
| 476 | + if [ x"$DE" = x"gnome" ]; then | ||
| 477 | + # gnome-default-applications-properties is only available in GNOME 2.x | ||
| 478 | + # but not in GNOME 3.x | ||
| 479 | + which gnome-default-applications-properties > /dev/null 2>&1 || DE="gnome3" | ||
| 480 | + fi | ||
| 481 | +} | ||
| 482 | + | ||
| 483 | +#---------------------------------------------------------------------------- | ||
| 484 | +# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | ||
| 485 | +# It also always returns 1 in KDE 3.4 and earlier | ||
| 486 | +# Simply return 0 in such case | ||
| 487 | + | ||
| 488 | +kfmclient_fix_exit_code() | ||
| 489 | +{ | ||
| 490 | + version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` | ||
| 491 | + major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` | ||
| 492 | + minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` | ||
| 493 | + release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | ||
| 494 | + test "$major" -gt 3 && return $1 | ||
| 495 | + test "$minor" -gt 5 && return $1 | ||
| 496 | + test "$release" -gt 4 && return $1 | ||
| 497 | + return 0 | ||
| 498 | +} | ||
| 499 | + | ||
| 500 | +terminal_kde() | ||
| 501 | +{ | ||
| 502 | + terminal=`kreadconfig --file kdeglobals --group General --key TerminalApplication --default konsole` | ||
| 503 | + | ||
| 504 | + terminal_exec=`which $terminal 2>/dev/null` | ||
| 505 | + | ||
| 506 | + if [ -x "$terminal_exec" ]; then | ||
| 507 | + if [ x"$1" = x"" ]; then | ||
| 508 | + $terminal_exec | ||
| 509 | + else | ||
| 510 | + $terminal_exec -e "$1" | ||
| 511 | + fi | ||
| 512 | + | ||
| 513 | + if [ $? -eq 0 ]; then | ||
| 514 | + exit_success | ||
| 515 | + else | ||
| 516 | + exit_failure_operation_failed | ||
| 517 | + fi | ||
| 518 | + else | ||
| 519 | + exit_failure_operation_impossible "configured terminal program '$terminal' not found or not executable" | ||
| 520 | + fi | ||
| 521 | +} | ||
| 522 | + | ||
| 523 | +terminal_gnome() | ||
| 524 | +{ | ||
| 525 | + term_exec_key="/desktop/gnome/applications/terminal/exec" | ||
| 526 | + term_exec_arg_key="/desktop/gnome/applications/terminal/exec_arg" | ||
| 527 | + | ||
| 528 | + term_exec=`gconftool-2 --get ${term_exec_key}` | ||
| 529 | + term_exec_arg=`gconftool-2 --get ${term_exec_arg_key}` | ||
| 530 | + | ||
| 531 | + terminal_exec=`which $term_exec 2>/dev/null` | ||
| 532 | + | ||
| 533 | + if [ -x "$terminal_exec" ]; then | ||
| 534 | + if [ x"$1" = x"" ]; then | ||
| 535 | + $terminal_exec | ||
| 536 | + else | ||
| 537 | + if [ x"$term_exec_arg" = x"" ]; then | ||
| 538 | + $terminal_exec "$1" | ||
| 539 | + else | ||
| 540 | + $terminal_exec "$term_exec_arg" "$1" | ||
| 541 | + fi | ||
| 542 | + fi | ||
| 543 | + | ||
| 544 | + if [ $? -eq 0 ]; then | ||
| 545 | + exit_success | ||
| 546 | + else | ||
| 547 | + exit_failure_operation_failed | ||
| 548 | + fi | ||
| 549 | + else | ||
| 550 | + exit_failure_operation_impossible "configured terminal program '$term_exec' not found or not executable" | ||
| 551 | + fi | ||
| 552 | +} | ||
| 553 | + | ||
| 554 | +terminal_xfce() | ||
| 555 | +{ | ||
| 556 | + if [ x"$1" = x"" ]; then | ||
| 557 | + exo-open --launch TerminalEmulator | ||
| 558 | + else | ||
| 559 | + exo-open --launch TerminalEmulator "$1" | ||
| 560 | + fi | ||
| 561 | + | ||
| 562 | + if [ $? -eq 0 ]; then | ||
| 563 | + exit_success | ||
| 564 | + else | ||
| 565 | + exit_failure_operation_failed | ||
| 566 | + fi | ||
| 567 | +} | ||
| 568 | + | ||
| 569 | +terminal_generic() | ||
| 570 | +{ | ||
| 571 | + # if $TERM is a known non-command, use hard-coded fallbacks | ||
| 572 | + if [ x"$TERM" = x"" ] || [ x"$TERM" = x"linux" ] || [ x"$TERM" = x"vt100" ]; then | ||
| 573 | + TERM=xterm | ||
| 574 | + fi | ||
| 575 | + | ||
| 576 | + terminal_exec=`which $TERM 2>/dev/null` | ||
| 577 | + | ||
| 578 | + if [ -x "$terminal_exec" ]; then | ||
| 579 | + if [ x"$1" = x"" ]; then | ||
| 580 | + $terminal_exec | ||
| 581 | + else | ||
| 582 | + # screen and urxvt won't do their own parsing of quoted arguments | ||
| 583 | + if [ x"$TERM" = x"screen" ]; then | ||
| 584 | + # screen has an incompatible meaning for -e | ||
| 585 | + sh -c "exec $terminal_exec $1" | ||
| 586 | + elif [ x"$TERM" = x"urxvt" ] || [ x"$TERM" = x"rxvt-unicode" ] || [ x"$TERM" = x"rxvt" ]; then | ||
| 587 | + #TODO: Use whatever mechanism dash supports to test for | ||
| 588 | + # rxvt-* to match things like rxvt-unicode-256color | ||
| 589 | + sh -c "exec $terminal_exec -e $1" | ||
| 590 | + else | ||
| 591 | + $terminal_exec -e "$1" | ||
| 592 | + fi | ||
| 593 | + fi | ||
| 594 | + | ||
| 595 | + if [ $? -eq 0 ]; then | ||
| 596 | + exit_success | ||
| 597 | + else | ||
| 598 | + exit_failure_operation_failed | ||
| 599 | + fi | ||
| 600 | + else | ||
| 601 | + exit_failure_operation_impossible "configured terminal program '$TERM' not found or not executable" | ||
| 602 | + fi | ||
| 603 | +} | ||
| 604 | + | ||
| 605 | +terminal_lxde() | ||
| 606 | +{ | ||
| 607 | + if which lxterminal &>/dev/null; then | ||
| 608 | + if [ x"$1" = x"" ]; then | ||
| 609 | + lxterminal | ||
| 610 | + else | ||
| 611 | + lxterminal -e "$1" | ||
| 612 | + fi | ||
| 613 | + else | ||
| 614 | + terminal_generic "$1" | ||
| 615 | + fi | ||
| 616 | +} | ||
| 617 | + | ||
| 618 | +#[ x"$1" != x"" ] || exit_failure_syntax | ||
| 619 | + | ||
| 620 | +command= | ||
| 621 | +while [ $# -gt 0 ] ; do | ||
| 622 | + parm="$1" | ||
| 623 | + shift | ||
| 624 | + | ||
| 625 | + case "$parm" in | ||
| 626 | + -*) | ||
| 627 | + exit_failure_syntax "unexpected option '$parm'" | ||
| 628 | + ;; | ||
| 629 | + | ||
| 630 | + *) | ||
| 631 | + if [ -n "$command" ] ; then | ||
| 632 | + exit_failure_syntax "unexpected argument '$parm'" | ||
| 633 | + fi | ||
| 634 | + command="$parm" | ||
| 635 | + ;; | ||
| 636 | + esac | ||
| 637 | +done | ||
| 638 | + | ||
| 639 | +detectDE | ||
| 640 | + | ||
| 641 | +if [ x"$DE" = x"" ]; then | ||
| 642 | + DE=generic | ||
| 643 | +fi | ||
| 644 | + | ||
| 645 | +case "$DE" in | ||
| 646 | + kde) | ||
| 647 | + terminal_kde "$command" | ||
| 648 | + ;; | ||
| 649 | + | ||
| 650 | + gnome*) | ||
| 651 | + terminal_gnome "$command" | ||
| 652 | + ;; | ||
| 653 | + | ||
| 654 | + xfce) | ||
| 655 | + terminal_xfce "$command" | ||
| 656 | + ;; | ||
| 657 | + | ||
| 658 | + lxde) | ||
| 659 | + terminal_lxde "$command" | ||
| 660 | + ;; | ||
| 661 | + | ||
| 662 | + generic) | ||
| 663 | + terminal_generic "$command" | ||
| 664 | + ;; | ||
| 665 | + | ||
| 666 | + *) | ||
| 667 | + exit_failure_operation_impossible "no terminal emulator available" | ||
| 668 | + ;; | ||
| 669 | +esac | ||
| 670 | -- | ||
| 671 | 1.9.0 | ||
| 672 | |||
diff --git a/meta/recipes-extended/xdg-utils/xdg-utils_1.1.0-rc1.bb b/meta/recipes-extended/xdg-utils/xdg-utils_1.1.0-rc1.bb index 79698791bc..2ac979b0b9 100644 --- a/meta/recipes-extended/xdg-utils/xdg-utils_1.1.0-rc1.bb +++ b/meta/recipes-extended/xdg-utils/xdg-utils_1.1.0-rc1.bb | |||
| @@ -11,12 +11,15 @@ xdg-icon-resource \ | |||
| 11 | xdg-mime \ | 11 | xdg-mime \ |
| 12 | xdg-open \ | 12 | xdg-open \ |
| 13 | xdg-screensaver \ | 13 | xdg-screensaver \ |
| 14 | xdg-terminal \ | ||
| 14 | " | 15 | " |
| 15 | 16 | ||
| 16 | LICENSE = "MIT" | 17 | LICENSE = "MIT" |
| 17 | LIC_FILES_CHKSUM = "file://LICENSE;md5=a5367a90934098d6b05af3b746405014" | 18 | LIC_FILES_CHKSUM = "file://LICENSE;md5=a5367a90934098d6b05af3b746405014" |
| 18 | 19 | ||
| 19 | SRC_URI = "http://portland.freedesktop.org/download/${BPN}-${PV}.tar.gz" | 20 | SRC_URI = "http://portland.freedesktop.org/download/${BPN}-${PV}.tar.gz \ |
| 21 | file://0001-Reinstate-xdg-terminal.patch \ | ||
| 22 | " | ||
| 20 | 23 | ||
| 21 | SRC_URI[md5sum] = "fadf5e7a08e0526fc60dbe3e5b7ef8d6" | 24 | SRC_URI[md5sum] = "fadf5e7a08e0526fc60dbe3e5b7ef8d6" |
| 22 | SRC_URI[sha256sum] = "7b05558ae4bb8ede356863cae8c42e3e012aa421bf9d45130a570fd209d79102" | 25 | SRC_URI[sha256sum] = "7b05558ae4bb8ede356863cae8c42e3e012aa421bf9d45130a570fd209d79102" |
