This file is indexed.

/usr/bin/d-shlibmove is in d-shlibs 0.79.

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
#!/bin/bash
#   d-shlibmove -- move shared library files around for Debian packaging
#   Copyright (C) 2002, 2005 Junichi Uekawa
#
#   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# 2002 Apr 23. Created.
#   automatic packaging of libtool-created library packages.

# from d-shlibs package

set -e
set -o pipefail

eval "$(dpkg-architecture -s)"

getname() {
	local SONAMELIBNAME
	local SONAMEVERSION
	local SONAME
	SONAME="$1"
	SONAMELIBNAME=${SONAME/%.so*}
	SONAMEVERSION=${SONAME/#*.so.}
	case "$SONAMELIBNAME" in
	  *[0-9])
		RETURN="$SONAMELIBNAME-$SONAMEVERSION"
		;;
	  *)
		RETURN="$SONAMELIBNAME$SONAMEVERSION"
		;;
	esac
}

readlibnameinfo() {
	LIBNAME="$1"

	if [ -z "$1" ] || ! echo "$1" | grep ".so$" > /dev/null; then
		echo "$0: [$1] is not a valid shared library file name" >&2
		exit 1;
	fi

	if [ ! -h "$1" ]; then
		echo "$0: expected [$1] to be a symlink, but it is not" >&2
		exit 1;
	fi

	SONAME=$(set -o pipefail; "$DEB_HOST_GNU_TYPE-objdump" -p "$LIBNAME" \
	| sed -n 's/^.*SONAME *//p')
	getname "$SONAME"
	SONAMEPKGNAME=$(echo "$RETURN" | tr '[:upper:]_' '[:lower:]-')
	PK=$(basename "$1" | sed 's/\.so$//')
	PK_LOWER=$(echo "$PK" | tr '[:upper:]_' '[:lower:]-')
	REALSO=$(readlink -f "$LIBNAME")
}

check_line() {
	local PKGNAME="$1"
	local ENTRYLINE="$2"

	if ! awk '/^Package:.*'"$PKGNAME"'/,/^$/{print}' "$CONTROL" \
	| perl -0 -pe 's/\n[ \t]+/ /g' \
	| grep "$ENTRYLINE" > /dev/null; then
		echo "E: line [$ENTRYLINE] not found in $CONTROL section for $PKGNAME"
		# set this error signifier to true
		CHECK_ERROR=true
	fi
}


echo "Library package automatic movement utility"

CONTROL=debian/control

execscript=$(tempfile)
INSTALLFILE_SHLPKG=$(tempfile)
INSTALLFILE_DEVPKG=$(tempfile)
cat > "$execscript" <<EOF
set -e
EOF

EXTRALIBS=()
SUFFIX=
DEVSUFFIX=
TRANSITIONSUFFIX=

DOIT=no
DEVUNVERSIONED=no
IGNORELIBDEP=no
INCLUDEA=yes
INCLUDELA=yes
MULTIARCH=no
while [ -n "$1" ]; do
	case "$1" in
	  --moveshl)
		echo "$2 $3" >> "$INSTALLFILE_SHLPKG"
		shift; shift; shift;
		;;
	  --movedev)
		echo "$2 $3" >> "$INSTALLFILE_DEVPKG"
		shift; shift; shift;
		;;
	  --movedevdoc)
		echo "$2 usr/share/doc/\${PKGDEV}" >> "$INSTALLFILE_DEVPKG"
		shift; shift;
		;;
	  --commit)
		DOIT=yes
		shift;
		;;
	  --multiarch)
		MULTIARCH=yes
		shift;
		;;
	  --extralib)
		EXTRALIBS+=("$2")
		shift; shift;
		;;
	  --shlibs-local)
		shift;
		SHLIBSLOCALVER="$1";
		shift;
		;;
	  --suffix)
		shift;
		SUFFIX="$1";
		shift;
		;;
	  --devsuffix)
		shift;
		DEVSUFFIX="$1";
		shift;
		;;
	  --devunversioned)
		DEVUNVERSIONED=yes
		shift;;
	  --ignorelibdep)
		IGNORELIBDEP=yes
		shift;;
	  --c102)
		TRANSITIONSUFFIX="c102"
		shift;;
	  --ldbl)
		TRANSITIONSUFFIX="ldbl"
		shift;;
	  --v5)
		TRANSITIONSUFFIX="v5"
		shift;;
	  --include-a)
		INCLUDEA=yes
		shift;;
	  --exclude-a)
		INCLUDEA=no
		shift;;
	  --include-la)
		INCLUDELA=yes
		shift;;
	  --exclude-la)
		INCLUDELA=no
		shift;;
	  --override)
		OVERRIDE[${#OVERRIDE[@]}]="$2"
		shift; shift;;
	  --|*)
		break;
		;;
	esac
done

# path/libxxxx.so.yyy.zz.zz
# ------------------------- REALSO (actual .so filename that is linked to)
#      -------------- SONAME
#      -------    --- SONAMEPKGNAME (lowercased for package name)
# --------------- $1
#      ---------- PK
#      ---------- PK_LOWER (lowercased for package name)

DEVLIB_TO_CHECK=()
for extralib in "${EXTRALIBS[@]}"; do
	readlibnameinfo "$extralib"
	DEVLIB_TO_CHECK+=("$extralib")
	if [ "$INCLUDEA" = "yes" ]; then
		echo "$(dirname "$extralib")/$PK.a usr/lib" >> "$INSTALLFILE_DEVPKG"
	fi
	if [ "$INCLUDELA" = "yes" ]; then
		echo "$(dirname "$extralib")/$PK.la usr/lib || true" >> "$INSTALLFILE_DEVPKG"
	fi
	echo "$(dirname "$extralib")/$PK.so usr/lib" >> "$INSTALLFILE_DEVPKG"
	echo "$(dirname "$REALSO")/$SONAME usr/lib" >> "$INSTALLFILE_SHLPKG"
	echo "$REALSO usr/lib" >> "$INSTALLFILE_SHLPKG"
done

DEVLIB_TO_CHECK+=("$1")
readlibnameinfo "$1"
if [ "$DEVUNVERSIONED" = "yes" ]; then
	PKGDEV="$PK_LOWER$DEVSUFFIX-dev"
else
	PKGDEV="$SONAMEPKGNAME$DEVSUFFIX-dev"
fi
PKGSHL="$SONAMEPKGNAME$SUFFIX$TRANSITIONSUFFIX"

INSTALLDIR="install -d -m 755"
echo "$INSTALLDIR debian/$PKGDEV/usr/lib" >> "$execscript"
echo "$INSTALLDIR debian/$PKGSHL/usr/lib" >> "$execscript"
if [ "$INCLUDEA" = "yes" ]; then
	echo "mv $(dirname "$1")/$PK.a debian/$PKGDEV/usr/lib" >> "$execscript"
fi
if [ "$INCLUDELA" = "yes" ]; then
	echo "mv $(dirname "$1")/$PK.la debian/$PKGDEV/usr/lib || true" >> "$execscript"
fi
echo "mv $(dirname "$1")/$PK.so debian/$PKGDEV/usr/lib" >> "$execscript"
echo "mv $(dirname "$REALSO")/$SONAME debian/$PKGSHL/usr/lib" >> "$execscript"
if [ "$(dirname "$REALSO")/$SONAME" != "$REALSO" ]; then
	echo "mv $REALSO debian/$PKGSHL/usr/lib" >> "$execscript"
fi
if [ -n "$SHLIBSLOCALVER" ]; then
	echo "echo \"$SONAMELIBNAME $SONAMEVERSION $PKGSHL (>= $SHLIBSLOCALVER)\" >> debian/shlibs.local" >> "$execscript"
fi

d-devlibdeps "${OVERRIDE[@]/#/--override=}" "debian/$PKGDEV.substvars" "${DEVLIB_TO_CHECK[@]}"

#do some definition for the file.
echo "PKGDEV=$PKGDEV" >> "$execscript"
echo "PKGSHL=$PKGSHL" >> "$execscript"

#do the extra files
while read -r A B; do
	echo "$INSTALLDIR debian/$PKGSHL/$B" >> "$execscript"
	echo "mv $A debian/$PKGSHL/$B" >> "$execscript"
done < "$INSTALLFILE_SHLPKG"
if [ "$INCLUDELA" = "no" ]; then
	sed -i -e "/^.*\.la usr\/lib || true$/d" "$INSTALLFILE_DEVPKG"
fi
while read -r A B; do
	echo "$INSTALLDIR debian/$PKGDEV/$B" >> "$execscript"
	echo "mv $A debian/$PKGDEV/$B" >> "$execscript"
done < "$INSTALLFILE_DEVPKG"

if [ "$MULTIARCH" = "yes" ]; then
	sed -i -e "s/usr\/lib\( || true\)\?$/usr\/lib\/$DEB_HOST_MULTIARCH\1/" "$execscript"
fi

cat "$execscript"

# check the syntax of the control file.
CHECK_ERROR=false

if ! [ "$DEVUNVERSIONED" = "yes" ]; then
	check_line "$PKGDEV" "Provides:.*$PK_LOWER-dev"
	check_line "$PKGDEV" "Conflicts:.*$PK_LOWER-dev"
fi
check_line "$PKGSHL" "Section: libs"
if [ -n "$SUFFIX" ]; then
	check_line "$PKGSHL" "Conflicts: $SONAMEPKGNAME"
fi
if [ -n "$TRANSITIONSUFFIX" ]; then
	check_line "$PKGSHL" "Conflicts: $SONAMEPKGNAME$SUFFIX"
fi
check_line "$PKGDEV" "Section: \(devel\|libdevel\)"
if ! [ "$IGNORELIBDEP" = "yes" ]; then
	check_line "$PKGDEV" "Depends:.*$PKGSHL"
fi
check_line "$PKGSHL" "Depends:.*[$]{shlibs:Depends}"

if [ "$CHECK_ERROR" = "true" ]; then
	echo "Error occurred, aborting" >&2
	exit 1
fi

if [ "$DOIT" = "yes" ]; then
	sh "$execscript"
else
	echo "Dry-run. If you are satisfied, run with --commit"
	exit 2
fi
rm -f "$execscript" "$INSTALLFILE_DEVPKG" "$INSTALLFILE_SHLPKG"

exit 0