This file is indexed.

/usr/bin/pcreate is in pbuilder-scripts 19.

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
#!/bin/bash
# -*- indent-tabs-mode: t; tab-width: 2 -*-
#
# Copyright 2009, 2010 Canonical Ltd
#
# 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, version 3 of the License.
#
# 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, see <http://www.gnu.org/licenses/>.

DEFAULT_COMPONENTS="main restricted universe multiverse"

ARCH=""
DIST=""
COMPONENTS="$DEFAULT_COMPONENTS"
EXTRAPACKAGES=""

usage()
{
	echo
	echo "Usage: pcreate [-c COMPONENTS] [-e \"EXTRA PACKAGES\"] [-s SOURCES]"
	echo "               -a ARCH -d DIST PROJECT"
	echo
	echo "Default distribution is '$DEFAULT_DIST'".
	echo
	echo "EXTRA PACKAGES are a double quoted, space separated list of" 
	echo "packages which will be installed after chroot creation."
	echo
	echo "SOURCES is the starting contents of the sources list."
	echo

	exit 1
}

while getopts 'a:c:e:d:s:' OPTION
do
	case $OPTION in
	a)
		ARCH="$OPTARG"
		;;
	c)
		COMPONENTS="$OPTARG"
		;;
	e)
		EXTRAPACKAGES="$OPTARG"
		;;
	d)
		DIST="$OPTARG"
		;;
	s)
		SOURCES="$OPTARG"
		;;
	?)
		usage
		;;
	esac
done
shift $(($OPTIND - 1))

PROJ=$1
if [ -z "$PROJ" -o -z "$ARCH" -o -z "$DIST" ]; then
		usage
fi

TMPFILE=$(mktemp)

# -s file.list means you want to start with file.list as the initial contents
if [ -z "$SOURCES" ] ; then
 echo \
'# Put your extra sources.list entries here.  The normal entries for the
# components and dist you selected will be added.  This is just for extra
# custom entries.

' > "$TMPFILE"
else
 cat $SOURCES > "$TMPFILE"
fi


# Let user add custom, project-specific lines
sensible-editor "$TMPFILE"

if [ "$DIST" = "sid" ]; then # should be larger list of Debian names
	MIRROR="ftp://ftp.debian.org/debian"
elif [ "$ARCH" = "i386" -o "$ARCH" = "amd64" ]; then
	MIRROR="http://archive.ubuntu.com/ubuntu"
else 
	MIRROR="http://ports.ubuntu.com/ubuntu-ports"
fi

# if arm, need qemu
if [ "$ARCH" = "armel" -o "$ARCH" = "armhf" ]; then
	# get the host OS release and adapt
  r=$(lsb_release -rs)
  r=${r%%\.*}
   if (( r > 10 )) ; then
     echo "Installing qemu-user-static for ${ARCH}-on-x86 support (natty or later)"
     sudo apt-get install qemu-user-static || exit 1
	   DEBOOTSTRAP_ARGS="--debootstrap qemu-debootstrap --debootstrapopts --variant=buildd --debootstrapopts --arch=$ARCH"
   else
		 echo "Installing qemu-arm-static for ${ARCH}-on-x86 support (maverick or earlier)"
     # sudo apt-get install qemu-user-static || exit 1
		 sudo apt-get install qemu-arm-static || exit 1
     # Don't add debootstrapopts options, build-arm-chroot uses --arch itself and gets
     # confused with any extra options
	   DEBOOTSTRAP_ARGS="--debootstrap build-arm-chroot"
	fi
else
	DEBOOTSTRAP_ARGS="--debootstrapopts --variant=buildd --debootstrapopts --arch=$ARCH"
fi

# Create the Project directory
SRCDIR=${PBUILDER_SRCDIR:-$HOME/Projects}
mkdir -p "$SRCDIR/$PROJ"

# Now, we didn't tell pbuilder about the user's input sources.list.  We'll set
# that up as an extra step below (this allows user to input https sources even
# in hardy, which didn't install apt-transport-https by default)

#set -x
sudo sh -c "pbuilder create --basetgz \"/var/cache/pbuilder/$PROJ.tgz\" --distribution \"$DIST\" $DEBOOTSTRAP_ARGS --components \"$COMPONENTS\" --mirror \"$MIRROR\" --othermirror \"deb-src $MIRROR $DIST $COMPONENTS\" && pbuilder execute --save-after-exec --basetgz \"/var/cache/pbuilder/$PROJ.tgz\" --bindmounts \"$(dirname $TMPFILE)\" -- /usr/lib/pbuilder-scripts/pcreate-helper \"$TMPFILE\" \"$EXTRAPACKAGES\""
#set +x

rm "$TMPFILE"