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
#!/bin/bash
#
# dpkg mock for dpkg_selections module tests.
# Manages dpkg selections via --get-selections and --set-selections.
#
case "$1" in
--get-selections)
# Return current selections for requested package
package="$2"
# Simulate some pre-held packages
case "$package" in
nginx)
echo "nginx hold"
;;
docker-ce)
echo "docker-ce hold"
;;
curl)
echo "curl install"
;;
vim)
echo "vim install"
;;
bash)
echo "bash install"
;;
*)
# Return empty for unknown packages
;;
esac
;;
--set-selections)
# Read stdin and simulate setting selections
while IFS= read -r line; do
# Parse package selection from stdin
pkg=$(echo "$line" | awk '{print $1}')
sel=$(echo "$line" | awk '{print $2}')
echo "Set selection $sel for $pkg" >&2
done
;;
*)
echo "Unknown dpkg option: $1" >&2
exit 1
;;
esac
exit 0