~ubuntu-langpack/langpack-o-matic/main

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -eu

# these have a high priority for the desktop, but we don't want them on touch
BLACKLIST="exiv2
colord
gnome-icon-theme
gtk+2.0
python-apt
software-properties
sound-theme-freedesktop
totem-pl-parser
xz"
WHITELIST="pam"

if [ $# != 1 ]; then
    echo "Usage: $0 <release>" >&2
    exit 1
fi
RELEASE="$1"

MYDIR=$(dirname $(readlink -f $0))

WORKDIR=$(mktemp -t -d germinate.XXXXXX)
trap "rm -rf $WORKDIR" EXIT TERM INT QUIT PIPE

cd "$WORKDIR"
# download package indexes for mapping binaries to sources
declare -A binsrc
for c in main universe; do
    wget -O- http://ports.ubuntu.com/dists/$RELEASE/$c/binary-armhf/Packages.xz | \
        xz -cd | grep-dctrl -n -sPackage,Source:Package . > Packages-$c
    while true; do
        read bin || break
        read src _
        read _  # skip empty line
        binsrc["$bin"]="$src"
    done < Packages-$c
done

# determine list of binary packages in ubuntu-touch seed
germinate --no-rdepends --no-installer -s ubuntu-touch.$RELEASE -d $RELEASE -a armhf -c main,universe -m http://ports.ubuntu.com/
# Don't consider 'required' since most of those aren't user visible (but there
# is a whitelist at the top for anything we want anyway)
grep -h '^[0-9a-z]' touch sdk-libs minimal touch-core touch-android touch | cut -f1 -d ' ' | grep -v ^language-pack > binaries

# map binaries to sources, generate output
sources="$WHITELIST"
for pkg in $(cat binaries); do
    s=${binsrc[$pkg]}
    if ! echo "$s" | grep -qF "$BLACKLIST"; then
        sources="$sources ${binsrc[$pkg]}"
    fi
done
echo "$sources" | xargs -n1 | sort -u > "$MYDIR/maps/pkglist-touch-$RELEASE"