summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2007-10-19 13:45:48 (GMT)
committerColin Watson <cjwatson@debian.org>2007-10-19 13:45:48 (GMT)
commitf8ba662779476396f7bf58e213c5995a8f104266 (patch)
tree3026eb3f3533fdf66ff5c30fe5607aff5580ee77 /functions
parentc702ea3582aecfe6d164092bfbebdd0a08226b8e (diff)
downloaddebootstrap-f8ba662779476396f7bf58e213c5995a8f104266.zip
debootstrap-f8ba662779476396f7bf58e213c5995a8f104266.tar.gz
debootstrap-f8ba662779476396f7bf58e213c5995a8f104266.tar.bz2
* Emit an error if we cannot create working devices or executables on the
target (based on work by Bastian Kleineidam; closes: #233798). r49822
Diffstat (limited to 'functions')
-rw-r--r--functions31
1 files changed, 31 insertions, 0 deletions
diff --git a/functions b/functions
index 980e0d5..4fbe29f 100644
--- a/functions
+++ b/functions
@@ -989,6 +989,37 @@ resolve_deps () {
################################################################### helpers
+# Return zero if it is possible to create devices and execute programs in
+# this directory. (Both may be forbidden by mount options, e.g. nodev and
+# noexec respectively.)
+check_sane_mount () {
+ case "$ARCH" in
+ kfreebsd-*|hurd-*)
+ ;;
+ *)
+ mknod "$1/test-dev-null" c 1 3 || return 1
+ if ! echo test > "$1/test-dev-null"; then
+ rm -f "$1/test-dev-null"
+ return 1
+ fi
+ rm -f "$1/test-dev-null"
+ ;;
+ esac
+
+ cat > "$1/test-exec" <<EOF
+#! /bin/sh
+:
+EOF
+ chmod +x "$1/test-exec"
+ if ! "$1/test-exec"; then
+ rm -f "$1/test-exec"
+ return 1
+ fi
+ rm -f "$1/test-exec"
+
+ return 0
+}
+
read_gpg_status () {
badsig=
unkkey=