/usr/bin/aptitude-run-state-bundle is in aptitude-common 0.6.8.2-1ubuntu4.
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
NO_CLEAN=0
STATEDIR=0
UNPACK_ONLY=0
HELP=0
APPEND=1
DONE=0
while [ $DONE = 0 ]
do
case "$1" in
--append-args )
APPEND=1
shift
;;
--help )
HELP=1
shift
;;
--no-clean )
NO_CLEAN=1
shift
;;
--prepend-args )
APPEND=0
shift
;;
--really-clean )
NO_CLEAN=0
shift
;;
--statedir )
STATEDIR=1
NO_CLEAN=1
shift
;;
--unpack )
UNPACK_ONLY=1
shift
;;
* )
DONE=1
;;
esac
done
if ( [ $UNPACK_ONLY = 0 ] && [ "$#" -lt 1 ] ) ||
( [ $UNPACK_ONLY = 1 ] && [ "$#" -ne 1 ] ) ||
[ $HELP = 1 ]
then
echo "Usage: $0 [options] <input-file> [<program> [arguments ...]]"
echo
echo "This command will unpack the given archive of aptitude state"
echo "information, then invoke the given program with the given"
echo "list of arguments, passing appropriate -o options to cause"
echo "aptitude to use the contents of that archive as its global"
echo "data store."
echo
echo "Options:"
echo " --append-args Place the generated arguments at the end of"
echo " the command line (default)."
echo " --help Display this message and exit."
echo " --no-clean Do not remove the temporary directory after"
echo " invoking aptitude."
echo " --prepend-args Place the generated arguments at the beginning"
echo " of the command line."
echo " --really-clean Remove the state directory, even if --statedir"
echo " was passed as an argument."
echo " --statedir The <input-file> is an unpacked aptitude bundle,"
echo " not a bundle file; implicitly sets --no-clean."
echo " --unpack Just unpack the <input-file>, don't run aptitude."
exit 1
fi
INPUTFILE="$1"
shift
if [ "$#" -lt 1 ]
then
PROGRAM=aptitude
else
PROGRAM="$1"
shift
fi
if [ $STATEDIR = 0 ]
then
tempdir=$(mktemp -p ${TMPDIR:-/tmp} -d aptitudebug.XXXXXXXXX) || exit 1
if [ -z "$tempdir" ]
then
exit 1
fi
else
tempdir=$INPUTFILE
fi
trap '
if [ $NO_CLEAN = 1 ]
then echo "Leaving final state in $tempdir"
else echo "Removing $tempdir"; rm -fr $tempdir
fi' 0
if [ $STATEDIR = 0 ]
then
if [ -d "$INPUTFILE" ]
then
echo "Can't use $INPUTFILE as the input bundle: it's a directory."
exit 1
fi
if ! [ -f "$INPUTFILE" ]
then
echo "Can't use $INPUTFILE as the input bundle: file not found."
exit 1
fi
tar -C "$tempdir" -xf "$INPUTFILE" || exit 1
fi
if [ $UNPACK_ONLY = 1 ]
then
exit 0
fi
if [ "$APPEND" = 1 ]
then
"$PROGRAM" "$@" -o "Dir=$tempdir" -o "Dir::State::status=$tempdir/var/lib/dpkg/status"
else
"$PROGRAM" -o "Dir=$tempdir" -o "Dir::State::status=$tempdir/var/lib/dpkg/status" "$@"
fi
|