jessie 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. mirror_style release
  2. download_style apt
  3. finddebs_style from-indices
  4. variants - buildd fakechroot minbase scratchbox
  5. keyring /usr/share/keyrings/debian-archive-keyring.gpg
  6. if doing_variant fakechroot; then
  7. test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
  8. fi
  9. case $ARCH in
  10. alpha|ia64) LIBC="libc6.1" ;;
  11. kfreebsd-*) LIBC="libc0.1" ;;
  12. hurd-*) LIBC="libc0.3" ;;
  13. *) LIBC="libc6" ;;
  14. esac
  15. work_out_debs () {
  16. required="$(get_debs Priority: required)"
  17. if doing_variant - || doing_variant fakechroot; then
  18. #required="$required $(get_debs Priority: important)"
  19. # ^^ should be getting debconf here somehow maybe
  20. base="$(get_debs Priority: important)"
  21. elif doing_variant buildd || doing_variant scratchbox; then
  22. base="apt build-essential"
  23. elif doing_variant minbase; then
  24. base="apt"
  25. fi
  26. if doing_variant fakechroot; then
  27. # ldd.fake needs binutils
  28. required="$required binutils"
  29. fi
  30. case $MIRRORS in
  31. https://*)
  32. base="$base apt-transport-https ca-certificates"
  33. ;;
  34. esac
  35. }
  36. first_stage_install () {
  37. case "$CODENAME" in
  38. etch|etch-m68k|jessie|lenny|squeeze|wheezy) ;;
  39. *) setup_merged_usr ;;
  40. esac
  41. extract $required
  42. mkdir -p "$TARGET/var/lib/dpkg"
  43. : >"$TARGET/var/lib/dpkg/status"
  44. : >"$TARGET/var/lib/dpkg/available"
  45. setup_etc
  46. if [ ! -e "$TARGET/etc/fstab" ]; then
  47. echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
  48. chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
  49. fi
  50. setup_devices
  51. }
  52. second_stage_install () {
  53. setup_dynamic_devices
  54. x_feign_install () {
  55. local pkg="$1"
  56. local deb="$(debfor $pkg)"
  57. local ver="$(in_target dpkg-deb -f "$deb" Version)"
  58. mkdir -p "$TARGET/var/lib/dpkg/info"
  59. echo \
  60. "Package: $pkg
  61. Version: $ver
  62. Maintainer: unknown
  63. Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
  64. touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
  65. }
  66. x_feign_install dpkg
  67. x_core_install () {
  68. smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
  69. }
  70. p () {
  71. baseprog="$(($baseprog + ${1:-1}))"
  72. }
  73. if doing_variant fakechroot; then
  74. setup_proc_fakechroot
  75. elif doing_variant scratchbox; then
  76. true
  77. else
  78. setup_proc
  79. in_target /sbin/ldconfig
  80. fi
  81. DEBIAN_FRONTEND=noninteractive
  82. DEBCONF_NONINTERACTIVE_SEEN=true
  83. export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
  84. baseprog=0
  85. bases=7
  86. p; progress $baseprog $bases INSTCORE "Installing core packages" #1
  87. info INSTCORE "Installing core packages..."
  88. p; progress $baseprog $bases INSTCORE "Installing core packages" #2
  89. ln -sf mawk "$TARGET/usr/bin/awk"
  90. x_core_install base-passwd
  91. x_core_install base-files
  92. p; progress $baseprog $bases INSTCORE "Installing core packages" #3
  93. x_core_install dpkg
  94. if [ ! -e "$TARGET/etc/localtime" ]; then
  95. ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
  96. fi
  97. if doing_variant fakechroot; then
  98. install_fakechroot_tools
  99. fi
  100. p; progress $baseprog $bases INSTCORE "Installing core packages" #4
  101. x_core_install $LIBC
  102. p; progress $baseprog $bases INSTCORE "Installing core packages" #5
  103. x_core_install perl-base
  104. p; progress $baseprog $bases INSTCORE "Installing core packages" #6
  105. rm "$TARGET/usr/bin/awk"
  106. x_core_install mawk
  107. p; progress $baseprog $bases INSTCORE "Installing core packages" #7
  108. if doing_variant -; then
  109. x_core_install debconf
  110. fi
  111. baseprog=0
  112. bases=$(set -- $required; echo $#)
  113. info UNPACKREQ "Unpacking required packages..."
  114. exec 7>&1
  115. smallyes '' |
  116. (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
  117. dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
  118. dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
  119. info CONFREQ "Configuring required packages..."
  120. echo \
  121. "#!/bin/sh
  122. exit 101" > "$TARGET/usr/sbin/policy-rc.d"
  123. chmod 755 "$TARGET/usr/sbin/policy-rc.d"
  124. mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
  125. echo \
  126. "#!/bin/sh
  127. echo
  128. echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
  129. chmod 755 "$TARGET/sbin/start-stop-daemon"
  130. setup_dselect_method apt
  131. smallyes '' |
  132. (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
  133. dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
  134. dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
  135. baseprog=0
  136. bases="$(set -- $base; echo $#)"
  137. info UNPACKBASE "Unpacking the base system..."
  138. setup_available $required $base
  139. done_predeps=
  140. while predep=$(get_next_predep); do
  141. # We have to resolve dependencies of pre-dependencies manually because
  142. # dpkg --predep-package doesn't handle this.
  143. predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
  144. # XXX: progress is tricky due to how dpkg_progress works
  145. # -- cjwatson 2009-07-29
  146. p; smallyes '' |
  147. in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
  148. base=$(without "$base" "$predep")
  149. done_predeps="$done_predeps $predep"
  150. done
  151. smallyes '' |
  152. (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
  153. dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
  154. dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
  155. info CONFBASE "Configuring the base system..."
  156. smallyes '' |
  157. (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \
  158. dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
  159. dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
  160. mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
  161. rm -f "$TARGET/usr/sbin/policy-rc.d"
  162. progress $bases $bases CONFBASE "Configuring base system"
  163. info BASESUCCESS "Base system installed successfully."
  164. }