summaryrefslogtreecommitdiff
path: root/debian/zsh.bug-script
blob: 554ddb5f8e24111cf27feb382fea43ba8943f098 (plain)
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/sh

exec 1>&3
exec 2>&3

list_packages() {
    text="$1"
    shift
    if [ -n "$1" ]; then
        printf "$text:\n\n"
        dpkg-query -l "$@"
        if [ -x /usr/bin/debsums ]; then
            FILES="$(debsums -ce "$@")"
            if [ -n "$FILES" ]; then
                printf "\nThe following files were modified:\n\n$FILES\n"
            fi
        fi
    fi
    printf "\n"
}

if [ -x /usr/bin/aptitude ]; then
    TEXT="Packages which depend, recommend, suggest or enhance a zsh package and hence may provide code meant to be sourced in .zshrc"
    PKGS=$(aptitude -q -F '%p' search '( ?enhances(?name(^zsh)) | ?depends(?name(^zsh)) | ?recommends(?name(^zsh)) | ?suggests(?name(^zsh)) ) !?source-package(^zsh$) ~i')
else
    TEXT="Packages which provide code meant to be sourced in .zshrc"
    # Hardcoded list of (future) packages containing code meant to be
    # sourced in .zshrc
    PKGS=$(dpkg-query -W -f '${Package}\n' \
                      autojump \
                      command-not-found \
                      environment-modules \
                      fizsh \
                      oh-my-zsh \
                      ondir \
                      python-powerline \
                      python3-powerline \
                      rosbash \
                      thefuck \
                      zec \
                      zgen \
                      zsh-antigen \
                      zsh-autosuggestions \
                      zsh-syntax-highlighting \
                      'grml-*' \
           2>/dev/null)
fi

list_packages "$TEXT" $PKGS

list_packages "Packages which provide vendor completions" \
$(dpkg-query -S /usr/share/zsh/vendor-completions/ | awk -F: '{print $1}' | sed -e 's/,//g')

list_packages "Packages which provide vendor functions" \
$(dpkg-query -S /usr/share/zsh/vendor-functions/ | awk -F: '{print $1}' | sed -e 's/,//g')