~xnox/debian-cd/activate-focal-hwe-kernel

« back to all changes in this revision

Viewing changes to tools/apt-selection

  • Committer: Arch Librarian
  • Date: 2005-03-22 00:47:41 UTC
  • Revision ID: Arch-1:debian-cd@arch.ubuntu.com%debian-cd--MAIN--0--patch-29
Initial revision
Author: aph
Date: 1999-11-11 17:10:38 GMT
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# This is a little shell script that will launch apt-get in dry-run mode
 
4
# to find all the dependencies of a specific package
 
5
 
 
6
# Get the configuration information if necessary
 
7
if [ -z "$TDIR" -o -z "$CODENAME" -o -z "$ARCH" ]; then
 
8
        if [ -e CONF.sh ]; then
 
9
                source CONF.sh
 
10
        else
 
11
                echo "Please set the good environment variables before "
 
12
                echo "launching this program ..."
 
13
                echo "Current values are :"
 
14
                echo "TDIR=$TDIR"
 
15
                echo "CODENAME=$CODENAME"
 
16
                echo "ARCH=$ARCH"
 
17
        fi
 
18
fi
 
19
 
 
20
options=" -o Dir::State::status=$TDIR/$CODENAME-$ARCH/status \
 
21
          -o Dir::State=$TDIR/$CODENAME-$ARCH/apt-state/ \
 
22
          -o Dir::Cache=$TDIR/$CODENAME-$ARCH/apt-cache/ \
 
23
          -o Dir::Etc=$TDIR/$CODENAME-$ARCH/apt/ \
 
24
          -o APT::Architecture=$ARCH "
 
25
 
 
26
# Check for the necessary dirs and files ...
 
27
if [ ! -d "$TDIR/$CODENAME-$ARCH/apt-state/lists/partial" ]; then
 
28
        mkdir -p "$TDIR/$CODENAME-$ARCH/apt-state/lists/partial"
 
29
fi
 
30
if [ ! -d "$TDIR/$CODENAME-$ARCH/apt-cache/archives/partial" ]; then
 
31
        mkdir -p "$TDIR/$CODENAME-$ARCH/apt-cache/archives/partial"
 
32
fi
 
33
if [ ! -d "$TDIR/$CODENAME-$ARCH/apt" ]; then
 
34
        mkdir -p "$TDIR/$CODENAME-$ARCH/apt"
 
35
fi
 
36
if [ ! -e "$TDIR/$CODENAME-$ARCH/apt/sources.list" ]; then
 
37
        # Generating a correct sources.list file
 
38
        echo "deb file:$MIRROR $CODENAME main contrib non-free" \
 
39
        > $TDIR/$CODENAME-$ARCH/apt/sources.list
 
40
        if [ -n "$NONUS" ]; then
 
41
          # Slink used the old paths
 
42
          if [ "$CODENAME" = "slink" ]; then
 
43
             echo "deb file:$NONUS $CODENAME non-US" \
 
44
             >> $TDIR/$CODENAME-$ARCH/apt/sources.list
 
45
          else
 
46
             echo "deb file:$NONUS $CODENAME/non-US main contrib non-free" \
 
47
             >> $TDIR/$CODENAME-$ARCH/apt/sources.list
 
48
          fi
 
49
        fi
 
50
fi
 
51
 
 
52
temp=$TDIR/$CODENAME-$ARCH/temp.apt-selection
 
53
 
 
54
# Launch the command
 
55
if [ "$1" = "update" -o "$1" = "check" ]; then
 
56
        apt-get $options $@
 
57
        exit $?
 
58
elif [ "$1" = "cache" ]; then
 
59
        shift
 
60
        apt-cache $options $@
 
61
        exit $?
 
62
elif [ "$1" = "deselected" ]; then
 
63
        shift
 
64
        apt-get $options -s $@ > $temp
 
65
        num=$?
 
66
        #if [ $num -ne 0 ]; then 
 
67
            #echo ": Param: apt-selection deselected $@" >&2; 
 
68
            #exit $num;  
 
69
        #fi
 
70
        perl -ne 'print "$1\n" if /^Remv (\S+)\s*(?:\[|$)/' $temp | sort
 
71
elif [ "$1" = "selected" ]; then
 
72
        shift
 
73
        apt-get $options -s $@ > $temp 
 
74
        num=$?
 
75
        #if [ $num -ne 0 ]; then 
 
76
        #    echo "ERROR: Param: apt-selection selected $@" >&2; 
 
77
        #    exit $num;  
 
78
        #fi
 
79
        perl -ne 'print "$1\n" if /^Inst (\S+)\s*(?:\[|$)/' $temp | sort
 
80
else
 
81
        apt-get $options -s $@
 
82
        exit $?
 
83
fi
 
84