OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 #--------------------------------------------- | 2 #--------------------------------------------- |
3 # xdg-desktop-icon | 3 # xdg-desktop-icon |
4 # | 4 # |
5 # Utility script to install desktop items on a Linux desktop. | 5 # Utility script to install desktop items on a Linux desktop. |
6 # | 6 # |
7 # Refer to the usage() function below for usage. | 7 # Refer to the usage() function below for usage. |
8 # | 8 # |
| 9 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> |
| 10 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> |
9 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> | 11 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> |
10 # Copyright 2006, Jeremy White <jwhite@codeweavers.com> | 12 # Copyright 2006, Jeremy White <jwhite@codeweavers.com> |
11 # | 13 # |
12 # LICENSE: | 14 # LICENSE: |
13 # | 15 # |
14 # Permission is hereby granted, free of charge, to any person obtaining a | 16 # Permission is hereby granted, free of charge, to any person obtaining a |
15 # copy of this software and associated documentation files (the "Software"), | 17 # copy of this software and associated documentation files (the "Software"), |
16 # to deal in the Software without restriction, including without limitation | 18 # to deal in the Software without restriction, including without limitation |
17 # the rights to use, copy, modify, merge, publish, distribute, sublicense, | 19 # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
18 # and/or sell copies of the Software, and to permit persons to whom the | 20 # and/or sell copies of the Software, and to permit persons to whom the |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 if [ "$vendor" = "true" -a "$action" = "install" ] ; then | 491 if [ "$vendor" = "true" -a "$action" = "install" ] ; then |
490 check_vendor_prefix "$desktop_file" | 492 check_vendor_prefix "$desktop_file" |
491 fi | 493 fi |
492 ;; | 494 ;; |
493 *) | 495 *) |
494 filetype=other | 496 filetype=other |
495 ;; | 497 ;; |
496 esac | 498 esac |
497 | 499 |
498 my_umask=077 | 500 my_umask=077 |
| 501 desktop_dir="$HOME/Desktop" |
499 if xdg-user-dir 2>/dev/null 1>&2; then | 502 if xdg-user-dir 2>/dev/null 1>&2; then |
500 desktop_dir=`xdg-user-dir DESKTOP` | 503 desktop_dir=`xdg-user-dir DESKTOP` |
501 fi | 504 fi |
502 desktop_dir_kde=`kde${KDE_SESSION_VERSION}-config --userpath desktop 2> /dev/nul
l` | 505 desktop_dir_kde=`kde${KDE_SESSION_VERSION}-config --userpath desktop 2> /dev/nul
l` |
503 if gconftool-2 -g /apps/nautilus/preferences/desktop_is_home_dir 2> /dev/null |
grep true > /dev/null; then | 506 if gconftool-2 -g /apps/nautilus/preferences/desktop_is_home_dir 2> /dev/null |
grep true > /dev/null; then |
504 desktop_dir_gnome="$HOME" | 507 desktop_dir_gnome="$HOME" |
505 # Don't create $HOME/Desktop if it doesn't exist | 508 # Don't create $HOME/Desktop if it doesn't exist |
506 [ -w "$desktop_dir" ] || desktop_dir= | 509 [ -w "$desktop_dir" ] || desktop_dir= |
507 fi | 510 fi |
508 if [ -n "$desktop_dir_kde" ]; then | 511 if [ -n "$desktop_dir_kde" ]; then |
(...skipping 18 matching lines...) Expand all Loading... |
527 | 530 |
528 case $action in | 531 case $action in |
529 install) | 532 install) |
530 save_umask=`umask` | 533 save_umask=`umask` |
531 umask $my_umask | 534 umask $my_umask |
532 | 535 |
533 for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do | 536 for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do |
534 if [ -n "$x" ]; then | 537 if [ -n "$x" ]; then |
535 mkdir -p "$x" | 538 mkdir -p "$x" |
536 eval 'cp "$desktop_file" "$x/$basefile"'$xdg_redirect_output | 539 eval 'cp "$desktop_file" "$x/$basefile"'$xdg_redirect_output |
| 540 chmod u+x "$x/$basefile" |
537 fi | 541 fi |
538 done | 542 done |
539 | 543 |
540 umask $save_umask | 544 umask $save_umask |
541 ;; | 545 ;; |
542 | 546 |
543 uninstall) | 547 uninstall) |
544 for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do | 548 for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do |
545 if [ -n "$x" ]; then | 549 if [ -n "$x" ]; then |
546 rm -f "$x/$basefile" | 550 rm -f "$x/$basefile" |
547 fi | 551 fi |
548 done | 552 done |
| 553 |
549 ;; | 554 ;; |
550 esac | 555 esac |
551 | 556 |
552 exit_success | 557 exit_success |
553 | 558 |
554 | 559 |
OLD | NEW |