gnewsense 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. default_mirror http://archive.gnewsense.org/gnewsense
  2. mirror_style release
  3. download_style apt
  4. finddebs_style from-indices
  5. variants - buildd fakechroot minbase scratchbox
  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. }
  31. first_stage_install () {
  32. extract $required
  33. mkdir -p "$TARGET/var/lib/dpkg"
  34. : >"$TARGET/var/lib/dpkg/status"
  35. : >"$TARGET/var/lib/dpkg/available"
  36. setup_etc
  37. if [ ! -e "$TARGET/etc/fstab" ]; then
  38. echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
  39. chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
  40. fi
  41. x_feign_install () {
  42. local pkg="$1"
  43. local deb="$(debfor $pkg)"
  44. local ver="$(extract_deb_field "$TARGET/$deb" Version)"
  45. mkdir -p "$TARGET/var/lib/dpkg/info"
  46. echo \
  47. "Package: $pkg
  48. Version: $ver
  49. Maintainer: unknown
  50. Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
  51. touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
  52. }
  53. x_feign_install dpkg
  54. }
  55. second_stage_install () {
  56. setup_devices
  57. x_core_install () {
  58. smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
  59. }
  60. p () {
  61. baseprog="$(($baseprog + ${1:-1}))"
  62. }
  63. if doing_variant fakechroot; then
  64. setup_proc_fakechroot
  65. elif doing_variant scratchbox; then
  66. true
  67. else
  68. setup_proc
  69. in_target /sbin/ldconfig
  70. fi
  71. DEBIAN_FRONTEND=noninteractive
  72. DEBCONF_NONINTERACTIVE_SEEN=true
  73. export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
  74. baseprog=0
  75. bases=7
  76. p; progress $baseprog $bases INSTCORE "Installing core packages" #1
  77. info INSTCORE "Installing core packages..."
  78. p; progress $baseprog $bases INSTCORE "Installing core packages" #2
  79. ln -sf mawk "$TARGET/usr/bin/awk"
  80. x_core_install base-files base-passwd
  81. p; progress $baseprog $bases INSTCORE "Installing core packages" #3
  82. x_core_install dpkg
  83. if [ ! -e "$TARGET/etc/localtime" ]; then
  84. ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
  85. fi
  86. if doing_variant fakechroot; then
  87. install_fakechroot_tools
  88. fi
  89. p; progress $baseprog $bases INSTCORE "Installing core packages" #4
  90. x_core_install $LIBC
  91. p; progress $baseprog $bases INSTCORE "Installing core packages" #5
  92. x_core_install perl-base
  93. p; progress $baseprog $bases INSTCORE "Installing core packages" #6
  94. rm "$TARGET/usr/bin/awk"
  95. x_core_install mawk
  96. p; progress $baseprog $bases INSTCORE "Installing core packages" #7
  97. if doing_variant -; then
  98. x_core_install debconf
  99. fi
  100. baseprog=0
  101. bases=$(set -- $required; echo $#)
  102. info UNPACKREQ "Unpacking required packages..."
  103. exec 7>&1
  104. smallyes '' |
  105. (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
  106. dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
  107. dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
  108. info CONFREQ "Configuring required packages..."
  109. mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
  110. echo \
  111. "#!/bin/sh
  112. echo
  113. echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
  114. chmod 755 "$TARGET/sbin/start-stop-daemon"
  115. setup_dselect_method apt
  116. smallyes '' |
  117. (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
  118. dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
  119. dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
  120. baseprog=0
  121. bases="$(set -- $base; echo $#)"
  122. info UNPACKBASE "Unpacking the base system..."
  123. setup_available $required $base
  124. done_predeps=
  125. while predep=$(get_next_predep); do
  126. # We have to resolve dependencies of pre-dependencies manually because
  127. # dpkg --predep-package doesn't handle this.
  128. predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
  129. # XXX: progress is tricky due to how dpkg_progress works
  130. # -- cjwatson 2009-07-29
  131. p; smallyes '' |
  132. in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
  133. base=$(without "$base" "$predep")
  134. done_predeps="$done_predeps $predep"
  135. done
  136. smallyes '' |
  137. (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
  138. dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
  139. dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
  140. info CONFBASE "Configuring the base system..."
  141. smallyes '' |
  142. (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \
  143. dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
  144. dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
  145. mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
  146. progress $bases $bases CONFBASE "Configuring base system"
  147. info BASESUCCESS "Base system installed successfully."
  148. }