This file is indexed.

/usr/sbin/ltsp-build-client is in ltsp-server 5.3.7-0ubuntu2.

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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/bash
#
#  Copyright (c) 2005 Canonical LTD
#
#  Author: Matt Zimmerman <mdz@canonical.com>
#
#  2005, Vagrant Cascadian <vagrant@freegeek.org>
#  2006, Oliver Grawert <ogra@canonical.com>
#        Vagrant Cascadian <vagrant@freegeek.org>
#        Otavio Salvador <otavio@debian.org>
#        Petter Reinholdtsen <pere@hungry.com>
#  2007, Oliver Grawert <ogra@canonical.com>
#  2008, Vagrant Cascadian <vagrant@freegeek.org>
#        Warren Togami <wtogami@redhat.com>
#        Jigish Gohil <jigish.gohil@gmail.com>
#
#  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, you can find it on the World Wide
#  Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
#  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#

set -e

# Source the ltsp server functions for vendor detect
. /usr/share/ltsp/ltsp-server-functions

export TERM=linux							  # make sure we're using a known terminal type
export TEXTDOMAIN=ltsp                        # gettext domain (.mo file name)
export TEXTDOMAINDIR=/usr/share/locale        # locale dir for gettext codes
VENDOR=$(detect_vendor)                       # Linux distribution
export BASE=${BASE:-/opt/ltsp}                # LTSP base directory
MODULES_BASE=${MODULES_BASE:-/usr/share/ltsp} # our modules place
PLUGINS_BASE=$MODULES_BASE/plugins            # base plugin repository
SCRIPT=ltsp-build-client
PLUGIN_DIRS="/etc/ltsp/plugins/$SCRIPT $PLUGINS_BASE/$SCRIPT/$VENDOR-custom $PLUGINS_BASE/$SCRIPT/$VENDOR $PLUGINS_BASE/$SCRIPT/common"
VENDOR_FUNCTIONS="$PLUGINS_BASE/$SCRIPT/$VENDOR-functions"

PARAMS="config:"                              # store commandline params for getopt
HELP_MESSAGE=""                               # store regular help messages
ADVANCED_HELP_MESSAGE=""                      # store advanced help messages

. gettext.sh

# load plugin functions
. $PLUGINS_BASE/functions

# load vendor-specific plugins
if [ -f "$VENDOR_FUNCTIONS" ]; then
    . "$VENDOR_FUNCTIONS"
fi

##################################
### Methods to be called by plugins
##################################

# Add an option for commandline parser
#
# Params:
# $1 - param name
# $2 - help message
# $3 - regular|advanced
# $4 - has a value? (true or false)
add_option () {
    case $4 in
    true)
        NAME="opt_with_param_$(echo $1 | tr '-' '_')"
        eval "$NAME"=true
        PARAMS="$PARAMS,$1:"
        ;;
    false)
        PARAMS="$PARAMS,$1"
        ;;
    *)
        echo "`eval_gettext "API ERROR: you need to provide true or false."`"
        ;;
    esac

    MESSAGE=$(printf "   --%-24s %s" "$1" "$2")
    if [ $3 = regular ]; then
        HELP_MESSAGE="$HELP_MESSAGE $MESSAGE\n"
    else
        ADVANCED_HELP_MESSAGE="$ADVANCED_HELP_MESSAGE $MESSAGE\n"
    fi
}

# Print if using debug.
#
# Params:
# $* - message to be print
debug() {
    if [ -n "$DEBUG" ]; then
        echo "DEBUG: $@" > /dev/stderr
    fi
    if [ -n "$DEBUG_FILE" ]; then
        echo "DEBUG: $@" >> $DEBUG_FILE
    fi
}

# Use it to mount thing on chroot and those will be automaticaly
# unmounted when exit.
#
# Params:
# $1 - what to mount
# $2 - where to mount (skip the chroot path)
# $3 - mount extra params
chroot_mount() {
    if mount $3 $1 $ROOT/${2##/}; then
        CHROOT_MOUNTED="$CHROOT_MOUNTED $ROOT/${2##/}"
    fi
}

####################################
### End of plugins public methods
####################################

# Add commandline option to handle --help
add_option "help" "`eval_gettext "display this help message"`" "regular" "false"
add_option "extra-help" "`eval_gettext "display help for all available commandline options"`" "regular" "false"

# Print usage information.
usage() {
    echo `eval_gettext "LTSP Build Client usage:"`
    echo
    echo "  ltsp-build-client <options>"
    echo
    echo -n `eval_gettext "  Regular options:"`
    echo -e "$HELP_MESSAGE" | sort
    if [ "$ADVANCED_HELP" = "true" ]; then
        echo
        echo -n `eval_gettext "  Advanced options:"`
        echo -e "$ADVANCED_HELP_MESSAGE" | sort
    fi
}

# Clean up the chroot and exit.
on_exit() {
    for dir in $CHROOT_MOUNTED ; do
        umount $dir
    done

    if [ true = "$run_successfull" ] ; then
        echo "`eval_gettext "info: LTSP client installation completed successfully"`"
    else
        echo "`eval_gettext "error: LTSP client installation ended abnormally"`"
        exit 1
    fi
}

load_plugins 'commandline'

# Parse the commandline options
if ! TEMP=`getopt -o '' --long $PARAMS -n "$0" -- "$@"`; then
    usage >&2; exit 1; 
fi
eval set -- "$TEMP"

while [ ! -z "$1" ] && [ "$1" != "--" ]; do
    OPTION=$(echo ${1:2} | tr "-" "_") # remove -- from variable name
    shift
    NAME="opt_with_param_$OPTION"
    VARIABLE=option_${OPTION}_value
    if [ "${!NAME}" = true ]; then
        eval $VARIABLE=\"$1\"
        shift
    else
        eval $VARIABLE=true
    fi
done

if [ -n "$option_help_value" ] || [ -n "$option_extra_help_value" ]; then
    if [ -n "$option_extra_help_value" ]; then
        ADVANCED_HELP="true"
    fi
    usage
    exit 0
fi

trap on_exit EXIT

for hook in configure before-install install after-install finalization; do
    load_plugins "$hook"
done

run_successfull=true # report success to on_exit()

exit 0