This file is indexed.

/usr/bin/superpaco is in paco 2.0.9-1.

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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
#!/bin/sh
# vim:ts=4:ft=sh
#-----------------------------------------------------------------------
# SuperPaco - installs Debian, RPM or Slackware binary packages without
#             dpkg, RPM or pkgtool; and optionally logs them with paco.
#
# To install RPM packages, cpio and (rpm2cpio or rpmunpack) are required.
#-----------------------------------------------------------------------
# AUTHOR
#--------
# SuperPaco is part of the package paco
# Copyright (C) 2005-2009 David Rosal
# For more information visit http://paco.sourceforge.net
#-----------------------------------------------------------------------

me=`basename $0`


warn()		{ echo "$me: $*" >&2; }
die()		{ warn "$*"; exit 1; }
say()		{ echo "$*" >&6; }
sayf()		{ printf "$*" >&6; }
version()	{ paco --version | sed "s@^paco@$me@"; exit 0; }

help()
{
cat << EOF
$me - installs Debian, RPM or Slackware binary packages with paco.

Usage:
  $me [OPTIONS] <packages>

Options:  [default values listed in brackets]
  -h, --help           Display this usage message and exit.
  -v, --version        Display version information and exit.
      --root=PATH      Use PATH as the root directory  [$root].
  -n, --no-paco        Do not use paco to log the installation.
  -q, --quiet          Be silent.
  -s, --strip-release  Remove the release suffix from the name of the package
                        (e.g. 'foo-1.0.2-2.1' --> 'foo-1.0.2').

Note:
  To install rpm packages, cpio and ( rpm2cpio or rpmunpack ) are required.

EOF
	exit 0
}


#---------------------------------------#
# Initialize and parse the command line #
#---------------------------------------#

# Remove tmp stuff on exit
trap 'rm -rf $tmpdir' 0

# Defaults
root=/
quiet=
strip=
pkgs=
use_paco=1

# Parse the command line
while [ "$1" ]; do
	case $1 in
	
		-n|--no-paco)				use_paco=;;
		-q|--quiet)					quiet=1;;
		-s|--strip-release|--strip)	strip=1;;
		-v|--version)				version;;

		--root|--root=*)	
			root=`expr $1 : '[^=]*=\(.*\)'` \
				|| die "Option '$1' requires an argument"
			;;
			
		-*)	help;;
		
		*)	pkgs="$pkgs $1";;
	esac
	shift
done

[ "$pkgs" ] || help

[ "$quiet" ] && exec 6>/dev/null || exec 6>&1

# Absolutize and remove repeated package names
__pkgs=""
for pkg in $pkgs; do
	expr $pkg : / >/dev/null || pkg=`pwd`/$pkg
	pkg=`expr $pkg : '\(.*[^/]\)' '|' '/' | tr -s '/'`
	__pkgs="$__pkgs $pkg"
done
pkgs=`for pkg in $__pkgs; do echo $pkg; done | sort -u`


# "Absolutize" root, and remove trailing and duplicate slashes
expr "$root" : '/' >/dev/null || root=`pwd`/$root
root=`expr "$root" : '\(.*[^/]\)' '|' '/' | tr -s '/'`
[ -f "$root" ] && die "$root: Not a directory"

for prog in paco cpio rpm2cpio rpmunpack; do
	eval $prog=`which $prog`
done
[ "$use_paco" -a -z "$paco" ] && die "Cannot find the paco program"
			
# Tmp dir to store intermediate files
tmpdir=`mktemp -dt ${me}XXXXXX 2>/dev/null || echo /tmp/$me.$$`
rm -rf $tmpdir
install -d $tmpdir

# Process the packages
for pkg in $pkgs; do

	# Check that the package exists and it's a regular file
	[ -f $pkg ] || {
		warn "$pkg: No such regular file"
		continue
	}
	
	sayf "Processing $pkg: "
	
	# Get the type of the package and the basename. Strip suffixes.
	# In Debian packages, also strip the architecture suffix and convert
	# underscores ('_') to hyphens ('-').
	
	case "`file $pkg`" in
	
		*\.deb:\ Debian\ binary\ package*)
			pkg_type=Debian
			name=`basename $pkg .deb | sed 's@_[a-zA-Z].*@@; y@_@-@'`
			;;
			
		*\.rpm:\ RPM*\ src\ *)
			die "Can't install source RPM packages (only binary)"
			;;
			
		*\.rpm:\ RPM*\ bin\ *)
			# RPM packages require cpio and rpm2cpio or rpmunpack.
			if [ -z "$cpio" -o -z "$rpm2cpio$rpmunpack" ]; then
				die "*** cpio and (rpm2cpio or rpmunpack) are required to install RPM packages"
			fi
			pkg_type=RPM
			name=`basename $pkg .rpm`
			;;
			
		*\.tgz:\ gzip\ compressed\ data*)
			pkg_type=Slackware
			name=`basename $pkg .tgz`
			;;
			
		*)
			say "Unsupported format"
			continue
			;;
	esac
	
	say "$pkg_type package"
	
	# Strip the release suffix, if needed.
	if [ "$strip" ]; then
		name=`echo $name | awk '{ 						\
			out = $0;									\
			cnt = gsub(/-[0-9][^-]*/, "&");				\
			if (cnt > 1)  								\
				out = gensub(/-[0-9][^-]*/, "", cnt);	\
			print out;									\
		}'`
	fi

	say "  Name: $name"
	
	
	#----------------#
	# Debian package #
	#----------------#

	if [ $pkg_type = Debian ]; then
	
		sayf "  Converting .deb package to .tar.gz... "
		
		# Extract the control portion
		( ar p $pkg control.tar.gz > $tmpdir/control.tar.gz ) || continue
		( cd $tmpdir && gzip -cd control.tar.gz | tar xf - ) || continue
		
		# Extract the data portion
		( ar p $pkg data.tar.gz > $tmpdir/$name.tar.gz ) || continue
		( gzip -d $tmpdir/$name.tar.gz ) || continue
		
		(
		cd $tmpdir
		
		# Take into account the preinst script
		[ -x preinst ] && cmd="./preinst &&" || cmd=

		# Install destdir
		[ -d $root ] || install -d $root
		
		if [ "$use_paco" ]; then
			sayf "ok\n  Installing the package with paco... "
			# Create an artificial .spec file to be read by paco
			sed -ne "{ \
				/^[Dd]escription:/,/^$/h;		\
				s@^[Pp]ackage:@Name:@p;			\
				/^[Vv]ersion:/p;				\
				s@^[Dd]escription:@Summary:@p;	\
				s@^[Mm]aintainer:@Vendor:@p;	\
				g; {s,^ *,,; s,^.$,,; s,^[Dd]escription:.*,%description,; p} \
			}" control > $name.spec
			paco -lp $name "$cmd tar -C $root -xf $tmpdir/$name.tar"
		else
			sayf "ok\n  Installing the package... "
			$cmd tar -C $root -xf $tmpdir/$name.tar
		fi
		
		)
	
	
	#-------------#
	# RPM package #
	#-------------#

	elif [ $pkg_type = RPM ]; then
	
		sayf "  Converting the RPM package to cpio... "
		
		(
		cd $tmpdir &&
		
		if [ "$rpmunpack" ]; then
			( rpmunpack < $pkg > $name.cpio.gz ) || continue
			gunzip $name.cpio.gz || continue
		else
			( rpm2cpio $pkg > $name.cpio ) || continue
		fi
		
		sayf " ok\n  Extracting files from the cpio package... "
		cpio --extract --make-directories --quiet < $name.cpio
		rm -f $name.cpio
		find . -type d -perm 700 -exec chmod 755 '{}' \;
		
		[ -d $root ] || install -d $root
		
		if [ "$use_paco" ]; then
			sayf "ok\n  Installing the package with paco... "
			paco -lp $name "tar -cf - . | tar -C $root/ -xf -"
		else
			sayf "ok\n  Installing the package... "
			tar -cf - . | tar -C $root/ -xf -
		fi

		)
	
	#-------------------#
	# Slackware package #
	#-------------------#

	else
		sayf "  Converting the .tgz package to .tar... "
		
		base=`basename $pkg`
		cp $pkg $tmpdir/$base || continue
		
		(
		cd $tmpdir &&
		
		( gzip -fcd $base | tar xf - ) || continue
		( tar cf pkg.tar `ls | grep -wv install` ) || continue
		
		aux_cmd=
		if [ -f install/doinst.sh ]; then
			aux_cmd="&& /bin/sh $tmpdir/install/doinst.sh"
		fi
		if [ -f install/slack-desc ]; then
			echo "%description" > $name.spec
			sed '1,/----/d;s@^[^:]*: *@@' install/slack-desc >> $name.spec
		fi
		[ -d $root ] || install -d $root

		if [ "$use_paco" ]; then
			sayf "ok\n  Installing the package with paco... "
			paco -lp $name "tar -C $root -xf $tmpdir/pkg.tar $aux_cmd"
		else
			sayf "ok\n  Installing the package... "
			tar -C $root -xf $tmpdir/pkg.tar $aux_cmd
		fi
		
		)
	fi
	
	[ $? -eq 0 ] && say "ok" || exit 1

	# Remove tmp files
	rm -rf $tmpdir/*
	
done

# Nice job SuperPaco!
exit 0