File: schroot.preinst

package info (click to toggle)
schroot 1.6.13-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,628 kB
  • sloc: cpp: 21,758; sh: 1,019; ansic: 231; makefile: 77
file content (39 lines) | stat: -rw-r--r-- 817 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

set -e

# Source debconf library
. /usr/share/debconf/confmodule

check_chroot_names() {
    list="$(schroot --list --all | LC_ALL=C grep -vE '^[a-z]+:[a-zA-Z0-9][a-zA-Z0-9_.-]*$' | sed -e 's/^/ * /')"
    if [ "$list" ]; then
        # Always show this alert
        db_fset schroot/bad-names seen false
        db_capb escape
        db_subst schroot/bad-names LIST "$(printf '%s' "$list" | debconf-escape -e)"
        db_input critical schroot/bad-names || true
        db_go
        exit 1
    fi
}

case "$1" in
    install) ;;

    upgrade)
        if dpkg --compare-versions "$2" 'lt' '1.6.12-2~'; then
            check_chroot_names
        fi
        ;;

    abort-upgrade) ;;

    *)
        echo "preinst called with unknown argument '$1'" >&2
        exit 1
        ;;
esac

#DEBHELPER#
exit 0