1999-11-11 16:10:37 -01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# This is a little shell script that will launch apt-get in dry-run mode
|
|
|
|
# to find all the dependencies of a specific package
|
|
|
|
|
2000-02-26 10:41:10 -01:00
|
|
|
# There's not set -e here because this script may fail !
|
|
|
|
# Apt doesn't always work ...
|
|
|
|
# set -e
|
2000-02-19 16:52:52 -01:00
|
|
|
|
1999-11-11 16:10:37 -01:00
|
|
|
# Get the configuration information if necessary
|
2000-03-14 03:02:29 -01:00
|
|
|
if [ -z "$CODENAME" -o -z "$ARCH" -o -z "$APTTMP" ]; then
|
1999-11-11 16:10:37 -01:00
|
|
|
if [ -e CONF.sh ]; then
|
|
|
|
source CONF.sh
|
|
|
|
else
|
|
|
|
echo "Please set the good environment variables before "
|
|
|
|
echo "launching this program ..."
|
|
|
|
echo "Current values are :"
|
|
|
|
echo "CODENAME=$CODENAME"
|
|
|
|
echo "ARCH=$ARCH"
|
2000-03-14 03:02:29 -01:00
|
|
|
echo "APTTMP=$APTTMP"
|
1999-11-11 16:10:37 -01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2001-10-06 15:55:12 +00:00
|
|
|
options=" -q -o Dir::State::status=$APTTMP/$CODENAME-$ARCH/status \
|
2000-03-14 03:02:29 -01:00
|
|
|
-o Dir::State=$APTTMP/$CODENAME-$ARCH/apt-state/ \
|
|
|
|
-o Dir::Cache=$APTTMP/$CODENAME-$ARCH/apt-cache/ \
|
|
|
|
-o Dir::Etc=$APTTMP/$CODENAME-$ARCH/apt/ \
|
2001-06-10 14:56:26 +00:00
|
|
|
-o APT::Cache::AllVersions=0 \
|
1999-11-11 16:10:37 -01:00
|
|
|
-o APT::Architecture=$ARCH "
|
|
|
|
|
2002-04-13 12:17:57 +00:00
|
|
|
if [ "${NONFREE:-0}" != "0" -o "${EXTRANONFREE:-0}" != "0" ]; then
|
2000-03-09 20:06:03 -01:00
|
|
|
sections="main contrib non-free"
|
|
|
|
else
|
|
|
|
sections="main contrib"
|
|
|
|
fi
|
|
|
|
|
1999-11-11 16:10:37 -01:00
|
|
|
# Check for the necessary dirs and files ...
|
2000-03-14 03:02:29 -01:00
|
|
|
if [ ! -d "$APTTMP/$CODENAME-$ARCH/apt-state/lists/partial" ]; then
|
|
|
|
mkdir -p "$APTTMP/$CODENAME-$ARCH/apt-state/lists/partial"
|
1999-11-11 16:10:37 -01:00
|
|
|
fi
|
2000-03-14 03:02:29 -01:00
|
|
|
if [ ! -d "$APTTMP/$CODENAME-$ARCH/apt-cache/archives/partial" ]; then
|
|
|
|
mkdir -p "$APTTMP/$CODENAME-$ARCH/apt-cache/archives/partial"
|
1999-11-11 16:10:37 -01:00
|
|
|
fi
|
2000-03-14 03:02:29 -01:00
|
|
|
if [ ! -d "$APTTMP/$CODENAME-$ARCH/apt" ]; then
|
|
|
|
mkdir -p "$APTTMP/$CODENAME-$ARCH/apt"
|
1999-11-11 16:10:37 -01:00
|
|
|
fi
|
2000-03-14 03:02:29 -01:00
|
|
|
if [ ! -e "$APTTMP/$CODENAME-$ARCH/apt/sources.list" ]; then
|
1999-11-11 16:10:37 -01:00
|
|
|
# Generating a correct sources.list file
|
2000-03-09 20:06:03 -01:00
|
|
|
echo "deb file:$MIRROR $CODENAME $sections" \
|
2000-03-14 03:02:29 -01:00
|
|
|
> $APTTMP/$CODENAME-$ARCH/apt/sources.list
|
1999-11-11 16:10:37 -01:00
|
|
|
if [ -n "$NONUS" ]; then
|
2000-03-09 20:06:03 -01:00
|
|
|
echo "deb file:$NONUS $CODENAME/non-US $sections" \
|
2000-03-14 03:02:29 -01:00
|
|
|
>> $APTTMP/$CODENAME-$ARCH/apt/sources.list
|
1999-11-11 16:10:37 -01:00
|
|
|
fi
|
2000-03-07 17:59:31 -01:00
|
|
|
# Local packages ...
|
|
|
|
if [ -n "$LOCAL" ]; then
|
2000-07-06 10:32:27 +00:00
|
|
|
echo "deb file:${LOCALDEBS:-$MIRROR} $CODENAME local" \
|
2000-03-14 03:02:29 -01:00
|
|
|
>> $APTTMP/$CODENAME-$ARCH/apt/sources.list
|
2000-03-07 17:59:31 -01:00
|
|
|
fi
|
2002-03-21 17:30:24 -01:00
|
|
|
# Security mirror ...
|
|
|
|
if [ -n "$SECURITY" ]; then
|
|
|
|
echo "deb file:${SECURITY:-$MIRROR} $CODENAME/updates $sections" \
|
|
|
|
>> $APTTMP/$CODENAME-$ARCH/apt/sources.list
|
|
|
|
fi
|
2002-10-10 12:56:48 +00:00
|
|
|
# Debian-installer
|
|
|
|
if [ -e "$MIRROR/dists/$CODENAME/main/debian-installer" ]; then
|
|
|
|
echo "deb file:$MIRROR $CODENAME main/debian-installer" \
|
|
|
|
>> $APTTMP/$CODENAME-$ARCH/apt/sources.list
|
|
|
|
fi
|
|
|
|
if [ -n "$LOCAL" -a -e "${LOCALDEBS:-$MIRROR}/dists/$CODENAME/local/debian-installer" ]; then
|
|
|
|
echo "deb file:${LOCALDEBS:-$MIRROR} $CODENAME local/debian-installer" \
|
|
|
|
>> $APTTMP/$CODENAME-$ARCH/apt/sources.list
|
|
|
|
fi
|
1999-11-11 16:10:37 -01:00
|
|
|
fi
|
|
|
|
|
2000-03-14 03:02:29 -01:00
|
|
|
temp=$APTTMP/$CODENAME-$ARCH/temp.apt-selection
|
1999-11-11 16:10:37 -01:00
|
|
|
|
|
|
|
# Launch the command
|
|
|
|
if [ "$1" = "update" -o "$1" = "check" ]; then
|
|
|
|
apt-get $options $@
|
|
|
|
exit $?
|
|
|
|
elif [ "$1" = "cache" ]; then
|
|
|
|
shift
|
|
|
|
apt-cache $options $@
|
|
|
|
exit $?
|
|
|
|
elif [ "$1" = "deselected" ]; then
|
|
|
|
shift
|
|
|
|
apt-get $options -s $@ > $temp
|
|
|
|
num=$?
|
|
|
|
#if [ $num -ne 0 ]; then
|
|
|
|
#echo ": Param: apt-selection deselected $@" >&2;
|
|
|
|
#exit $num;
|
|
|
|
#fi
|
2001-01-27 16:32:34 -01:00
|
|
|
perl -ne 'print "$1\n" if /^Remv (\S+).*/' $temp | sort
|
1999-11-11 16:10:37 -01:00
|
|
|
elif [ "$1" = "selected" ]; then
|
|
|
|
shift
|
|
|
|
apt-get $options -s $@ > $temp
|
|
|
|
num=$?
|
|
|
|
#if [ $num -ne 0 ]; then
|
|
|
|
# echo "ERROR: Param: apt-selection selected $@" >&2;
|
|
|
|
# exit $num;
|
|
|
|
#fi
|
2001-01-27 16:32:34 -01:00
|
|
|
perl -ne 'print "$1\n" if /^Inst (\S+).*/' $temp | sort
|
1999-11-11 16:10:37 -01:00
|
|
|
else
|
|
|
|
apt-get $options -s $@
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|