Skip to content

Commit

Permalink
* Put back ZoL stuff:
Browse files Browse the repository at this point in the history
  + If 'mirror/protocol' is unset, don't fail - fallback to default 'http'.
  + Option to set the components in the preseed - 'mirror/components'
  + Don't require the kernel name to end with '-<arch>'. Double check Architecture.
  + Mount (bind) /proc and /sys as well on target to make sure grub-probe works correctly.
    Is nessesary for ZFS...

Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
  • Loading branch information
FransUrbo committed Nov 23, 2014
1 parent cec8a6f commit 0a1ad62
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
@@ -1,3 +1,9 @@
base-installer (1.151.ZOL1) wheezy; urgency=medium

* Put back ZoL stuff

-- Turbo Fredriksson <turbo@bayour.com> Wed, 22 Oct 2014 20:48:45 +0200

base-installer (1.152) unstable; urgency=medium

[ Ben Hutchings ]
Expand Down
42 changes: 35 additions & 7 deletions library.sh
Expand Up @@ -112,9 +112,11 @@ check_target () {
fi

# Undo dev bind mounts for idempotency.
if grep -qE '^[^ ]+ /target/dev' /proc/mounts; then
umount /target/dev
fi
for mnt in proc sys dev; do
if grep -qE "^[^ ]+ /target/$mnt" /proc/mounts; then
umount /target/mnt
fi
done
# Unmount /dev/.static/dev if mounted on same device as /target
mp_stdev=$(grep -E '^[^ ]+ /dev/\.static/dev' /proc/mounts | \
cut -d" " -f1)
Expand All @@ -131,6 +133,11 @@ setup_dev_linux () {
mount --bind /target/dev /dev/.static/dev
# Mirror device nodes in D-I environment to target
mount --bind /dev /target/dev/

# Mount /proc and /sys to make sure that grub-probe works
# (might only be nessesary for zfs-grub).
mount --bind /proc /target/proc
mount --bind /sys /target/sys
}

setup_dev_kfreebsd() {
Expand Down Expand Up @@ -326,31 +333,52 @@ get_mirror_info () {

mirror_error=""

db_get mirror/protocol || mirror_error=1
PROTOCOL="$RET"
db_get mirror/protocol
if [ -n "$RET" ]; then
PROTOCOL="$RET"
else
PROTOCOL="http"
fi

db_get mirror/$PROTOCOL/hostname || mirror_error=1
MIRROR="$RET"

db_get mirror/$PROTOCOL/directory || mirror_error=1
DIRECTORY="$RET"

COMPONENTS="main"
db_get mirror/components
if [ -n "$RET" ]; then
COMPONENTS="$RET"
else
COMPONENTS="main"
fi

if [ "$mirror_error" = 1 ] || [ -z "$PROTOCOL" ] || [ -z "$MIRROR" ]; then
exit_error base-installer/cannot_install
fi
fi
}

check_kernel_usability () {
arch2=`echo $2 | sed 's/-.*//'`
if chroot /target apt-cache show "$1" | grep -Eq "^(Architecture:.*)$2|$arch2"
then
return 0
elif arch_check_usable_kernel "$1" "$FLAVOUR"; then
return 0
else
return 1
fi
}

kernel_update_list () {
# Use 'uniq' to avoid listing the same kernel more then once
chroot /target apt-cache search "^(kernel|$KERNEL_NAME)-image" | \
cut -d" " -f1 | grep -v "linux-image-2.6" | uniq > "$KERNEL_LIST.unfiltered"
kernels=`sort -r "$KERNEL_LIST.unfiltered" | tr '\n' ' ' | sed -e 's/ $//'`
for candidate in $kernels; do
if [ -n "$FLAVOUR" ]; then
if arch_check_usable_kernel "$candidate" "$FLAVOUR"; then
if check_kernel_usability "$candidate" "$FLAVOUR" ; then
echo "$candidate"
info "kernel $candidate usable on $FLAVOUR"
else
Expand Down

0 comments on commit 0a1ad62

Please sign in to comment.