Debian Codegraph @

share/build-scripts/debconf.d/0003-debconf

raw symbols SCIP
1 #!/bin/sh
2
3 # Copyright (C) 2014-2026 Daniel Baumann <[email protected]>
4 #
5 # SPDX-License-Identifier: GPL-3.0+
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
20 set -e
21
22 DEBCONF_NOWARNINGS="true"
23 export DEBCONF_NOWARNINGS
24
25 . /usr/share/debconf/confmodule
26
27 Mode ()
28 {
29 db_get container/mode
30 MODE="${RET}" # select
31
32 if [ -z "${MODE}" ]
33 then
34 MODE="$(basename ${SCRIPT})"
35
36 case "${MODE}" in
37 debconf)
38 MODE="debian"
39 ;;
40 esac
41 fi
42
43 echo "MODE=\"${MODE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
44 export MODE
45 }
46
47 Images ()
48 {
49 if db_get container/image && [ "${RET}" ]
50 then
51 db_get container/image
52 IMAGE="${RET}" # string (w/o empty)
53
54 echo "IMAGE=\"${IMAGE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
55 fi
56
57 NUMBER="1"
58
59 while db_get container/image${NUMBER} && [ "${RET}" ]
60 do
61 if db_get container/image${NUMBER}
62 then
63 eval IMAGE${NUMBER}="\"${RET}\"" # string (w/o empty)
64 fi
65
66 NUMBER="$((${NUMBER} + 1))"
67 done
68
69 IMAGE_NUMBER="$((${NUMBER} - 1))"
70
71 echo "IMAGE_NUMBER=\"${IMAGE_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
72
73 for NUMBER in $(seq 1 ${IMAGE_NUMBER})
74 do
75 eval IMAGE="$`echo IMAGE${NUMBER}`"
76 echo "IMAGE${NUMBER}=\"${IMAGE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
77 done
78 }
79
80 Distribution ()
81 {
82 db_get container/distribution
83 DISTRIBUTION="${RET}" # select
84
85 if [ -z "${DISTRIBUTION}" ]
86 then
87 case "${MODE}" in
88 debian)
89 db_subst container/distribution CHOICES "Debian GNU/Linux 10 \"buster\", Debian GNU/Linux 11 \"bullseye\", Debian GNU/Linux 12 \"bookworm\", Debian GNU/Linux 13 \"trixie\", Debian GNU/Linux testing, Debian GNU/Linux unstable/sid"
90 db_subst container/distribution CHOICES_C "buster, bullseye, bookworm, trixie, testing, sid"
91
92 db_set container/distribution trixie
93 db_fset container/distribution seen false
94 ;;
95
96 progress-linux)
97 db_subst container/distribution CHOICES "Progress Linux 5 (engywuck), Progress Linux 5.99 (engywuck-backports), Progress Linux 6 (fuchur), Progress Linux 6.99 (fuchur-backports), Progress Linux 7 (graograman), Progress Linux 7.99 (graograman-backports), Progress Linux 8 (horok), Progress Linux 8.99 (horok-backports)"
98 db_subst container/distribution CHOICES_C "engywuck, engywuck-backports, fuchur, fuchur-backports, graograman, graograman-backports, horok, horok-backports"
99
100 db_set container/distribution horok-backports
101 db_fset container/distribution seen false
102 ;;
103 esac
104
105 db_settitle container/title
106 db_input high container/distribution || true
107 db_go
108
109 db_get container/distribution
110 DISTRIBUTION="${RET}" # select
111 fi
112
113 echo "DISTRIBUTION=\"${DISTRIBUTION}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
114 export DISTRIBUTION
115 }
116
117 Parent_distribution ()
118 {
119 db_get container/parent-distribution
120 PARENT_DISTRIBUTION="${RET}"
121
122 if [ -z "${PARENT_DISTRIBUTION}" ]
123 then
124 case "${MODE}" in
125 progress-linux)
126 case "${DISTRIBUTION}" in
127 engywuck*)
128 PARENT_DISTRIBUTION="buster"
129 ;;
130
131 fuchur*)
132 PARENT_DISTRIBUTION="bullseye"
133 ;;
134
135 graograman*)
136 PARENT_DISTRIBUTION="bookworm"
137 ;;
138
139 horok*)
140 PARENT_DISTRIBUTION="trixie"
141 ;;
142 esac
143 ;;
144
145 *)
146 PARENT_DISTRIBUTION="${DISTRIBUTION}"
147 ;;
148 esac
149 fi
150
151 echo "PARENT_DISTRIBUTION=\"${PARENT_DISTRIBUTION}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
152 export PARENT_DISTRIBUTION
153 }
154
155 Architecture ()
156 {
157 case "$(dpkg --print-architecture)" in
158 amd64)
159 DEFAULT="amd64"
160 CHOICES="Automatic, 32-bit PC (i386), 64-bit PC (amd64)"
161 CHOICES_C="auto, i386, amd64"
162 ;;
163
164 arm64)
165 DEFAULT="arm64"
166 CHOICES="Automatic, RaspberryPi 3 and newer (arm64)"
167 CHOICES_C="auto, arm64"
168 ;;
169
170 i386)
171 case "$(uname -m)" in
172 x86_64)
173 DEFAULT="amd64"
174 CHOICES="Automatic, 32-bit PC (i386), 64-bit PC (amd64)"
175 CHOICES_C="auto, i386, amd64"
176 ;;
177
178 *)
179 DEFAULT="i386"
180 CHOICES=""
181 CHOICES_C=""
182 ;;
183 esac
184 ;;
185
186 *)
187 echo "E: Architecture current not yet supported."
188 exit 1
189 esac
190
191 db_get container/architecture
192 ARCHITECTURE="${RET}" # select
193
194 if [ -z "${ARCHITECTURE}" ] && [ -n "${CHOICES}" ]
195 then
196 db_subst container/architecture CHOICES ${CHOICES}
197 db_subst container/architecture CHOICES_C ${CHOICES_C}
198
199 db_set container/architecture ${DEFAULT}
200 db_fset container/distribution seen false
201
202 db_settitle container/title
203 db_input high container/architecture || true
204 db_go
205
206 db_get container/architecture
207 ARCHITECTURE="${RET}" # select
208 fi
209
210 case "${ARCHITECTURE}" in
211 auto)
212 ARCHITECTURE="${DEFAULT}"
213 ;;
214 esac
215
216 echo "ARCHITECTURE=\"${ARCHITECTURE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
217 export ARCHITECTURE
218 }
219
220 Archives ()
221 {
222 db_get container/archives
223 ARCHIVES="${RET}" # multiselect
224
225 if [ -z "${ARCHIVES}" ]
226 then
227 case "${MODE}" in
228 debian)
229 case "${PARENT_DISTRIBUTION}" in
230 sid)
231 db_subst container/archives CHOICES "sid, experimental"
232
233 db_set container/archives "sid"
234 db_fset container/archives seen false
235 ;;
236
237 *)
238 db_subst container/archives CHOICES "${DISTRIBUTION}, ${DISTRIBUTION}-security, ${DISTRIBUTION}-updates, ${DISTRIBUTION}-backports, ${DISTRIBUTION}-proposed-updates"
239
240 case "${PARENT_DISTRIBUTION}" in
241 sid)
242 db_set container/archives "sid"
243 ;;
244
245 *)
246 db_set container/archives "${DISTRIBUTION}, ${DISTRIBUTION}-security, ${DISTRIBUTION}-updates"
247 ;;
248 esac
249
250 db_fset container/archives seen false
251 ;;
252 esac
253 ;;
254
255 progress-linux)
256 DIST="$(echo ${DISTRIBUTION} | sed -e 's|-backports||')"
257
258 db_subst container/archives CHOICES "${DIST}, ${DIST}-security, ${DIST}-updates, ${DIST}-extras, ${DIST}-backports, ${DIST}-backports-extras"
259
260 db_set container/archives "${DIST}, ${DIST}-security, ${DIST}-updates, ${DIST}-extras, ${DIST}-backports, ${DIST}-backports-extras"
261 db_fset container/archives seen false
262 ;;
263 esac
264
265 db_settitle container/title
266 db_input high container/archives || true
267 db_go
268
269 db_get container/archives
270 ARCHIVES="${RET}" # multiselect
271 fi
272
273 ARCHIVES="$(echo ${ARCHIVES} | sed -e 's|, | |g')"
274
275 echo "ARCHIVES=\"${ARCHIVES}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
276 export ARCHIVES
277 }
278
279 Parent_archives ()
280 {
281 db_get container/parent-archives
282 PARENT_ARCHIVES="${RET}" # multiselect (w/o empty)
283
284 if [ -z "${PARENT_ARCHIVES}" ]
285 then
286 case "${MODE}" in
287 progress-linux)
288 db_subst container/parent-archives CHOICES "${PARENT_DISTRIBUTION}, ${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates, ${PARENT_DISTRIBUTION}-backports, ${PARENT_DISTRIBUTION}-proposed-updates"
289
290 case "${PARENT_DISTRIBUTION}" in
291 *)
292 db_set container/parent-archives "${PARENT_DISTRIBUTION}, ${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates"
293 ;;
294 esac
295
296 db_fset container/parent-archives seen false
297
298 db_settitle container/title
299 db_input high container/parent-archives || true
300 db_go
301 ;;
302
303 *)
304 db_subst container/parent-archives CHOICES "${DISTRIBUTION}, ${DISTRIBUTION}-security, ${DISTRIBUTION}-updates, ${DISTRIBUTION}-backports, ${DISTRIBUTION}-proposed-updates"
305
306 db_set container/parent-archives "${ARCHIVES}"
307 db_fset container/parent-archives seen true
308 ;;
309 esac
310
311 db_get container/parent-archives
312 PARENT_ARCHIVES="${RET}" # multiselect (w/o empty)
313
314 if [ -z "${PARENT_ARCHIVES}" ]
315 then
316 case "${MODE}" in
317 progress-linux)
318 case "${PARENT_DISTRIBUTION}" in
319 *)
320 PARENT_ARCHIVES="${PARENT_DISTRIBUTION}, ${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates"
321 ;;
322 esac
323 ;;
324
325 *)
326 PARENT_ARCHIVES="${ARCHIVES}"
327 ;;
328 esac
329 fi
330 fi
331
332 PARENT_ARCHIVES="$(echo ${PARENT_ARCHIVES} | sed -e 's|, | |g')"
333
334 echo "PARENT_ARCHIVES=\"${PARENT_ARCHIVES}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
335 export PARENT_ARCHIVES
336 }
337
338 Mirror ()
339 {
340 db_get container/mirror
341 MIRROR="${RET}"
342
343 if [ -z "${MIRROR}" ]
344 then
345 case "${MODE}" in
346 debian)
347 db_set container/mirror https://deb.debian.org/debian
348 db_fset container/mirror seen false
349 ;;
350
351 progress-linux)
352 db_set container/mirror https://deb.progress-linux.org/packages
353 db_fset container/mirror seen false
354 ;;
355 esac
356
357 db_settitle container/title
358 db_input high container/mirror || true
359 db_go
360
361 db_get container/mirror
362 MIRROR="${RET}" # string (w/o empty)
363
364 if [ -z "${MIRROR}" ]
365 then
366 case "${MODE}" in
367 debian)
368 MIRROR="https://deb.debian.org/debian"
369 ;;
370
371 progress-linux)
372 MIRROR="https://deb.progress-linux.org/packages"
373 ;;
374 esac
375 fi
376 fi
377
378 echo "MIRROR=\"${MIRROR}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
379 export MIRROR
380 }
381
382 Mirror_security ()
383 {
384 if ! echo "${ARCHIVES}" | grep -qs "-security"
385 then
386 return 0
387 fi
388
389 db_get container/mirror-security
390 MIRROR_SECURITY="${RET}" # string (w/o empty)
391
392 if [ -z "${MIRROR_SECURITY}" ]
393 then
394 case "${MODE}" in
395 debian)
396 db_set container/mirror-security https://deb.debian.org/debian-security
397 db_fset container/mirror-security seen false
398 ;;
399
400 *)
401 db_set container/mirror-security ${MIRROR}
402 db_fset container/mirror-security seen true
403 ;;
404 esac
405
406 db_settitle container/title
407 db_input high container/mirror-security || true
408 db_go
409
410 db_get container/mirror-security
411 MIRROR_SECURITY="${RET}" # string (w/o empty)
412
413 if [ -z "${MIRROR_SECURITY}" ]
414 then
415 case "${MODE}" in
416 debian)
417 MIRROR_SECURITY="https://deb.debian.org/debian-security"
418 ;;
419
420 *)
421 MIRROR_SECURITY="${MIRROR}"
422 ;;
423 esac
424 fi
425 fi
426
427 echo "MIRROR_SECURITY=\"${MIRROR_SECURITY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
428 export MIRROR_SECURITY
429 }
430
431 Parent_mirror ()
432 {
433 db_get container/parent-mirror
434 PARENT_MIRROR="${RET}" # string (w/o empty)
435
436 if [ -z "${PARENT_MIRROR}" ]
437 then
438 case "${MODE}" in
439 progress-linux)
440 db_set container/parent-mirror https://deb.debian.org/debian
441 db_fset container/parent-mirror seen false
442
443 db_settitle container/title
444 db_input high container/parent-mirror || true
445 db_go
446 ;;
447
448 *)
449 db_set container/parent-mirror ${MIRROR}
450 db_fset container/parent-mirror seen true
451 ;;
452 esac
453
454 db_get container/parent-mirror
455 PARENT_MIRROR="${RET}" # string (w/o empty)
456
457 if [ -z "${PARENT_MIRROR}" ]
458 then
459 case "${MODE}" in
460 progress-linux)
461 PARENT_MIRROR="https://deb.debian.org/debian"
462 ;;
463
464 *)
465 PARENT_MIRROR="${MIRROR}"
466 ;;
467 esac
468 fi
469 fi
470
471 echo "PARENT_MIRROR=\"${PARENT_MIRROR}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
472 export PARENT_MIRROR
473 }
474
475 Parent_mirror_security ()
476 {
477 if ! echo "${PARENT_ARCHIVES}" | grep -qs "-security"
478 then
479 return 0
480 fi
481
482 db_get container/parent-mirror-security
483 PARENT_MIRROR_SECURITY="${RET}" # string (w/o empty)
484
485 if [ -z "${PARENT_MIRROR_SECURITY}" ]
486 then
487 case "${MODE}" in
488 progress-linux)
489 db_set container/parent-mirror-security https://deb.debian.org/debian-security
490 db_fset container/parent-mirror-security seen false
491
492 db_settitle container/title
493 db_input high container/parent-mirror-security || true
494 db_go
495 ;;
496
497 *)
498 db_set container/parent-mirror-security ${MIRROR_SECURITY}
499 db_fset container/parent-mirror-security seen true
500 ;;
501 esac
502
503 db_get container/parent-mirror-security
504 PARENT_MIRROR_SECURITY="${RET}" # string (w/o empty)
505
506 if [ -z "${PARENT_MIRROR_SECURITY}" ]
507 then
508 case "${MODE}" in
509 progress-linux)
510 PARENT_MIRROR_SECURITY="https://deb.debian.org/debian-security"
511 ;;
512
513 *)
514 PARENT_MIRROR_SECURITY="${MIRROR_SECURITY}"
515 ;;
516 esac
517 fi
518 fi
519
520 echo "PARENT_MIRROR_SECURITY=\"${PARENT_MIRROR_SECURITY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
521 export PARENT_MIRROR_SECURITY
522 }
523
524 Archive_areas ()
525 {
526 db_get container/archive-areas
527 ARCHIVE_AREAS="${RET}"
528
529 case "${PARENT_DISTRIBUTION}" in
530 buster|bullseye)
531 ARCHIVE_AREAS_ALL="main, contrib, non-free"
532 ;;
533
534 *)
535 ARCHIVE_AREAS_ALL="main, contrib, non-free, non-free-firmware"
536 ;;
537 esac
538
539 if [ -z "${ARCHIVE_AREAS}" ]
540 then
541 case "${MODE}" in
542 progress-linux)
543 db_subst container/archive-areas CHOICES "${ARCHIVE_AREAS_ALL}"
544
545 db_set container/archive-areas "${ARCHIVE_AREAS_ALL}"
546 db_fset container/archive-areas seen false
547 ;;
548
549 *)
550 db_subst container/archive-areas CHOICES "${ARCHIVE_AREAS_ALL}"
551
552 db_set container/archive-areas "main"
553 db_fset container/archive-areas seen false
554 ;;
555 esac
556
557 db_settitle container/title
558 db_input high container/archive-areas || true
559 db_go
560
561 db_get container/archive-areas
562 ARCHIVE_AREAS="${RET}" # multiselect (w/o empty)
563
564 if [ -z "${ARCHIVE_AREAS}" ]
565 then
566 case "${MODE}" in
567 debian)
568 ARCHIVE_AREAS="main"
569 ;;
570
571 progress-linux)
572 ARCHIVE_AREAS="${ARCHIVE_AREAS_ALL}"
573 ;;
574 esac
575 fi
576 fi
577
578 ARCHIVE_AREAS="$(echo ${ARCHIVE_AREAS} | sed -e 's| ||g')"
579
580 echo "ARCHIVE_AREAS=\"${ARCHIVE_AREAS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
581 export ARCHIVE_AREAS
582 }
583
584 Parent_archive_areas ()
585 {
586 db_get container/parent-archive-areas
587 PARENT_ARCHIVE_AREAS="${RET}" # multiselect (w/o empty)
588
589 case "${PARENT_DISTRIBUTION}" in
590 buster|bullseye)
591 PARENT_ARCHIVE_AREAS_ALL="main, contrib, non-free"
592 ;;
593
594 *)
595 PARENT_ARCHIVE_AREAS_ALL="main, contrib, non-free, non-free-firmware"
596 ;;
597 esac
598
599 if [ -z "${PARENT_ARCHIVE_AREAS}" ]
600 then
601 case "${MODE}" in
602 progress-linux)
603 db_subst container/parent-archive-areas CHOICES "${PARENT_ARCHIVE_AREAS_ALL}"
604
605 db_set container/parent-archive-areas "${PARENT_ARCHIVE_AREAS_ALL}"
606 db_fset container/parent-archive-areas seen false
607
608 db_settitle container/title
609 db_input high container/parent-archive-areas || true
610 db_go
611 ;;
612
613 *)
614 db_subst container/parent-archive-areas CHOICES "${ARCHIVE_AREAS}"
615
616 db_set container/parent-archive-areas "${ARCHIVE_AREAS}"
617 db_fset container/parent-archive-areas seen true
618 ;;
619 esac
620
621 db_get container/parent-archive-areas
622 PARENT_ARCHIVE_AREAS="${RET}" # multiselect (w/o empty)
623
624 if [ -z "${PARENT_ARCHIVE_AREAS}" ]
625 then
626 case "${MODE}" in
627 progress-linux)
628 PARENT_ARCHIVE_AREAS="${PARENT_ARCHIVE_AREAS_ALL}"
629 ;;
630
631 *)
632 PARENT_ARCHIVE_AREAS="${ARCHIVE_AREAS}"
633 ;;
634 esac
635 fi
636 fi
637
638 PARENT_ARCHIVE_AREAS="$(echo ${PARENT_ARCHIVE_AREAS} | sed -e 's| ||g')"
639
640 echo "PARENT_ARCHIVE_AREAS=\"${PARENT_ARCHIVE_AREAS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
641 export PARENT_ARCHIVE_AREAS
642 }
643
644 Packages ()
645 {
646 db_get container/packages
647 PACKAGES="${RET}" # string (w/ empty)
648
649 if [ -z "${PACKAGES}" ]
650 then
651 db_settitle container/title
652 db_input high container/packages || true
653 db_go
654
655 db_get container/packages
656 PACKAGES="${RET}" # string (w/ empty)
657 fi
658
659 echo "PACKAGES=\"${PACKAGES}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
660 export PACKAGES
661 }
662
663 Local_archives ()
664 {
665 NUMBER="1"
666
667 while db_get container/archive${NUMBER}/repository && [ "${RET}" ]
668 do
669 mkdir -p "${DEBCONF_TMPDIR}/apt"
670
671 REPOSITORY="$(echo "${RET}" | sed -e 's|^deb ||')"
672
673 MIRROR="$(echo ${REPOSITORY} | cut -d' ' -f1)"
674 SUITES="$(echo ${REPOSITORY} | cut -d' ' -f2)"
675 AREAS="$(echo ${REPOSITORY} | cut -d' ' -f3-)"
676
677 LIST="archive${NUMBER}.sources"
678 if db_get container/archive${NUMBER}/list
679 then
680 LIST="$(basename ${RET} .sources).sources"
681 fi
682
683 COMMENT=""
684 if db_get container/archive${NUMBER}/comment
685 then
686 COMMENT="${RET}"
687
688 cat > "${DEBCONF_TMPDIR}/apt/${LIST}" << EOF
689 # ${COMMENT}
690
691 EOF
692
693 fi
694
695 if db_get container/archive${NUMBER}/source && [ "$RET" = true ]
696 then
697 TYPES="deb deb-src"
698 else
699 TYPES="deb"
700 fi
701
702 KEY=""
703 if db_get container/archive${NUMBER}/key
704 then
705 KEY="${RET}"
706
707 curl -q "${KEY}" -o "${DEBCONF_TMPDIR}/apt/$(basename ${LIST} .sources).key"
708
709 SIGNED="/etc/apt/keyrings/$(basename ${LIST} .sources).key"
710 else
711 SIGNED=""
712 fi
713
714 cat > "${DEBCONF_TMPDIR}/apt/${LIST}" << EOF
715 Types: deb
716 URIs: ${MIRROR}
717 Suites: ${SUITES}
718 Components: ${AREAS}
719 PDiffs: no
720 EOF
721
722 if [ -n "${SIGNED}" ]
723 then
724
725 cat >> "${DEBCONF_TMPDIR}/apt/${LIST}" << EOF
726 Signed-By: ${SIGNED}
727 EOF
728
729 fi
730
731 PREFERENCES_PACKAGE=""
732 PREFERENCES_PIN=""
733 PREFERENCES_PIN_PRIORITY=""
734 if db_get container/archive${NUMBER}/preferences-package
735 then
736 PREFERENCES_PACKAGE="${RET}"
737
738 if db_get container/archive${NUMBER}/preferences-pin
739 then
740 PREFERENCES_PIN="${RET}"
741 fi
742
743 if db_get container/archive${NUMBER}/preferences-pin-priority
744 then
745 PREFERENCES_PIN_PRIORITY="${RET}"
746 fi
747
748 if [ -n "${PREFERENCES_PACKAGE}" ] || [ -n "${PREFERENCES_PIN}" ] || [ -n "${PREFERENCES_PIN_PRIORITY}" ]
749 then
750 if [ -n "${COMMENT}" ]
751 then
752
753 cat > "${DEBCONF_TMPDIR}/apt/$(basename ${LIST} .sources).pref" << EOF
754 # ${COMMENT}
755
756 EOF
757
758 fi
759
760 cat >> "${DEBCONF_TMPDIR}/apt/$(basename ${LIST} .sources).pref" << EOF
761 Package: ${PREFERENCES_PACKAGE}
762 Pin: ${PREFERENCES_PIN}
763 Pin-Priority: ${PREFERENCES_PIN_PRIORITY}
764 EOF
765
766 fi
767 fi
768
769 NUMBER="$((${NUMBER} + 1))"
770 done
771 }
772
773 Network_defaults ()
774 {
775 HOSTNAME_SHORT="$(echo veth-$(echo ${NAME} | cut -c-8)-0)"
776 VETH_NAME="${HOSTNAME_SHORT}"
777
778 NETWORK1_VETH="${NETWORK1_VETH:-$VETH_NAME}"
779 NETWORK1_BRIDGE="${NETWORK1_BRIDGE:-bridge0}"
780
781 NETWORK1_IPV4_METHOD="${NETWORK1_IPV4_METHOD:-dhcp}"
782 NETWORK1_IPV4_ADDRESS="${NETWORK1_IPV4_ADDRESS:-192.168.1.2}"
783 NETWORK1_IPV4_NETMASK="${NETWORK1_IPV4_NETMASK:-24}"
784
785 NETWORK1_IPV6_METHOD="${NETWORK1_IPV6_METHOD:-none}"
786 NETWORK1_IPV6_ADDRESS="${NETWORK1_IPV6_ADDRESS:-fc00::2}"
787 NETWORK1_IPV6_NETMASK="${NETWORK1_IPV6_NETMASK:-7}"
788
789 if [ "${NETWORK1_IPV4_METHOD}" = "static" ] || [ "${NETWORK1_IPV6_METHOD}" = "static" ]
790 then
791 if [ -e /etc/resolv.conf ]
792 then
793 NAMESERVER_SERVER="${NAMESERVER_SERVER:-$(awk '/^nameserver / {$1=""; print $0}' /etc/resolv.conf)}"
794 # Workaround to get rid of newlines since debconf can not handle multiline return value in assignments
795 NAMESERVER_SERVER="$(echo ${NAMESERVER_SERVER})"
796
797 NAMESERVER_DOMAIN="${NAMESERVER_DOMAIN:-$(awk '/^domain / {$1=""; print $0}' /etc/resolv.conf)}"
798 NAMESERVER_SEARCH="${NAMESERVER_SEARCH:-$(awk '/^search / {$1=""; print $0}' /etc/resolv.conf)}"
799 NAMESERVER_OPTIONS="${NAMESERVER_OPTIONS:-$(awk '/^options / {$1=""; print $0}' /etc/resolv.conf)}"
800 fi
801 fi
802 }
803
804 Network ()
805 {
806 db_get container/network1/bridge
807 NETWORK1_BRIDGE="${RET}" # string (w/o empty)
808
809 db_get container/network1/veth
810 NETWORK1_VETH="${RET}" # string (w/o empty)
811
812 db_get container/network1/ipv4-method
813 NETWORK1_IPV4_METHOD="${RET}" # select
814
815 db_get container/network1/ipv4-comment
816 NETWORK1_IPV4_COMMENT="${RET}" # string (w/ empty)
817
818 db_get container/network1/ipv4-address
819 NETWORK1_IPV4_ADDRESS="${RET}" # string (w/o empty)
820
821 db_get container/network1/ipv4-gateway
822 NETWORK1_IPV4_GATEWAY="${RET}" # string (w/ empty)
823
824 db_get container/network1/ipv4-netmask
825 NETWORK1_IPV4_NETMASK="${RET}" # string (w/o empty)
826
827 db_get container/network1/ipv4-post-up
828 NETWORK1_IPV4_POST_UP="${RET}" # string (w/ empty)
829
830 db_get container/network1/ipv4-post-down
831 NETWORK1_IPV4_POST_DOWN="${RET}" # string (w/ empty)
832
833 db_get container/network1/ipv6-method
834 NETWORK1_IPV6_METHOD="${RET}" # select
835
836 db_get container/network1/ipv6-comment
837 NETWORK1_IPV6_COMMENT="${RET}" # string (w/ empty)
838
839 db_get container/network1/ipv6-address
840 NETWORK1_IPV6_ADDRESS="${RET}" # string (w/o empty)
841
842 db_get container/network1/ipv6-gateway
843 NETWORK1_IPV6_GATEWAY="${RET}" # string (w/ empty)
844
845 db_get container/network1/ipv6-netmask
846 NETWORK1_IPV6_NETMASK="${RET}" # string (w/o empty)
847
848 db_get container/network1/ipv6-post-up
849 NETWORK1_IPV6_POST_UP="${RET}" # string (w/ empty)
850
851 db_get container/network1/ipv6-post-down
852 NETWORK1_IPV6_POST_DOWN="${RET}" # string (w/ empty)
853
854 db_get container/nameserver/server
855 NAMESERVER_SERVER="${RET}" # string (w/ empty)
856
857 db_get container/nameserver/domain
858 NAMESERVER_DOMAIN="${RET}" # string (w/ empty)
859
860 db_get container/nameserver/search
861 NAMESERVER_SEARCH="${RET}" # string (w/ empty)
862
863 db_get container/nameserver/options
864 NAMESERVER_OPTIONS="${RET}" # string (w/ empty)
865
866 Network_defaults
867
868 db_set container/network1/bridge "${NETWORK1_BRIDGE}"
869 db_fset container/network1/bridge seen false
870
871 db_set container/network1/veth "${NETWORK1_VETH}"
872 db_fset container/network1/veth seen false
873
874 db_set container/network1/ipv4-method "${NETWORK1_IPV4_METHOD}"
875 db_fset container/network1/ipv4-method seen false
876
877 db_set container/network1/ipv4-comment "${NETWORK1_IPV4_COMMENT}"
878 db_fset container/network1/ipv4-comment seen false
879
880 db_set container/network1/ipv4-address "${NETWORK1_IPV4_ADDRESS}"
881 db_fset container/network1/ipv4-address seen false
882
883 db_set container/network1/ipv4-gateway "${NETWORK1_IPV4_GATEWAY}"
884 db_fset container/network1/ipv4-gateway seen false
885
886 db_set container/network1/ipv4-netmask "${NETWORK1_IPV4_NETMASK}"
887 db_fset container/network1/ipv4-netmask seen false
888
889 db_set container/network1/ipv4-post-up "${NETWORK1_IPV4_POST_UP}"
890 db_fset container/network1/ipv4-post-up seen false
891
892 db_set container/network1/ipv4-post-down "${NETWORK1_IPV4_POST_DOWN}"
893 db_fset container/network1/ipv4-post-down seen false
894
895 db_set container/network1/ipv6-method "${NETWORK1_IPV6_METHOD}"
896 db_fset container/network1/ipv6-method seen false
897
898 db_set container/network1/ipv6-comment "${NETWORK1_IPV6_COMMENT}"
899 db_fset container/network1/ipv6-comment seen false
900
901 db_set container/network1/ipv6-address "${NETWORK1_IPV6_ADDRESS}"
902 db_fset container/network1/ipv6-address seen false
903
904 db_set container/network1/ipv6-gateway "${NETWORK1_IPV6_GATEWAY}"
905 db_fset container/network1/ipv6-gateway seen false
906
907 db_set container/network1/ipv6-netmask "${NETWORK1_IPV6_NETMASK}"
908 db_fset container/network1/ipv6-netmask seen false
909
910 db_set container/network1/ipv6-post-up "${NETWORK1_IPV6_POST_UP}"
911 db_fset container/network1/ipv6-post-up seen false
912
913 db_set container/network1/ipv6-post-down "${NETWORK1_IPV6_POST_DOWN}"
914 db_fset container/network1/ipv6-post-down seen false
915
916 db_set container/nameserver/server "${NAMESERVER_SERVER}"
917 db_fset container/nameserver/server seen false
918
919 db_set container/nameserver/domain "${NAMESERVER_DOMAIN}"
920 db_fset container/nameserver/domain seen false
921
922 db_set container/nameserver/search "${NAMESERVER_SEARCH}"
923 db_fset container/nameserver/search seen false
924
925 db_set container/nameserver/options "${NAMESERVER_OPTIONS}"
926 db_fset container/nameserver/options seen false
927
928 db_get container/network1/bridge
929 NETWORK1_BRIDGE="${RET}" # select
930
931 db_get container/network1/veth
932 NETWORK1_VETH="${RET}" # select
933
934 db_settitle container/title
935 db_input high container/network1/ipv4-method || true
936 db_go
937
938 db_get container/network1/ipv4-method
939 NETWORK1_IPV4_METHOD="${RET}" # select
940
941 case "${NETWORK1_IPV4_METHOD}" in
942 none|dhcp)
943 ;;
944
945 static)
946 db_settitle container/title
947 db_input high container/network1/ipv4-comment || true
948 db_go
949
950 db_settitle container/title
951 db_input high container/network1/ipv4-address || true
952 db_go
953
954 db_settitle container/title
955 db_input high container/network1/ipv4-gateway || true
956 db_go
957
958 db_settitle container/title
959 db_input high container/network1/ipv4-netmask || true
960 db_go
961
962 db_settitle container/title
963 db_input high container/network1/ipv4-post-up || true
964 db_go
965
966 db_settitle container/title
967 db_input high container/network1/ipv4-post-down || true
968 db_go
969 ;;
970
971 stub)
972 db_settitle container/title
973 db_input high container/network1/ipv4-comment || true
974 db_go
975
976 db_settitle container/title
977 db_input high container/network1/ipv4-post-up || true
978 db_go
979
980 db_settitle container/title
981 db_input high container/network1/ipv4-post-down || true
982 db_go
983 ;;
984 esac
985
986 db_settitle container/title
987 db_input high container/network1/ipv6-method || true
988 db_go
989
990 db_get container/network1/ipv6-method
991 NETWORK1_IPV6_METHOD="${RET}" # select
992
993 case "${NETWORK1_IPV6_METHOD}" in
994 none|dhcp)
995 ;;
996
997 static)
998 db_settitle container/title
999 db_input high container/network1/ipv6-comment || true
1000 db_go
1001
1002 db_settitle container/title
1003 db_input high container/network1/ipv6-address || true
1004 db_go
1005
1006 db_settitle container/title
1007 db_input high container/network1/ipv6-gateway || true
1008 db_go
1009
1010 db_settitle container/title
1011 db_input high container/network1/ipv6-netmask || true
1012 db_go
1013
1014 db_settitle container/title
1015 db_input high container/network1/ipv6-post-up || true
1016 db_go
1017
1018 db_settitle container/title
1019 db_input high container/network1/ipv6-post-down || true
1020 db_go
1021 ;;
1022
1023 stub)
1024 db_settitle container/title
1025 db_input high container/network1/ipv6-comment || true
1026 db_go
1027
1028 db_settitle container/title
1029 db_input high container/network1/ipv6-post-up || true
1030 db_go
1031
1032 db_settitle container/title
1033 db_input high container/network1/ipv6-post-down || true
1034 db_go
1035 ;;
1036 esac
1037
1038 if [ "${NETWORK1_IPV4_METHOD}" = "static" ] || [ "${NETWORK1_IPV6_METHOD}" = "static" ]
1039 then
1040 db_settitle container/title
1041 db_input high container/nameserver/server || true
1042 db_go
1043 fi
1044
1045 NUMBER="1"
1046
1047 while ( db_get container/network${NUMBER}/ipv4-method && [ "${RET}" ] ) || ( db_get container/network${NUMBER}/ipv6-method && [ "${RET}" ] )
1048 do
1049 if db_get container/network${NUMBER}/bridge
1050 then
1051 eval NETWORK${NUMBER}_BRIDGE="\"${RET}\"" # string (w/o empty)
1052 fi
1053
1054 if db_get container/network${NUMBER}/veth
1055 then
1056 eval NETWORK${NUMBER}_VETH="\"${RET}\"" # string (w/o empty)
1057 fi
1058
1059 NUMBER="$((${NUMBER} + 1))"
1060 done
1061
1062 NETWORK_NUMBER="$((${NUMBER} - 1))"
1063
1064 for NUMBER in $(seq 1 ${NETWORK_NUMBER})
1065 do
1066 if db_get container/network${NUMBER}/ipv4-comment
1067 then
1068 eval NETWORK${NUMBER}_IPV4_COMMENT="\"${RET}\"" # string (w/ empty)
1069 fi
1070
1071 if db_get container/network${NUMBER}/ipv4-method
1072 then
1073 eval NETWORK${NUMBER}_IPV4_METHOD="\"${RET}\"" # select
1074 fi
1075
1076 if db_get container/network${NUMBER}/ipv4-address
1077 then
1078 eval NETWORK${NUMBER}_IPV4_ADDRESS="\"${RET}\"" # string (w/o empty)
1079 fi
1080
1081 if db_get container/network${NUMBER}/ipv4-gateway
1082 then
1083 eval NETWORK${NUMBER}_IPV4_GATEWAY="\"${RET}\"" # string (w/ empty)
1084 fi
1085
1086 if db_get container/network${NUMBER}/ipv4-netmask
1087 then
1088 eval NETWORK${NUMBER}_IPV4_NETMASK="\"${RET}\"" # string (w/o empty)
1089 fi
1090
1091 if db_get container/network${NUMBER}/ipv4-post-up
1092 then
1093 eval NETWORK${NUMBER}_IPV4_POST_UP="\"${RET}\"" # string (w/ empty)
1094 fi
1095
1096 if db_get container/network${NUMBER}/ipv4-post-down
1097 then
1098 eval NETWORK${NUMBER}_IPV4_POST_DOWN="\"${RET}\"" # string (w/ empty)
1099 fi
1100 done
1101
1102 for NUMBER in $(seq 1 ${NETWORK_NUMBER})
1103 do
1104 if db_get container/network${NUMBER}/ipv6-comment
1105 then
1106 eval NETWORK${NUMBER}_IPV6_COMMENT="\"${RET}\"" # string (w/ empty)
1107 fi
1108
1109 if db_get container/network${NUMBER}/ipv6-method
1110 then
1111 eval NETWORK${NUMBER}_IPV6_METHOD="\"${RET}\"" # select
1112 fi
1113
1114 if db_get container/network${NUMBER}/ipv6-address
1115 then
1116 eval NETWORK${NUMBER}_IPV6_ADDRESS="\"${RET}\"" # string (w/o empty)
1117 fi
1118
1119 if db_get container/network${NUMBER}/ipv6-gateway
1120 then
1121 eval NETWORK${NUMBER}_IPV6_GATEWAY="\"${RET}\"" # string (w/ empty)
1122 fi
1123
1124 if db_get container/network${NUMBER}/ipv6-netmask
1125 then
1126 eval NETWORK${NUMBER}_IPV6_NETMASK="\"${RET}\"" # string (w/o empty)
1127 fi
1128
1129 if db_get container/network${NUMBER}/ipv6-post-up
1130 then
1131 eval NETWORK${NUMBER}_IPV6_POST_UP="\"${RET}\"" # string (w/ empty)
1132 fi
1133
1134 if db_get container/network${NUMBER}/ipv6-post-down
1135 then
1136 eval NETWORK${NUMBER}_IPV6_POST_DOWN="\"${RET}\"" # string (w/ empty)
1137 fi
1138 done
1139
1140 db_get container/nameserver/server
1141 NAMESERVER_SERVER="${RET}" # string (w/ empty)
1142
1143 db_get container/nameserver/domain
1144 NAMESERVER_DOMAIN="${RET}" # string (w/ empty)
1145
1146 db_get container/nameserver/search
1147 NAMESERVER_SEARCH="${RET}" # string (w/ empty)
1148
1149 db_get container/nameserver/options
1150 NAMESERVER_OPTIONS="${RET}" # string (w/ empty)
1151
1152 Network_defaults
1153
1154 echo "NETWORK_NUMBER=\"${NETWORK_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1155
1156 for NUMBER in $(seq 1 ${NETWORK_NUMBER})
1157 do
1158 eval BRIDGE="$`echo NETWORK${NUMBER}_BRIDGE`"
1159 echo "NETWORK${NUMBER}_BRIDGE=\"${BRIDGE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1160
1161 eval VETH="$`echo NETWORK${NUMBER}_VETH`"
1162 echo "NETWORK${NUMBER}_VETH=\"${VETH}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1163
1164 eval COMMENT="$`echo NETWORK${NUMBER}_IPV4_COMMENT`"
1165 echo "NETWORK${NUMBER}_IPV4_COMMENT=\"${COMMENT}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1166
1167 eval METHOD="$`echo NETWORK${NUMBER}_IPV4_METHOD`"
1168 echo "NETWORK${NUMBER}_IPV4_METHOD=\"${METHOD}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1169
1170 eval ADDRESS="$`echo NETWORK${NUMBER}_IPV4_ADDRESS`"
1171 echo "NETWORK${NUMBER}_IPV4_ADDRESS=\"${ADDRESS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1172
1173 eval GATEWAY="$`echo NETWORK${NUMBER}_IPV4_GATEWAY`"
1174 echo "NETWORK${NUMBER}_IPV4_GATEWAY=\"${GATEWAY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1175
1176 eval NETMASK="$`echo NETWORK${NUMBER}_IPV4_NETMASK`"
1177 echo "NETWORK${NUMBER}_IPV4_NETMASK=\"${NETMASK}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1178
1179 eval POST_UP="$`echo NETWORK${NUMBER}_IPV4_POST_UP`"
1180 echo "NETWORK${NUMBER}_IPV4_POST_UP=\"${POST_UP}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1181
1182 eval POST_DOWN="$`echo NETWORK${NUMBER}_IPV4_POST_DOWN`"
1183 echo "NETWORK${NUMBER}_IPV4_POST_DOWN=\"${POST_DOWN}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1184
1185 eval COMMENT="$`echo NETWORK${NUMBER}_IPV6_COMMENT`"
1186 echo "NETWORK${NUMBER}_IPV6_COMMENT=\"${COMMENT}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1187
1188 eval METHOD="$`echo NETWORK${NUMBER}_IPV6_METHOD`"
1189 echo "NETWORK${NUMBER}_IPV6_METHOD=\"${METHOD}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1190
1191 eval ADDRESS="$`echo NETWORK${NUMBER}_IPV6_ADDRESS`"
1192 echo "NETWORK${NUMBER}_IPV6_ADDRESS=\"${ADDRESS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1193
1194 eval GATEWAY="$`echo NETWORK${NUMBER}_IPV6_GATEWAY`"
1195 echo "NETWORK${NUMBER}_IPV6_GATEWAY=\"${GATEWAY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1196
1197 eval NETMASK="$`echo NETWORK${NUMBER}_IPV6_NETMASK`"
1198 echo "NETWORK${NUMBER}_IPV6_NETMASK=\"${NETMASK}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1199
1200 eval POST_UP="$`echo NETWORK${NUMBER}_IPV6_POST_UP`"
1201 echo "NETWORK${NUMBER}_IPV6_POST_UP=\"${POST_UP}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1202
1203 eval POST_DOWN="$`echo NETWORK${NUMBER}_IPV6_POST_DOWN`"
1204 echo "NETWORK${NUMBER}_IPV6_POST_DOWN=\"${POST_DOWN}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1205 done
1206
1207 echo "NAMESERVER_SERVER=\"${NAMESERVER_SERVER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1208 echo "NAMESERVER_DOMAIN=\"${NAMESERVER_DOMAIN}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1209 echo "NAMESERVER_SEARCH=\"${NAMESERVER_SEARCH}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1210 echo "NAMESERVER_OPTIONS=\"${NAMESERVER_OPTIONS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1211 }
1212
1213 Root_password ()
1214 {
1215 if db_get container/root-password
1216 then
1217 ROOT_PASSWORD="${RET}" # string (w/o empty)
1218 fi
1219
1220 if [ -z "${ROOT_PASSWORD}" ]
1221 then
1222 # Create a random password as suggestion for the user
1223 RANDOM_PASSWORD="$(dd if=/dev/urandom bs=12 count=1 2> /dev/null | base64)"
1224
1225 db_set container/root-password ${RANDOM_PASSWORD}
1226 db_fset container/root-password seen false
1227
1228 db_settitle container/title
1229 db_input high container/root-password || true
1230 db_go
1231
1232 db_get container/root-password
1233 ROOT_PASSWORD="${RET}"
1234
1235 if [ -z "${ROOT_PASSWORD}" ]
1236 then
1237 # User did set not set a password, falling back to random password
1238 ROOT_PASSWORD="${RANDOM_PASSWORD}"
1239 fi
1240
1241 if [ "${ROOT_PASSWORD}" = "${RANDOM_PASSWORD}" ]
1242 then
1243 echo "ROOT_RANDOM_PASSWORD=\"true\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1244 fi
1245 fi
1246
1247 echo "ROOT_PASSWORD=\"${ROOT_PASSWORD}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1248 }
1249
1250 Internal_options ()
1251 {
1252 if db_get container/apt-recommends
1253 then
1254 APT_RECOMMENDS="${RET}" # boolean (w/ empty)
1255 fi
1256
1257 echo "APT_RECOMMENDS=\"${APT_RECOMMENDS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1258
1259 if db_get container/debconf-frontend
1260 then
1261 DEBCONF_FRONTEND="${RET}" # select
1262 fi
1263
1264 DEBCONF_FRONTEND="${DEBCONF_FRONTEND:-dialog}"
1265 echo "DEBCONF_FRONTEND=\"${DEBCONF_FRONTEND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1266
1267 if db_get container/debconf-priority
1268 then
1269 DEBCONF_PRIORITY="${RET}" # select
1270 fi
1271
1272 DEBCONF_PRIORITY="${DEBCONF_PRIORITY:-high}"
1273 echo "DEBCONF_PRIORITY=\"${DEBCONF_PRIORITY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1274
1275 if db_get container/container-command
1276 then
1277 CONTAINER_COMMAND="${RET}" # string (w/ empty)
1278 fi
1279
1280 echo "CONTAINER_COMMAND=\"${CONTAINER_COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1281
1282 NUMBER="1"
1283
1284 while db_get container/container-command${NUMBER} && [ "${RET}" ]
1285 do
1286 if db_get container/container-command${NUMBER}
1287 then
1288 eval CONTAINER_COMMAND${NUMBER}="\"${RET}\"" # string (w/o empty)
1289 fi
1290
1291 NUMBER="$((${NUMBER} + 1))"
1292 done
1293
1294 CONTAINER_COMMAND_NUMBER="$((${NUMBER} - 1))"
1295
1296 echo "CONTAINER_COMMAND_NUMBER=\"${CONTAINER_COMMAND_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1297
1298 for NUMBER in $(seq 1 ${CONTAINER_COMMAND_NUMBER})
1299 do
1300 eval COMMAND="$`echo CONTAINER_COMMAND${NUMBER}`"
1301 echo "CONTAINER_COMMAND${NUMBER}=\"${COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1302 done
1303
1304 if db_get container/host-command
1305 then
1306 HOST_COMMAND="${RET}" # string (w/ empty)
1307 fi
1308
1309 echo "HOST_COMMAND=\"${HOST_COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1310
1311 NUMBER="1"
1312
1313 while db_get container/host-command${NUMBER} && [ "${RET}" ]
1314 do
1315 if db_get container/host-command${NUMBER}
1316 then
1317 eval HOST_COMMAND${NUMBER}="\"${RET}\"" # string (w/o empty)
1318 fi
1319
1320 NUMBER="$((${NUMBER} + 1))"
1321 done
1322
1323 HOST_COMMAND_NUMBER="$((${NUMBER} - 1))"
1324
1325 echo "HOST_COMMAND_NUMBER=\"${HOST_COMMAND_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1326
1327 for NUMBER in $(seq 1 ${HOST_COMMAND_NUMBER})
1328 do
1329 eval COMMAND="$`echo HOST_COMMAND${NUMBER}`"
1330 echo "HOST_COMMAND${NUMBER}=\"${COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1331 done
1332
1333 if db_get container/auto
1334 then
1335 CNT_AUTO="${RET:-last-on}" # string (w/o empty)
1336 fi
1337
1338 CNT_AUTO="${CNT_AUTO:-last-on}"
1339 echo "CNT_AUTO=\"${CNT_AUTO}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1340
1341 if db_get container/container-server
1342 then
1343 CNT_CONTAINER_SERVER="${RET:-FQDN}" # string (w/o empty)
1344 fi
1345
1346 CNT_CONTAINER_SERVER="${CNT_CONTAINER_SERVER:-FQDN}"
1347
1348 case "${CNT_CONTAINER_SERVER}" in
1349 FQDN)
1350 CNT_CONTAINER_SERVER="$(hostname -f 2> /dev/null || hostname)"
1351 ;;
1352 esac
1353
1354 echo "CNT_CONTAINER_SERVER=\"${CNT_CONTAINER_SERVER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1355
1356 if db_get container/bind
1357 then
1358 BIND="${RET}" # string (w/ empty)
1359 fi
1360
1361 echo "BIND=\"${BIND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1362
1363 if db_get container/bind-ro
1364 then
1365 BIND_RO="${RET}" # string (w/ empty)
1366 fi
1367
1368 echo "BIND_RO=\"${BIND_RO}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1369
1370 if db_get container/overlay
1371 then
1372 CNT_OVERLAY="${RET}" # string (w/ empty)
1373 fi
1374
1375 echo "CNT_OVERLAY=\"${CNT_OVERLAY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1376
1377 if db_get container/overlay-options
1378 then
1379 CNT_OVERLAY_OPTIONS="${RET}" # string (w/ empty)
1380 fi
1381
1382 echo "CNT_OVERLAY_OPTIONS=\"${CNT_OVERLAY_OPTIONS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
1383 }
1384
1385 Mode
1386 Images
1387
1388 Distribution
1389 Parent_distribution
1390
1391 Architecture
1392
1393 Archives
1394 Parent_archives
1395
1396 Mirror
1397 Mirror_security
1398
1399 Parent_mirror
1400 Parent_mirror_security
1401
1402 Archive_areas
1403 Parent_archive_areas
1404
1405 Packages
1406 Local_archives
1407
1408 Network
1409 Root_password
1410
1411 Internal_options
1412
1413 db_stop