/usr/bin/list-desktop-profiles is in desktop-profiles 1.4.20.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | #!/bin/sh
#
# This script implements a tool to filter the profiles listed in .listing files
# used by the desktop-profiles package. Output format kan be specified using a
# format string.
#
# See desktop-profiles (7) for more information about using profiles through
# desktop-profiles and the format of the .listing files
#
# (c) 2004 Bart Cornelis <cobaco AT skolelinux no>
###############################################################################
print_help () {
cat <<EOF
Usage: list-desktop-profiles [OPTIONS]
As the number of .listing files grows, trying to find out which profiles are
present/meet certain criteria becomes increasingly unpleasant. This script
remedies that, allowing you to just list your criteria, and outputting all
profiles meeting those criteria.
Options controlling the used .listing files:
-d | --directory: directory where to look for .listing files
(default=/etc/desktop-profiles)
Options for filtering the shown profiles:
-c, --comment | --description:
profile description matches the regexp that is the next argument
-k, --kind:
profile kind matches the regexp that is the next argument
(profile kind is in [KDE, GCONF, XDG_DATA, XDG_CONFIG, GNUSTEP, ROX, UDE])
-l, --location:
profile location matches the regexp that is the next argument
-n, --name:
profile name matches the regexp that is the next argument
-p, --precedence:
next argument gives the comparison to be done with the profiles precedence
value. Use 'gt' for 'greater then', 'lt' for 'less then', 'ge' for
'greater then or equal to', 'le' for 'less then or equal to', 'eq' for
'equal to', and 'ne' for 'not equal to' (e.g. -p 'ge 0')
-r, --requirement:
profile requirements field matches the regexp that is the next argument
-u, --user:
profile requirements are met for the user given in the next argument
Other Options:
-e. --entry-format: format string for list entries,
May use the variables NAME, LOCATION, PRECEDENCE,KIND,
REQUIREMENTS, DESCRIPTION, and FILE. First 6 of which refer
to the respective field for that profile, while FILE refers
to the .listing file the profile is in.
Parentheses, &, and characters interpreted specially by the
shell should be escaped.
(by default it just outputs the profile line)
-h, --help : display this helpmessage
-s, --sort-key: fieldname of the profile field to sort on, one of
[name, location, precedence, requirements, kind, description]
this defaults to 'name'
(Note: you may also use upper case if you want :)
EOF
}
#################################
# Check if user set any defaults
#################################
if test -r /etc/default/desktop-profiles; then
. /etc/default/desktop-profiles
fi;
####################
# Parse Commandline
####################
while test $# -ge 1; do
# if not help, there should be at least one more argument
if (test "$1" = "-h") || (test "$1" = "--help") || (test $# -lt 2); then
print_help;
exit;
fi;
case $1 in
-d | --directory) LISTINGS_DIRS="$2 $LISTINGS_DIRS" ;;
-c | --comment | --description) DESCRIPTION_FILTER="$2" ;;
-k | --kind) KIND_FILTER="$2" ;;
-l | --location) LOCATION_FILTER="$2" ;;
-n | --name) NAME_FILTER="$2" ;;
-p | --precedence)
#validate expression
if (echo "$2" | grep -E '^(gt|lt|ge|le|ne|eq) -?[0-9]+$' > /dev/null); then
PRECEDENCE_FILTER="-$2";
else
print_help;
exit;
fi;
;;
-r | --requirement) REQUIREMENT_FILTER="$2" ;;
-u | --user) OUR_USER="$2" ;;
-s | --sort-key)
case $2 in
NAME | name | 1) SORT_KEY=1 ;;
KIND | kind | 2) SORT_KEY=2 ;;
LOCATION | location | 3) SORT_KEY=3 ;;
PRECEDENCE| precedence | 4)
SORT_KEY=4
SORT_ARGS='--general-numeric-sort --reverse';
;;
REQUIREMENTS | requirements | 5) SORT_KEY=5 ;;
DESCRIPTION | description | 6) SORT_KEY=6 ;;
*)
print_help;
exit;
;;
esac;
;;
-e | --entry-format) FORMAT="$2" ;;
*)
print_help;
exit;
;;
esac;
# All options take an argument so we should always shift twice
# except help, but then we don't get here
shift 2;
done;
# get utility functions for working with .listing files
LIB=/usr/share/desktop-profiles/listingmodule;
if (test -r $LIB); then
. $LIB;
else
echo "Shell library $LIB is missing! Aborting.";
exit 1;
fi;
# use utility function to give user what he wants (we set up the environment
# variables to control the function output in the commandline parsing)
filter_listings;
|