ubuntu-bots/PackageInfo/update_apt

49 lines
1.1 KiB
Bash

#!/usr/bin/env bash
if [ -z "$DIR" ]; then
DIR=/home/bot/aptdir
fi
DEFAULT_OPTS="-qq"
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 arguments" >&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