# vim: set ft=sh : export USE_COMPONENTS="$(for c in $USE_COMPONENTS; do case "$c" in main) echo maintained ;; *) echo "$c" ;; esac ; done)" LIBC="libc6" # NEW: download_ucs_indices () { local m c a local m1="${MIRRORS%% *}" local comp="${USE_COMPONENTS}" progress 0 100 DOWNMAINPKGS "Downloading Packages file" progress_next 100 if [ -z "$comp" ]; then comp=maintained; fi COMPONENTS="$(echo $comp | tr '|' ' ')" export COMPONENTS for m in $MIRRORS; do for c in $COMPONENTS; do for a in $ARCH all; do local path="${SUITE#ucs-}/$c/${SUITE#ucs-}-0/$a/Packages" local pkgdest="$TARGET/$($DLDEST pkg "${SUITE#ucs-}" "$c/${SUITE#ucs-}-0" "$a" "$m" "$path")" if [ -x /bin/gunzip ] && get "$m/${path}.gz" "${pkgdest}.gz"; then rm -f "$pkgdest" gunzip "$pkgdest.gz" elif get "$m/$path" "$pkgdest"; then true fi done done done progress 100 100 DOWNMAINPKGS "Downloading Packages file" } # NEW: download_ucs () { local p c m a local m1="${MIRRORS%% *}" :>$TARGET/debootstrap/debpaths for p in "$@"; do for c in $COMPONENTS; do local details="" for m in $MIRRORS; do for a in $ARCH all; do local path="${SUITE#ucs-}/$c/${SUITE#ucs-}-0/$a/Packages" local pkgdest="$TARGET/$($DLDEST pkg "${SUITE#ucs-}" "$c/${SUITE#ucs-}-0" "$a" "$m" "$path")" if [ ! -e "$pkgdest" ]; then continue; fi details="$($PKGDETAILS PKGS "$m" "$pkgdest" "$p")" if [ "$details" = "$p -" ]; then details="" continue fi size="${details##* }"; details="${details% *}" md5="${details##* }"; details="${details% *}" local debdest="$($DLDEST deb $details)" if get "$m/${SUITE#ucs-}/$c/${details##* }" "$TARGET/$debdest" "$md5" "$size"; then echo >>$TARGET/debootstrap/debpaths "$p $debdest" details="done" break 2 fi done done if [ "$details" != "" ]; then break fi done if [ "$details" != "done" ]; then error 1 COULDNTDL "Couldn't download %s" "$p" fi done } # OVERRIDE: functions #mirror_style ucs DOWNLOAD_INDICES=download_ucs_indices DOWNLOAD_DEBS=download_ucs export DOWNLOAD_INDICES export DOWNLOAD_DEBS default_mirror http://updates.software-univention.de download_style apt finddebs_style from-indices variants - buildd fakechroot minbase scratchbox #keyring /usr/share/keyrings/univention-archive-key-ucs-3x.gpg if doing_variant fakechroot; then test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" fi # OVERRIDE: functions setup_apt_sources () { local m c a mkdir -p "$TARGET/etc/apt" for m in "$@"; do for c in $COMPONENTS; do for a in $ARCH all; do local path="${SUITE#ucs-}/$c/${SUITE#ucs-}-0/$a/Packages" local pkgdest="$TARGET/$($DLDEST pkg "${SUITE#ucs-}" "$c/${SUITE#ucs-}-0" "$a" "$m" "$path")" if [ -e "$pkgdest" ]; then echo "deb $m/${SUITE#ucs-}/$c ${SUITE#ucs-}-0/$a/"; fi done done done > "$TARGET/etc/apt/sources.list" } # OVERRIDE: functions setup_available () { local ml c a m1="${MIRRORS%% *}" for c in $COMPONENTS; do for a in $ARCH all; do local path="${SUITE#ucs-}/$c/${SUITE#ucs-}-0/$a/Packages" local pkgdest="$TARGET/$($DLDEST pkg "${SUITE#ucs-}" "$c/${SUITE#ucs-}-0" "$a" "$m1" "$path")" # XXX: What if a package is in more than one component? # -- cjwatson 2009-07-29 "$PKGDETAILS" STANZAS "$pkgdest" "$@" done done >"$TARGET/var/lib/dpkg/available" for pkg; do echo "$pkg install" done | in_target dpkg --set-selections } # OVERRIDE: functions get_debs () { local field="$1" shift local m1 c a for m1 in $MIRRORS; do for c in $COMPONENTS; do for a in $ARCH all; do local path="${SUITE#ucs-}/$c/${SUITE#ucs-}-0/$a/Packages" local pkgdest="$TARGET/$($DLDEST pkg "${SUITE#ucs-}" "$c/${SUITE#ucs-}-0" "$a" "$m1" "$path")" echo $("$PKGDETAILS" FIELD "$field" "$m1" "$pkgdest" "$@" | sed 's/ .*//') done done done } # COPY: sid work_out_debs () { required="$(get_debs Priority: required)" if doing_variant - || doing_variant fakechroot; then #required="$required $(get_debs Priority: important)" # ^^ should be getting debconf here somehow maybe base="$(get_debs Priority: important)" elif doing_variant buildd || doing_variant scratchbox; then base="apt $(get_debs Build-Essential: yes)" elif doing_variant minbase; then base="apt" fi if doing_variant fakechroot; then # ldd.fake needs binutils required="$required binutils" fi } # COPY: sid first_stage_install () { extract $required mkdir -p "$TARGET/var/lib/dpkg" : >"$TARGET/var/lib/dpkg/status" : >"$TARGET/var/lib/dpkg/available" setup_etc if [ ! -e "$TARGET/etc/fstab" ]; then echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" fi if doing_variant fakechroot; then setup_devices_fakechroot else setup_devices fi x_feign_install () { local pkg="$1" local deb="$(debfor $pkg)" local ver="$(extract_deb_field "$TARGET/$deb" Version)" mkdir -p "$TARGET/var/lib/dpkg/info" echo \ "Package: $pkg Version: $ver Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" touch "$TARGET/var/lib/dpkg/info/${pkg}.list" } x_feign_install dpkg } # OVERRIDE: functions resolve_deps () { local m1="${MIRRORS%% *}" # XXX: I can't think how to deal well with dependency resolution and # lots of Packages files. -- aj 2005/06/12 local c="${COMPONENTS%% *}" local path="${SUITE#ucs-}/$c/${SUITE#ucs-}-0/$ARCH/Packages" local pkgdest="$TARGET/$($DLDEST pkg "${SUITE#ucs-}" "$c/${SUITE#ucs-}-0" "$ARCH" "$m1" "$path")" local path2="${SUITE#ucs-}/$c/${SUITE#ucs-}-0/all/Packages" local pkgdest2="$TARGET/$($DLDEST pkg "${SUITE#ucs-}" "$c/${SUITE#ucs-}-0" "all" "$m1" "$path2")" local PKGS="$*" local ALLPKGS="$PKGS" local ALLPKGS2="" while [ "$PKGS" != "" ]; do PKGS="$("$PKGDETAILS" GETDEPS "$pkgdest" $PKGS) $("$PKGDETAILS" GETDEPS "$pkgdest2" $PKGS)" PKGS=$( ("$PKGDETAILS" PKGS REAL "$pkgdest" $PKGS;"$PKGDETAILS" PKGS REAL "$pkgdest2" $PKGS) | sed -n 's/ .*REAL.*$//p') ALLPKGS2=$(echo "$PKGS $ALLPKGS" | tr ' ' '\n' | sort -u) PKGS=$(without "$ALLPKGS2" "$ALLPKGS") ALLPKGS="$ALLPKGS2" done echo $ALLPKGS } # COPY: sid second_stage_install () { x_core_install () { smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") } p () { baseprog="$(($baseprog + ${1:-1}))" } if doing_variant fakechroot; then setup_proc_fakechroot elif doing_variant scratchbox; then true else setup_proc in_target /sbin/ldconfig fi DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN baseprog=0 bases=7 p; progress $baseprog $bases INSTCORE "Installing core packages" #1 info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 ln -sf mawk "$TARGET/usr/bin/awk" x_core_install base-files base-passwd p; progress $baseprog $bases INSTCORE "Installing core packages" #3 x_core_install dpkg if [ ! -e "$TARGET/etc/localtime" ]; then ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" fi if doing_variant fakechroot; then install_fakechroot_tools fi p; progress $baseprog $bases INSTCORE "Installing core packages" #4 x_core_install $LIBC p; progress $baseprog $bases INSTCORE "Installing core packages" #5 x_core_install perl-base p; progress $baseprog $bases INSTCORE "Installing core packages" #6 rm "$TARGET/usr/bin/awk" x_core_install mawk p; progress $baseprog $bases INSTCORE "Installing core packages" #7 if doing_variant -; then x_core_install debconf fi baseprog=0 bases=$(set -- $required; echo $#) info UNPACKREQ "Unpacking required packages..." exec 7>&1 smallyes '' | (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) | dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING info CONFREQ "Configuring required packages..." mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" echo \ "#!/bin/sh echo echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" chmod 755 "$TARGET/sbin/start-stop-daemon" setup_dselect_method apt smallyes '' | (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) | dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING baseprog=0 bases="$(set -- $base; echo $#)" info UNPACKBASE "Unpacking the base system..." setup_available $required $base done_predeps= while predep=$(get_next_predep); do # We have to resolve dependencies of pre-dependencies manually because # dpkg --predep-package doesn't handle this. predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps") # XXX: progress is tricky due to how dpkg_progress works # -- cjwatson 2009-07-29 p; smallyes '' | in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep) base=$(without "$base" "$predep") done_predeps="$done_predeps $predep" done smallyes '' | (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) | dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING info CONFBASE "Configuring the base system..." smallyes '' | (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" progress $bases $bases CONFBASE "Configuring base system" info BASESUCCESS "Base system installed successfully." }