index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-26 22:57:07 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-26 22:57:07 -0400 |
commit | 6a87c26b84e5cab7f4a8ead8abd62e58b7ec7f6c (patch) | |
tree | 48ed64f8684891542feb17f0e79f127252a79f7e /arch-nspawn.in | |
parent | 67bcecbbe42c727936d825363fbd1e2173bab574 (diff) |
-rw-r--r-- | arch-nspawn.in | 6 |
diff --git a/arch-nspawn.in b/arch-nspawn.in index bde77b6..7dcd8ca 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -96,6 +96,12 @@ 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 \ -D "$working_dir" \ |