Commit aaac37bb authored by Marco d'Itri's avatar Marco d'Itri Committed by Samuel Thibault

Split setup_devices in setup_devices and setup_dynamic_devices,

(setup_devices now only deals with static device nodes) and move the calls
to setup_devices from the beginning of the second stage to the end of the
first stage. setup_dynamic_devices mounts the appropriate filesystems
which provide dynamic device nodes for the architectures which need one
in debootstrap (kfreebsd and hurd).  This fixes a bug in --second-stage
introduced in 1.0.34 and exposed by the devices-related changes of 1.0.76:
the second stage debootstrap runs "dpkg --print-architecture >/dev/null" at
the very beginning of the program when /dev is still empty, so it creates an
empty regular file in place of /dev/null and this will cause mknod to fail
later.  (Closes: #813232)
parent 745d40d7
debootstrap (1.0.78+nmu1) unstable; urgency=medium
* Non-maintainer upload.
* Split setup_devices in setup_devices (which now only deals with static
device nodes) and setup_dynamic_devices, and move the calls to
setup_devices from the beginning of the second stage to the end of the
first stage.
setup_dynamic_devices mounts the appropriate filesystems which provide
dynamic device nodes for the architectures which need one in
debootstrap (kfreebsd and hurd).
This fixes a bug in --second-stage introduced in 1.0.34 and exposed
by the devices-related changes of 1.0.76: the second stage debootstrap
runs "dpkg --print-architecture >/dev/null" at the very beginning of
the program when /dev is still empty, so it creates an empty regular
file in place of /dev/null and this will cause mknod to fail later.
(Closes: #813232)
-- Marco d'Itri <md@linux.it> Wed, 17 Feb 2016 01:23:23 +0100
debootstrap (1.0.78) unstable; urgency=high
* Use HTTPS for Vcs-* URLs, and link to cgit rather than gitweb.
......
......@@ -1046,6 +1046,7 @@ setup_proc_fakechroot () {
ln -s /proc "$TARGET"
}
# create the static device nodes
setup_devices () {
if doing_variant fakechroot; then
setup_devices_fakechroot
......@@ -1054,11 +1055,11 @@ setup_devices () {
case "$HOST_OS" in
kfreebsd*)
in_target mount -t devfs devfs /dev ;;
;;
freebsd)
mount -t devfs devfs $TARGET/dev ;;
;;
hurd*)
setup_devices_hurd ;;
;;
*)
if true; then
setup_devices_simple
......@@ -1071,6 +1072,22 @@ setup_devices () {
esac
}
# enable the dynamic device nodes
setup_dynamic_devices () {
if doing_variant fakechroot; then
return 0
fi
case "$HOST_OS" in
kfreebsd*)
in_target mount -t devfs devfs /dev ;;
freebsd)
mount -t devfs devfs $TARGET/dev ;;
hurd*)
setup_devices_hurd ;;
esac
}
setup_devices_simple () {
# The list of devices that can be created in a container comes from
# src/core/cgroup.c in the systemd source tree.
......
......@@ -57,6 +57,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -77,7 +79,7 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
}
second_stage_install () {
setup_devices
setup_dynamic_devices
x_core_install () {
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
......
......@@ -44,6 +44,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -71,7 +73,6 @@ second_stage_install () {
baseprog="$(($baseprog + ${1:-1}))"
}
setup_devices
setup_proc
umount_on_exit /dev/.static/dev
umount_on_exit /dev
......
......@@ -51,6 +51,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -78,7 +80,6 @@ second_stage_install () {
baseprog="$(($baseprog + ${1:-1}))"
}
setup_devices
setup_proc
in_target /sbin/ldconfig
......
......@@ -57,6 +57,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -84,8 +86,6 @@ second_stage_install () {
baseprog="$(($baseprog + ${1:-1}))"
}
setup_devices
if doing_variant fakechroot; then
setup_proc_fakechroot
else
......
......@@ -57,6 +57,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -84,8 +86,6 @@ second_stage_install () {
baseprog="$(($baseprog + ${1:-1}))"
}
setup_devices
if doing_variant fakechroot; then
setup_proc_fakechroot
else
......
......@@ -64,6 +64,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -91,8 +93,6 @@ second_stage_install () {
baseprog="$(($baseprog + ${1:-1}))"
}
setup_devices
if doing_variant fakechroot; then
setup_proc_fakechroot
else
......
......@@ -65,6 +65,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -98,7 +100,6 @@ second_stage_install () {
baseprog=0
bases=7
setup_devices
setup_proc
umount_on_exit /.dev
umount_on_exit /dev
......
......@@ -61,6 +61,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -93,7 +95,6 @@ second_stage_install () {
baseprog=0
bases=40
setup_devices
setup_proc
in_target /sbin/ldconfig
......
......@@ -54,6 +54,8 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
}
setup_devices
x_feign_install dpkg
if [ -e "$TARGET/usr/bin/perl-5.005.dist" ]; then
......@@ -71,7 +73,6 @@ second_stage_install () {
export DEBIAN_FRONTEND=Noninteractive
setup_devices
setup_proc
ln "$TARGET/sbin/ldconfig.new" "$TARGET/sbin/ldconfig"
in_target /sbin/ldconfig
......
......@@ -107,6 +107,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -134,7 +136,6 @@ second_stage_install () {
baseprog="$(($baseprog + ${1:-1}))"
}
setup_devices
setup_proc
in_target /sbin/ldconfig
......
......@@ -68,6 +68,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -95,7 +97,6 @@ second_stage_install () {
baseprog="$(($baseprog + ${1:-1}))"
}
setup_devices
setup_proc
in_target /sbin/ldconfig
......
......@@ -53,6 +53,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -73,7 +75,7 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
}
second_stage_install () {
setup_devices
setup_dynamic_devices
x_core_install () {
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
......
......@@ -53,6 +53,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -84,7 +86,6 @@ second_stage_install () {
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
setup_devices
setup_proc
in_target /sbin/ldconfig
......
......@@ -61,6 +61,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -93,7 +95,6 @@ second_stage_install () {
baseprog=0
bases=40
setup_devices
setup_proc
in_target /sbin/ldconfig
......
......@@ -93,6 +93,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -120,7 +122,6 @@ second_stage_install () {
baseprog="$(($baseprog + ${1:-1}))"
}
setup_devices
setup_proc
in_target /sbin/ldconfig
......
......@@ -68,6 +68,8 @@ first_stage_install () {
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
......@@ -95,7 +97,6 @@ second_stage_install () {
baseprog="$(($baseprog + ${1:-1}))"
}
setup_devices
setup_proc
in_target /sbin/ldconfig
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment