Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: third_party/xdg-utils/scripts/xdg-desktop-menu

Issue 3273010: Update our copy of xdg-utils to 2010-08-30, and include a patched xdg-mime. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 #--------------------------------------------- 2 #---------------------------------------------
3 # xdg-desktop-menu 3 # xdg-desktop-menu
4 # 4 #
5 # Utility script to install menu items on a Linux desktop. 5 # Utility script to install menu items on a Linux desktop.
6 # Refer to the usage() function below for usage. 6 # Refer to the usage() function below for usage.
7 # 7 #
8 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> 8 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
9 # Copyright 2006, Jeremy White <jwhite@codeweavers.com> 9 # Copyright 2006, Jeremy White <jwhite@codeweavers.com>
10 # 10 #
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 exit_failure_file_permission_read() 490 exit_failure_file_permission_read()
491 { 491 {
492 if [ $# -gt 0 ]; then 492 if [ $# -gt 0 ]; then
493 echo "xdg-desktop-menu: $@" >&2 493 echo "xdg-desktop-menu: $@" >&2
494 fi 494 fi
495 495
496 exit 5 496 exit 5
497 } 497 }
498 498
499 #------------------------------------------------------------ 499 #------------------------------------------------------------
500 # Exit script on insufficient permission to read a specified file 500 # Exit script on insufficient permission to write a specified file
501 501
502 exit_failure_file_permission_write() 502 exit_failure_file_permission_write()
503 { 503 {
504 if [ $# -gt 0 ]; then 504 if [ $# -gt 0 ]; then
505 echo "xdg-desktop-menu: $@" >&2 505 echo "xdg-desktop-menu: $@" >&2
506 fi 506 fi
507 507
508 exit 6 508 exit 6
509 } 509 }
510 510
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 echo "Use 'man xdg-desktop-menu' or 'xdg-desktop-menu --manual' for additional info." 567 echo "Use 'man xdg-desktop-menu' or 'xdg-desktop-menu --manual' for additional info."
568 exit_success 568 exit_success
569 ;; 569 ;;
570 570
571 --manual) 571 --manual)
572 manualpage 572 manualpage
573 exit_success 573 exit_success
574 ;; 574 ;;
575 575
576 --version) 576 --version)
577 echo "xdg-desktop-menu 1.0.1" 577 echo "xdg-desktop-menu 1.0.2"
578 exit_success 578 exit_success
579 ;; 579 ;;
580 esac 580 esac
581 done 581 done
582 } 582 }
583 583
584 check_common_commands "$@" 584 check_common_commands "$@"
585 585
586 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; 586 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL;
587 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then 587 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then
588 # Be silent 588 # Be silent
589 xdg_redirect_output=" > /dev/null 2> /dev/null" 589 xdg_redirect_output=" > /dev/null 2> /dev/null"
590 else 590 else
591 # All output to stderr 591 # All output to stderr
592 xdg_redirect_output=" >&2" 592 xdg_redirect_output=" >&2"
593 fi 593 fi
594 594
595 #-------------------------------------- 595 #--------------------------------------
596 # Checks for known desktop environments 596 # Checks for known desktop environments
597 # set variable DE to the desktop environments name, lowercase 597 # set variable DE to the desktop environments name, lowercase
598 598
599 detectDE() 599 detectDE()
600 { 600 {
601 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; 601 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
602 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; 602 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
603 elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce; 603 elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/D Bus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/nul l 2>&1` ; then DE=gnome;
604 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul l 2>&1; then DE=xfce;
604 fi 605 fi
605 } 606 }
606 607
607 #---------------------------------------------------------------------------- 608 #----------------------------------------------------------------------------
608 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 609 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
609 # It also always returns 1 in KDE 3.4 and earlier 610 # It also always returns 1 in KDE 3.4 and earlier
610 # Simply return 0 in such case 611 # Simply return 0 in such case
611 612
612 kfmclient_fix_exit_code() 613 kfmclient_fix_exit_code()
613 { 614 {
(...skipping 14 matching lines...) Expand all
628 for x in `echo $PATH | sed 's/:/ /g'` /opt/gnome/bin; do 629 for x in `echo $PATH | sed 's/:/ /g'` /opt/gnome/bin; do
629 if [ -x $x/update-desktop-database ] ; then 630 if [ -x $x/update-desktop-database ] ; then
630 DEBUG 1 "Running $x/update-desktop-database" 631 DEBUG 1 "Running $x/update-desktop-database"
631 eval '$x/update-desktop-database'$xdg_redirect_output 632 eval '$x/update-desktop-database'$xdg_redirect_output
632 return 633 return
633 fi 634 fi
634 done 635 done
635 fi 636 fi
636 } 637 }
637 638
638 fixup_mandriva_categories()
639 {
640 DEBUG 1 "fixup_mandriva_categories $1"
641 awk '
642 BEGIN {
643 xlat["AudioVideo"]="X-Mandrakelinux-Multimedia;X-MandrivaLinux-Multimedia"
644 xlat["Development"]="X-Mandrakelinux-MoreApplications-Development;X-Mandriva Linux-MoreApplications-Development"
645 xlat["Education"]="X-Mandrakelinux-MoreApplications;X-MandrivaLinux-MoreAppl ications-Education"
646 xlat["Game"]="X-Mandrakelinux-MoreApplications;X-MandrivaLinux-MoreApplicati ons-Games"
647 xlat["Graphics"]="X-Mandrakelinux-Multimedia-Graphics"
648 xlat["Network"]="X-Mandrakelinux-Internet;X-MandrivaLinux-Internet"
649 xlat["Office"]="X-Mandrakelinux-Office;X-MandrivaLinux-Office"
650 xlat["System"]="X-Mandrakelinux-System;X-MandrivaLinux-System"
651 xlat["Utility"]="X-Mandrakelinux-Office-Accessories;X-MandrivaLinux-Office-A ccessories"
652 }
653 {
654 if (match($0,/Categories=/)) {
655 split(substr($0,RSTART+11),categories,";")
656 result=""
657 for (n in categories)
658 {
659 if (categories[n] in xlat)
660 categories[n]=categories[n] ";" xlat[categories[n]]
661 if (categories[n])
662 result=result categories[n] ";"
663 }
664 print "Categories=" result
665 }
666 else
667 {
668 print $0
669 }
670 }' $1 > $1.new
671 mv $1.new $1
672 }
673
674 # Make application $1/$2 the default for all the mimetypes it support, 639 # Make application $1/$2 the default for all the mimetypes it support,
675 # iff such mimetype didn't had a default application already. 640 # iff such mimetype didn't had a default application already.
676 # $1 Install dir for desktop file 641 # $1 Install dir for desktop file
677 # $2 base name of desktop file 642 # $2 base name of desktop file
678 make_lazy_default() 643 make_lazy_default()
679 { 644 {
680 local mimetypes 645 local mimetypes
681 local xdg_user_dir 646 local xdg_user_dir
682 local xdg_default_dirs 647 local xdg_default_dirs
683 648
684 DEBUG 1 "make_lazy_default $1/$2" 649 DEBUG 1 "make_lazy_default $1/$2"
685 mimetypes=`awk ' 650 mimetypes=`awk '
686 { 651 {
687 if (match($0,/MimeType=/)) { 652 if (match($0,/MimeType=/)) {
688 split(substr($0,RSTART+9),mimetypes,";") 653 split(substr($0,RSTART+9),mimetypes,";")
689 for (n in mimetypes) 654 for (n in mimetypes)
690 { 655 {
691 if (mimetypes[n]) 656 if (mimetypes[n])
692 print mimetypes[n] 657 print mimetypes[n]
693 } 658 }
694 } 659 }
695 }' "$1/$2" 2> /dev/null` 660 }' "$1/$2" 2> /dev/null`
696 661
697 for MIME in $mimetypes ; do 662 for MIME in $mimetypes ; do
698 xdg_default_dirs="$XDG_DATA_DIRS" 663 xdg_default_dirs="$XDG_DATA_DIRS"
699 [ -n "$xdg_default_dirs" ] || xdg_default_dirs=/usr/local/share/:/usr/sh are/ 664 [ -n "$xdg_default_dirs" ] || xdg_default_dirs=/usr/local/share/:/usr/sh are/
700 if [ x"$mode" = x"user" ] ; then 665 if [ x"$mode" = x"user" ] ; then
701 xdg_user_dir="$XDG_DATA_HOME" 666 xdg_user_dir="$XDG_DATA_HOME"
702 [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" 667 [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
703 xdg_default_dirs="$xdg_user_dir:$xdg_default_dirs" 668 xdg_default_dirs="$xdg_user_dir:$xdg_default_dirs"
704 fi 669 fi
705 local default_app 670 local default_app
706 for x in `echo "$xdg_default_dirs" | sed 's/:/ /g'`; do 671 for x in `echo "$xdg_default_dirs" | sed 's/:/ /g'`; do
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 xdg_global_dir= 708 xdg_global_dir=
744 for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do 709 for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
745 if [ -w $x/$xdg_dir_name ] ; then 710 if [ -w $x/$xdg_dir_name ] ; then
746 xdg_global_dir="$x/$xdg_dir_name" 711 xdg_global_dir="$x/$xdg_dir_name"
747 break 712 break
748 fi 713 fi
749 done 714 done
750 xdg_user_dir="$xdg_user_dir/applications-merged" 715 xdg_user_dir="$xdg_user_dir/applications-merged"
751 xdg_global_dir="$xdg_global_dir/applications-merged" 716 xdg_global_dir="$xdg_global_dir/applications-merged"
752 717
753 DEBUG 3 "Install locations for *.menu file:" 718 DEBUG 3 "Install locations for *.menu file:"
754 DEBUG 3 "xdg_user_dir: $xdg_user_dir" 719 DEBUG 3 "xdg_user_dir: $xdg_user_dir"
755 DEBUG 3 "xdg_global_dir: $xdg_global_dir" 720 DEBUG 3 "xdg_global_dir: $xdg_global_dir"
756 DEBUG 3 "kde_user_dir: $kde_user_dir" 721 DEBUG 3 "kde_user_dir: $kde_user_dir"
757 DEBUG 3 "kde_global_dir: $kde_global_dir" 722 DEBUG 3 "kde_global_dir: $kde_global_dir"
758 DEBUG 3 "gnome_user_dir: $gnome_user_dir" 723 DEBUG 3 "gnome_user_dir: $gnome_user_dir"
759 DEBUG 3 "gnome_global_dir: $gnome_global_dir" 724 DEBUG 3 "gnome_global_dir: $gnome_global_dir"
760 725
761 if [ x"$mode" = x"user" ] ; then 726 if [ x"$mode" = x"user" ] ; then
762 xdg_dir="$xdg_user_dir" 727 xdg_dir="$xdg_user_dir"
763 kde_dir="$kde_user_dir" 728 kde_dir="$kde_user_dir"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 fi 771 fi
807 fi 772 fi
808 if [ $action = "install" -a x"$mode" = x"user" -a -d "/etc/xdg/menus/kde-app lications-merged" ] ; then 773 if [ $action = "install" -a x"$mode" = x"user" -a -d "/etc/xdg/menus/kde-app lications-merged" ] ; then
809 # Work around for Fedora Core 5 + patched KDE 774 # Work around for Fedora Core 5 + patched KDE
810 kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-appli cations-merged^'` 775 kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-appli cations-merged^'`
811 if [ ! -e "$kde_xdg_dir" ] ; then 776 if [ ! -e "$kde_xdg_dir" ] ; then
812 DEBUG 1 "Fedora Workaround: Link '$xdg_dir' to '$kde_xdg_dir'" 777 DEBUG 1 "Fedora Workaround: Link '$xdg_dir' to '$kde_xdg_dir'"
813 mkdir -p `dirname "$kde_xdg_dir"` 778 mkdir -p `dirname "$kde_xdg_dir"`
814 eval 'ln -s "applications-merged" "$kde_xdg_dir"'$xdg_redirect_outpu t 779 eval 'ln -s "applications-merged" "$kde_xdg_dir"'$xdg_redirect_outpu t
815 fi 780 fi
816 fi 781 fi
817 if [ $action = "install" -a x"$mode" = x"system" -a -d "/etc/xdg/menus/kde-a pplications-merged" -a ! -d "/etc/xdg/menus/applications-merged" ] ; then 782 if [ $action = "install" -a x"$mode" = x"system" -a -d "/etc/xdg/menus/kde-a pplications-merged" -a ! -d "/etc/xdg/menus/applications-merged" ] ; then
818 # Work around for Kubuntu 6.06 783 # Work around for Kubuntu 6.06
819 kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-appli cations-merged^'` 784 kde_xdg_dir=`echo "$xdg_dir" | sed -e 's^/applications-merged^/kde-appli cations-merged^'`
820 DEBUG 1 "Kubuntu Workaround: Link '$xdg_dir' to 'kde-applications-merged '" 785 DEBUG 1 "Kubuntu Workaround: Link '$xdg_dir' to 'kde-applications-merged '"
821 eval 'ln -s "kde-applications-merged" "$xdg_dir"'$xdg_redirect_output 786 eval 'ln -s "kde-applications-merged" "$xdg_dir"'$xdg_redirect_output
822 fi 787 fi
823 788
824 orig_menu_file=$xdg_dir/$menu_file 789 orig_menu_file=$xdg_dir/$menu_file
825 790
826 DEBUG 1 "Updating $orig_menu_file ($action)" 791 DEBUG 1 "Updating $orig_menu_file ($action)"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 # Files to uninstall are listed in $tmpfile 826 # Files to uninstall are listed in $tmpfile
862 # Existing files are in $orig_desktop_files 827 # Existing files are in $orig_desktop_files
863 for desktop_file in $orig_desktop_files; do 828 for desktop_file in $orig_desktop_files; do
864 if ! grep '^'$desktop_file'$' $tmpfile > /dev/null 2> /dev/null; the n 829 if ! grep '^'$desktop_file'$' $tmpfile > /dev/null 2> /dev/null; the n
865 # Keep this file, it's not in the uninstall list 830 # Keep this file, it's not in the uninstall list
866 new_desktop_files="$new_desktop_files $desktop_file" 831 new_desktop_files="$new_desktop_files $desktop_file"
867 fi 832 fi
868 done 833 done
869 fi 834 fi
870 rm -f "$tmpfile" 835 rm -f "$tmpfile"
871 836
872 DEBUG 3 "Files to list in $menu_file: $new_desktop_files" 837 DEBUG 3 "Files to list in $menu_file: $new_desktop_files"
873 838
874 if [ -n "$new_desktop_files" ] ; then 839 if [ -n "$new_desktop_files" ] ; then
875 # Install/update 840 # Install/update
876 test "${TMPDIR+set}" = set || TMPDIR=/tmp 841 test "${TMPDIR+set}" = set || TMPDIR=/tmp
877 tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` 842 tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
878 ( 843 (
879 echo '<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"' 844 echo '<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"'
880 echo ' "http://www.freedesktop.org/standards/menu-spec/menu-1.0.d td">' 845 echo ' "http://www.freedesktop.org/standards/menu-spec/menu-1.0.d td">'
881 echo '<!-- Do not edit manually - generated and managed by xdg-deskt op-menu -->' 846 echo '<!-- Do not edit manually - generated and managed by xdg-deskt op-menu -->'
882 echo '<Menu>' 847 echo '<Menu>'
883 echo ' <Name>Applications</Name>' 848 echo ' <Name>Applications</Name>'
884 849
885 for desktop_file in $directory_files; do 850 for desktop_file in $directory_files; do
886 basefile=`basename "$desktop_file"` 851 basefile=`basename "$desktop_file"`
887 basefilename=`echo "$basefile"|cut -d '.' -f 1` 852 basefilename=`echo "$basefile"|cut -d '.' -f 1`
888 echo "<Menu>" 853 echo "<Menu>"
889 echo " <Name>$basefilename</Name>" 854 echo " <Name>$basefilename</Name>"
890 echo " <Directory>$basefile</Directory>" 855 echo " <Directory>$basefile</Directory>"
891 done 856 done
892 857
893 echo " <Include>" 858 echo " <Include>"
894 for desktop_file in $new_desktop_files; do 859 for desktop_file in $new_desktop_files; do
895 echo " <Filename>$desktop_file</Filename>" 860 echo " <Filename>$desktop_file</Filename>"
896 done 861 done
897 echo " </Include>" 862 echo " </Include>"
898 863
899 for desktop_file in $directory_files; do 864 for desktop_file in $directory_files; do
900 echo "</Menu>" 865 echo "</Menu>"
901 done 866 done
902 867
903 echo '</Menu>' 868 echo '</Menu>'
904 ) > $tmpfile 869 ) > $tmpfile
905 chmod $my_chmod $tmpfile 870 chmod $my_chmod $tmpfile
906 871
907 save_umask=`umask` 872 save_umask=`umask`
908 umask $my_umask 873 umask $my_umask
909 874
910 mkdir -p $xdg_dir 875 mkdir -p $xdg_dir
911 eval 'cp $tmpfile $xdg_dir/$menu_file'$xdg_redirect_output 876 eval 'cp $tmpfile $xdg_dir/$menu_file'$xdg_redirect_output
912 877
913 umask $save_umask 878 umask $save_umask
914 rm -f "$tmpfile" 879 rm -f "$tmpfile"
915 else 880 else
916 # Uninstall 881 # Uninstall
917 rm -f $xdg_dir/$menu_file 882 rm -f $xdg_dir/$menu_file
918 fi 883 fi
919 884
920 # Uninstall .directory files only if no longer referenced 885 # Uninstall .directory files only if no longer referenced
921 if [ $action = "uninstall" ] ; then 886 if [ $action = "uninstall" ] ; then
922 test "${TMPDIR+set}" = set || TMPDIR=/tmp 887 test "${TMPDIR+set}" = set || TMPDIR=/tmp
923 tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX` 888 tmpfile=`mktemp $TMPDIR/tmp.XXXXXXXXXX`
924 for menu_file in $xdg_dir/*; do 889 for menu_file in $xdg_dir/*; do
925 if grep 'generated and managed by xdg-desktop-menu' $menu_file > /de v/null 2> /dev/null; then 890 if grep 'generated and managed by xdg-desktop-menu' $menu_file > /de v/null 2> /dev/null; then
926 awk ' 891 awk '
927 # List all files within <Directory> tags 892 # List all files within <Directory> tags
928 BEGIN { 893 BEGIN {
929 RS="<" 894 RS="<"
930 } 895 }
931 /^Directory/ { 896 /^Directory/ {
932 if (match($0,/>/)) { 897 if (match($0,/>/)) {
933 print substr($0,RSTART+1) 898 print substr($0,RSTART+1)
934 } 899 }
935 }' $menu_file >> $tmpfile 900 }' $menu_file >> $tmpfile
936 fi 901 fi
937 done 902 done
938 orig_directory_files="$directory_files" 903 orig_directory_files="$directory_files"
939 directory_files= 904 directory_files=
940 for desktop_file in $orig_directory_files; do 905 for desktop_file in $orig_directory_files; do
941 if ! grep '^'$desktop_file'$' $tmpfile > /dev/null 2> /dev/null; the n 906 if ! grep '^'$desktop_file'$' $tmpfile > /dev/null 2> /dev/null; the n
942 # No longer in use, safe to delete 907 # No longer in use, safe to delete
943 directory_files="$directory_files $desktop_file" 908 directory_files="$directory_files $desktop_file"
944 fi 909 fi
945 done 910 done
946 rm -f "$tmpfile" 911 rm -f "$tmpfile"
947 fi 912 fi
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 exit_failure_syntax "mode argument missing for --mode" 956 exit_failure_syntax "mode argument missing for --mode"
992 fi 957 fi
993 case "$1" in 958 case "$1" in
994 user) 959 user)
995 mode="user" 960 mode="user"
996 ;; 961 ;;
997 962
998 system) 963 system)
999 mode="system" 964 mode="system"
1000 ;; 965 ;;
1001 966
1002 *) 967 *)
1003 exit_failure_syntax "unknown mode '$1'" 968 exit_failure_syntax "unknown mode '$1'"
1004 ;; 969 ;;
1005 esac 970 esac
1006 shift 971 shift
1007 ;; 972 ;;
1008 973
1009 --novendor) 974 --novendor)
1010 vendor=false 975 vendor=false
1011 ;; 976 ;;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 xdg_system_dirs="$XDG_DATA_DIRS" 1069 xdg_system_dirs="$XDG_DATA_DIRS"
1105 [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ 1070 [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
1106 xdg_global_dir= 1071 xdg_global_dir=
1107 for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do 1072 for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
1108 if [ -w $x/$xdg_dir_name ] ; then 1073 if [ -w $x/$xdg_dir_name ] ; then
1109 xdg_global_dir="$x/$xdg_dir_name" 1074 xdg_global_dir="$x/$xdg_dir_name"
1110 break 1075 break
1111 fi 1076 fi
1112 done 1077 done
1113 1078
1114 DEBUG 3 "Install locations for *.directory files:" 1079 DEBUG 3 "Install locations for *.directory files:"
1115 DEBUG 3 "xdg_user_dir: $xdg_user_dir" 1080 DEBUG 3 "xdg_user_dir: $xdg_user_dir"
1116 DEBUG 3 "xdg_global_dir: $xdg_global_dir" 1081 DEBUG 3 "xdg_global_dir: $xdg_global_dir"
1117 DEBUG 3 "kde_user_dir: $kde_user_dir" 1082 DEBUG 3 "kde_user_dir: $kde_user_dir"
1118 DEBUG 3 "kde_global_dir: $kde_global_dir" 1083 DEBUG 3 "kde_global_dir: $kde_global_dir"
1119 DEBUG 3 "gnome_user_dir: $gnome_user_dir" 1084 DEBUG 3 "gnome_user_dir: $gnome_user_dir"
1120 DEBUG 3 "gnome_global_dir: $gnome_global_dir" 1085 DEBUG 3 "gnome_global_dir: $gnome_global_dir"
1121 1086
1122 if [ x"$mode" = x"user" ] ; then 1087 if [ x"$mode" = x"user" ] ; then
1123 xdg_dir="$xdg_user_dir" 1088 xdg_dir="$xdg_user_dir"
1124 kde_dir="$kde_user_dir" 1089 kde_dir="$kde_user_dir"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 xdg_system_dirs="$XDG_DATA_DIRS" 1136 xdg_system_dirs="$XDG_DATA_DIRS"
1172 [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ 1137 [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
1173 xdg_global_dir= 1138 xdg_global_dir=
1174 for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do 1139 for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
1175 if [ -w $x/$xdg_dir_name ] ; then 1140 if [ -w $x/$xdg_dir_name ] ; then
1176 xdg_global_dir="$x/$xdg_dir_name" 1141 xdg_global_dir="$x/$xdg_dir_name"
1177 break 1142 break
1178 fi 1143 fi
1179 done 1144 done
1180 1145
1181 kde_user_dir="$HOME/.kde/share/applnk" 1146 kde_user_dir=`kde${KDE_SESSION_VERSION}-config --path apps 2> /dev/null | cut -d ':' -f 1`
1182 kde_global_dir="/usr/share/applnk" 1147 kde_global_dir=`kde${KDE_SESSION_VERSION}-config --path apps 2> /dev/null | cut -d ':' -f 2`
1183 [ -w $kde_global_dir ] || kde_global_dir= 1148 [ -w $kde_global_dir ] || kde_global_dir=
1184 1149
1185 gnome_user_dir="$HOME/.gnome/apps" 1150 gnome_user_dir="$HOME/.gnome/apps"
1186 gnome_global_dir="/usr/share/gnome/apps" 1151 gnome_global_dir="/usr/share/gnome/apps"
1187 [ -w $gnome_global_dir ] || gnome_global_dir= 1152 [ -w $gnome_global_dir ] || gnome_global_dir=
1188 1153
1189 [ -f /etc/mandriva-release ] && need_mandriva_fix=true 1154 DEBUG 3 "Install locations for *.desktop files:"
1190 [ -n "$need_mandriva_fix" ] && DEBUG 1 "Fixing up .desktop categories (Mandriva work around)"
1191
1192 DEBUG 3 "Install locations for *.desktop files:"
1193 DEBUG 3 "xdg_user_dir: $xdg_user_dir" 1155 DEBUG 3 "xdg_user_dir: $xdg_user_dir"
1194 DEBUG 3 "xdg_global_dir: $xdg_global_dir" 1156 DEBUG 3 "xdg_global_dir: $xdg_global_dir"
1195 DEBUG 3 "kde_user_dir: $kde_user_dir" 1157 DEBUG 3 "kde_user_dir: $kde_user_dir"
1196 DEBUG 3 "kde_global_dir: $kde_global_dir" 1158 DEBUG 3 "kde_global_dir: $kde_global_dir"
1197 DEBUG 3 "gnome_user_dir: $gnome_user_dir" 1159 DEBUG 3 "gnome_user_dir: $gnome_user_dir"
1198 DEBUG 3 "gnome_global_dir: $gnome_global_dir" 1160 DEBUG 3 "gnome_global_dir: $gnome_global_dir"
1199 1161
1200 if [ x"$mode" = x"user" ] ; then 1162 if [ x"$mode" = x"user" ] ; then
1201 xdg_dir="$xdg_user_dir" 1163 xdg_dir="$xdg_user_dir"
1202 kde_dir="$kde_user_dir" 1164 kde_dir="$kde_user_dir"
(...skipping 21 matching lines...) Expand all
1224 case $action in 1186 case $action in
1225 install) 1187 install)
1226 save_umask=`umask` 1188 save_umask=`umask`
1227 umask $my_umask 1189 umask $my_umask
1228 1190
1229 for x in $xdg_dir $kde_dir $gnome_dir ; do 1191 for x in $xdg_dir $kde_dir $gnome_dir ; do
1230 mkdir -p $x 1192 mkdir -p $x
1231 eval 'cp $desktop_file $x/$basefile'$xdg_redirect_output 1193 eval 'cp $desktop_file $x/$basefile'$xdg_redirect_output
1232 done 1194 done
1233 1195
1234 if [ -n "$need_mandriva_fix" ] ; then
1235 fixup_mandriva_categories $xdg_dir/$basefile
1236 fi
1237
1238 if [ -f $kde_dir/$basefile ] ; then 1196 if [ -f $kde_dir/$basefile ] ; then
1239 echo "OnlyShowIn=Old;" >> $kde_dir/$basefile 1197 echo "OnlyShowIn=Old;" >> $kde_dir/$basefile
1240 fi 1198 fi
1241 1199
1242 if [ -f $gnome_dir/$basefile ] ; then 1200 if [ -f $gnome_dir/$basefile ] ; then
1243 echo "OnlyShowIn=Old;" >> $gnome_dir/$basefile 1201 echo "OnlyShowIn=Old;" >> $gnome_dir/$basefile
1244 fi 1202 fi
1245 1203
1246 make_lazy_default "$xdg_dir" "$basefile" 1204 make_lazy_default "$xdg_dir" "$basefile"
1247 1205
1248 umask $save_umask 1206 umask $save_umask
1249 ;; 1207 ;;
1250 1208
1251 uninstall) 1209 uninstall)
1252 for x in $xdg_dir $kde_dir $gnome_dir ; do 1210 for x in $xdg_dir $kde_dir $gnome_dir ; do
1253 rm -f $x/$basefile 1211 rm -f $x/$basefile
1254 done 1212 done
1255 1213
1256 ;; 1214 ;;
1257 esac 1215 esac
1258 done 1216 done
1259 1217
1260 if [ x"$update" = x"yes" ] ; then 1218 if [ x"$update" = x"yes" ] ; then
1261 update_desktop_database 1219 update_desktop_database
1262 fi 1220 fi
1263 1221
1264 exit_success 1222 exit_success
OLDNEW
« no previous file with comments | « third_party/xdg-utils/scripts/xdg-desktop-icon.in ('k') | third_party/xdg-utils/scripts/xdg-desktop-menu.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698