/usr/bin/jh_linkjars is in javahelper 0.63ubuntu1.
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 | #!/bin/bash --
set -e
. /usr/share/javahelper/jh_lib.sh
syntax()
{
echo -e "Usage: jh_linkjars [options] [target]"
echo -e "Options:"
echo -e "\t-h --help: show this text"
echo -e "\t-V --version: show the version"
echo -e "\t-v --verbose: show more information while running"
echo -e "\t-t --transitive: transitively link jars"
echo -e "\t-n --no-act: don't actually do anything, just print the results"
echo -e "\t-u --unlink: remove the links instead of adding them"
exit 1
}
ARGS="v verbose n no-act u unlink t transitive" parseargs "$@"
function findjars()
{
pkg="$1"
if [ -z "$pkg" ]; then
pkg="$(sed -n '/^Source:/s/.*: //p' < debian/control)"
BDS=$(grep-dctrl --no-field-names --show-field Build-Depends,Build-Depends-Indep -F source "$pkg" debian/control | tr , ' ' | sed 's/([^)]*)//g')
else
BDS=$(dpkg -s "$pkg" | sed -n 's/([^)]*)//g;s/,/ /g;/^Depends:/s/.*: //p')
fi
JARS=""
for d in $BDS; do
j="$(dpkg -L $d | grep "^/usr/share/java/.*\.jar$")"
k=""
if [ -n "$j" ] && [ `getarg t transitive` ]; then
k=$(findjars "$d")
fi
JARS="$JARS $j $k"
done
echo $JARS
}
function unlinkjars()
{
target="$1"
JARS="`findjars`"
for j in $JARS; do
if [ -n "`getarg n no-act`" ]; then
echo rm -f "$target/`basename "$j"`"
continue
fi
if [ -n "`getarg v verbose`" ]; then
echo Removing link for $j from $target
fi
rm -f "$target/`basename "$j"`"
done
}
function linkjars()
{
target="$1"
JARS="`findjars`"
if [ -z "`getarg n no-act`" ]; then
mkdir -p "$target"
fi
for j in $JARS; do
if [ -f "$j" ]; then
if [ -n "`getarg n no-act`" ]; then
echo ln -sf "$j" "$target/"
continue
fi
if [ -n "`getarg v verbose`" ]; then
echo Adding link for $j to $target
fi
ln -sf "$j" "$target/"
fi
done
}
dh_testdir
if [ "$ARGC" != "0" ] ; then
target="${ARGV[0]}"
if [ -n "`getarg u unlink`" ]; then
unlinkjars "$target"
else
linkjars "$target"
fi
elif [ -f debian/linkjars ]; then
for target in `cat debian/linkjars`; do
if [ -n "`getarg u unlink`" ]; then
unlinkjars "$target"
else
linkjars "$target"
fi
done
fi
|