1f5c513067aa4d5615ce3164eb8c1e3d819fdb1b
[live-boot-grml.git] / scripts / live-bottom / 24preseed
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 if [ -n "${NOPRESEED}" ]
24 then
25         exit 0
26 fi
27
28 . /scripts/live-functions
29 load_confmodule
30
31 log_begin_msg "Loading preseed file"
32
33 # live-initramfs script
34
35 if [ -e /preseed.cfg ]
36 then
37         live-set-selections /preseed.cfg
38 fi
39
40 if [ -n "${LOCATIONS}" ]
41 then
42         for item in ${LOCATIONS}
43         do
44                 live-set-selections "/root$item"
45         done
46 fi
47
48 if [ -n "${PRESEEDS}" ]
49 then
50         for preseed in ${PRESEEDS}
51         do
52                 question="${preseed%%=*}"
53                 value="${preseed#*=}"
54
55                 live-preseed /root "${question}" "${value}"
56         done
57 fi
58
59 if db_get preseed/early_command && [ "$RET" ]
60 then
61         EARLY="$RET"
62         if db_get preseed/allow-network && [ "$RET" = true ]; then
63                 start_network
64         fi
65
66         DEBIAN_HAS_FRONTEND= DEBCONF_REDIR= \
67         DEBIAN_FRONTEND=noninteractive \
68         sh -c "$EARLY"
69 fi
70
71 stop_network
72
73 # Clear out debconf database backup files to save memory.
74 rm -f /root/var/cache/debconf/*.dat-old
75
76 log_end_msg
77
78 exit 0