Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/arch-nspawn.in
diff options
context:
space:
mode:
Diffstat (limited to 'arch-nspawn.in')
-rw-r--r--arch-nspawn.in12
1 files changed, 9 insertions, 3 deletions
diff --git a/arch-nspawn.in b/arch-nspawn.in
index 4436a0e..0bdd921 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -32,7 +32,7 @@ while getopts 'hC:M:c:' arg; do
M) makepkg_conf="$OPTARG" ;;
c) cache_dir="$OPTARG" ;;
h|?) usage ;;
- *) error "invalid argument '$arg'"; usage ;;
+ *) error "invalid argument '%s'" "$arg"; usage ;;
esac
done
shift $(($OPTIND - 1))
@@ -84,7 +84,7 @@ umask 0022
# Sanity check
if [[ ! -f "$working_dir/.arch-chroot" ]]; then
- die "'%s' does not appear to be a Arch chroot." "$working_dir"
+ die "'%s' does not appear to be an Arch chroot." "$working_dir"
elif [[ $(cat "$working_dir/.arch-chroot") != $CHROOT_VERSION ]]; then
die "chroot '%s' is not at version %s. Please rebuild." "$working_dir" "$CHROOT_VERSION"
fi
@@ -96,8 +96,14 @@ eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
machine_name="${working_dir//[![:alnum:]_-]/-}"
machine_name="${machine_name#-}"
+#HOST_NAME_MAX="$(printf '%s\n' '#include <limits.h>' 'HOST_NAME_MAX'|cpp -|sed -n '$p')"
+HOST_NAME_MAX=64
+if [[ ${#machine_name} -gt "$HOST_NAME_MAX" ]]; then
+ machine_name="${machine_name:(-${HOST_NAME_MAX})}"
+ machine_name="${machine_name#-}"
+fi
-exec ${CARCH:+setarch "$CARCH"} systemd-nspawn 2>/dev/null \
+exec ${CARCH:+setarch "$CARCH"} systemd-nspawn \
-D "$working_dir" \
--machine "$machine_name" \
"${mount_args[@]}" \