ubuntu-bots/PackageInfo/update_apt

52 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Set DIR to the same value as supybot.plugins.PackageInfo.aptdir
if [ -z "$DIR" ]; then
DIR=/home/bot/aptdir
fi
# Be quiet bt default
DEFAULT_OPTS="-qq"
# Check command-line arguments
while [ "x$1" != "x" ]; do
case "$1" in
-v|--verbose)
DEFAULT_OPTS="-q"
;;
-V|--very-verbose)
DEFAULT_OPTS=""
;;
-d|--dir)
if [ "x$2" == "x" ]; then
echo "\"-d|--dir\" requires an argument" >&2
exit 1
fi
shift
DIR="$1"
;;
-*)
echo "Unknown option \"$1\"" >&2
exit 1
;;
*)
echo "This script takes no non-argument parameters" >&2
exit 1
;;
esac
shift
done
for DIST in "$DIR"/*.list; do
test -h $DIST && continue
DIST=${DIST:${#DIR}}
DIST=${DIST/.list}
touch "$DIR/$DIST.status"
mkdir -p "$DIR/$DIST/partial"
apt-get ${DEFAULT_OPTS} -o "Dir::State::Lists=$DIR/$DIST" \
-o "Dir::etc::sourcelist=$DIR/$DIST.list" \
-o "Dir::State::status=$DIR/$DIST.status" \
-o "Dir::Cache=$DIR/cache" \
-o "APT::Architecture=i386" update
done