This file is indexed.

/usr/lib/x86_64-linux-gnu/xfce4/settings/appearance-install-theme is in xfce4-settings 4.12.3-0ubuntu1.

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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/sh
#
# Copyright (C) 2011 Nick Schermer <nick@xfce.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# appearance-install-theme <theme-package>
# return value:
# 1: common error, should never happen
# 2: File too big
# 3: Failed to create temp directory
# 4: Failed to extract archive
# 5: Unknown file format
# theme-package can be a tar-file zip-file or a directory
# the following themes types are supported:
# - Gtk-2
# - Gtk-3
# - Xfwm
# - Icons

dndfilename="$1"
retval=0

installtheme()
{
    file="$1"
    suffix="$2"

    basedir=${file#$tmpdir/}
    themedir=${basedir%/$suffix}
    themename=${3:-`basename "$themedir"`}
    themetype=`dirname "$suffix"`
    themesrc=`dirname "$basedir"`
    src="$tmpdir/$themesrc"

    dest="$HOME/.themes/$themename"
    if test ! -d "$dest/$themetype"; then
        # move theme to the users' theme directory
        mkdir -p "$dest" && mv "$src" "$dest"
    fi
}

installicontheme()
{
    file="$1"
    suffix="$2"

    basedir=${file#$tmpdir/}
    themedir=${basedir%/$suffix}
    themename=${3:-`basename "$themedir"`}
    src="$tmpdir/$themedir"

    dest="$HOME/.icons"
    if test ! -d "$dest/$themename"; then
        # move theme to the users' theme directory
        mkdir -p "$dest" && mv "$src" "$dest"
    fi
}

detectthemes()
{
    suffix="$1"

    if test -f "$tmpdir/$suffix"; then
        installtheme "$tmpdir/$suffix" "$suffix" "$pkgname"
    fi
    find "$tmpdir" -path "$tmpdir/*/$suffix" -type f | while read file; do
        installtheme "$file" "$suffix"
    done
}

# leave if no file is provided
if test -z "$dndfilename" -o -z "$HOME"; then
    # 1: common error, should never happen
    exit 1
fi

# check file size, abort if bigger then 50Mb, only works for files
if test x"`which stat 2>/dev/null`" != x""; then
    if [ "`uname -s`" = "DragonFly" ] || [ "`uname -s`" = "FreeBSD" ] || [ "`uname -s`" = "NetBSD" ] || [ "`uname -s`" = "OpenBSD" ]; then
        dndsize=`stat -f %z "$dndfilename"`
    else
        dndsize=`stat -c %s "$dndfilename"`
    fi
    if test "$dndsize" -gt 52428800; then
        # 2: File too big
        exit 2
    fi
fi

# provide tempdir to extract the tarball or folder
# we try $XDG_CACHE_HOME because it is more likely this is on the
# same partition, so moving the theme after extract is faster
if test x"`which mktemp 2>/dev/null`" != x""; then
    tmpdir=`TMPDIR="${XDG_CACHE_HOME:-$TMPDIR}" mktemp -d`
else
    tmpdir="/tmp/tmp.$$.$RANDOM"
    mkdir "$tmpdir"
fi
if test ! -d "$tmpdir"; then
    # 3: Failed to create temp directory
    exit 3
fi

# check if uri is directory or file
if test -d "$dndfilename"; then
    cp -r "$dndfilename" "$tmpdir" || retval=1
    pkgname=`basename "$dndfilename"`
elif test -f "$dndfilename"; then
    case "$dndfilename" in
        *.tar.gz|*.tar.Z|*.tgz|*.tar.bz2|*.tbz2|*.tbz|*.tar|*.tar.xz|*.txz)
            # extract the archive
            tar -C "$tmpdir" -xf "$dndfilename" || retval=4
            pkgname=`basename "${dndfilename%.*}" .tar`
        ;;
        *.zip)
            # extract the archive
            unzip -qq -d "$tmpdir" "$dndfilename" || retval=4
            pkgname=`basename "$dndfilename" .zip`
        ;;
        *)
            # 5: unknow file format
            retval=5
        ;;
    esac
fi

# detect theme type and move it to the correct location if
# extracting or copying succeeded
if test "$retval" -eq 0; then
    # install gtk-2.0 themes
    detectthemes "gtk-2.0/gtkrc"

    # install gtk-3.0 themes
    detectthemes "gtk-3.0/gtk.css"

    # install xfwm4 themes
    detectthemes "xfwm4/themerc"

    # install icon themes
    suffix="index.theme"
    section="Icon Theme"
    if test -f "$tmpdir/$suffix"; then
        if grep -q -i "^\\[$section\\]" "$tmpdir/$suffix"; then
            installicontheme "$tmpdir/$suffix" "$suffix" "$pkgname"
        fi
    fi
    find "$tmpdir" -path "$tmpdir/*/$suffix" -type f | while read file; do
        if grep -q -i "^\\[$section\\]" "$file"; then
            installicontheme "$file" "$suffix"
        fi
    done
fi

# cleanup
rm -rf "$tmpdir"

exit $retval