File: mockup-commands

package info (click to toggle)
autopkgtest 5.53
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,600 kB
  • sloc: python: 15,484; sh: 2,317; makefile: 116; perl: 19
file content (62 lines) | stat: -rwxr-xr-x 1,034 bytes parent folder | download
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
56
57
58
59
60
61
62
#!/bin/sh -e

cmd=${0##*/}

case $cmd in
    apt-get)
	echo "fake-$cmd: $*"
        if [ "$1" = source ]; then
	    cp /testpkg_* .
	fi ;;
    apt-cache)
	case "$1" in
	    showsrc)
		cat <<-EOF
		Package: $2
		Package-List:
		 $2 deb utils optional arch=any
		Format: 1.0
		EOF
		;;
	    policy)
		cat <<-EOF
		$2:
		  Installed: 42
		  Candidate: 42
		  Version table:
		 *** 42 500
		        500 http://mirror.invalid/ fluffy/main amd65 Packages
		EOF
		;;
	    *)
		echo "fake-$cmd: $*"
		;;
	esac
	;;
    dpkg)
	if [ "$1" = "--print-architecture" ]; then
	    echo powerpc
	else
	    echo "fake-$cmd: $*"
	fi ;;
    dpkg-query)
	# shellcheck disable=SC2016
        if [ "$*" = '-W -f ${Version} apt' ]; then
	    printf "99:9.9.9"
	else
	    echo "fake-$cmd: $*"
	fi ;;
    dpkg-source)
	echo "fake-$cmd: $*"
        if [ "$1" = "-x" ]; then
	    mkdir "$3"
	    tar -C "$3" --strip-components=1 -xf "${2%.dsc}".tar.*
	fi ;;
    id)
       echo root ;;
    su)
	shift 4
	exec bash -c "$@" ;;
    *)
	echo "fake-$cmd: $*" ;;
esac