~ubuntu-ru-irc/+junk/irckit

« back to all changes in this revision

Viewing changes to ubuntuhelp/ubuntubot/plugins/PackageInfo/update_apt

  • Committer: rmPIC30 at gmail
  • Date: 2010-07-13 09:08:58 UTC
  • Revision ID: rmpic30@gmail.com-20100713090858-w5kkmk093hx38cen
Добавляю бота

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
 
 
3
if [ -z "$DIR" ]; then
 
4
    DIR=/home/bot/aptdir
 
5
fi
 
6
 
 
7
DEFAULT_OPTS="-qq"
 
8
 
 
9
while [ "x$1" != "x" ]; do
 
10
    case "$1" in
 
11
        -v|--verbose)
 
12
            DEFAULT_OPTS="-q"
 
13
            ;;
 
14
        -V|--very-verbose)
 
15
            DEFAULT_OPTS=""
 
16
            ;;
 
17
        -d|--dir)
 
18
            if [ "x$2" == "x" ]; then
 
19
                echo "\"-d|--dir\" requires an argument" >&2
 
20
                exit 1
 
21
            fi
 
22
            shift
 
23
            DIR="$1"
 
24
            ;;
 
25
        -*)
 
26
            echo "Unknown option \"$1\"" >&2
 
27
            exit 1
 
28
            ;;
 
29
        *)
 
30
            echo "This script takes no arguments" >&2
 
31
            exit 1
 
32
            ;;
 
33
    esac
 
34
    shift
 
35
done
 
36
 
 
37
for DIST in "$DIR"/*.list; do
 
38
    test -h $DIST && continue
 
39
    DIST=${DIST:${#DIR}}
 
40
    DIST=${DIST/.list}
 
41
    touch "$DIR/$DIST.status"
 
42
    mkdir -p "$DIR/$DIST/partial"
 
43
    apt-get ${DEFAULT_OPTS} -o "Dir::State::Lists=$DIR/$DIST" \
 
44
                -o "Dir::etc::sourcelist=$DIR/$DIST.list" \
 
45
                -o "Dir::State::status=$DIR/$DIST.status" \
 
46
                -o "Dir::Cache=$DIR/cache" \
 
47
                -o "APT::Architecture=i386" update
 
48
done