build: add setup_entropy idea by @lattera the FreeBSD way

This commit is contained in:
Franco Fichtner 2016-02-04 21:55:29 +01:00
parent 867eafd82b
commit 4b9bde5a90
4 changed files with 24 additions and 0 deletions

View File

@ -297,6 +297,23 @@ setup_distfiles()
fi
}
setup_entropy()
{
echo ">>> Setting up entropy in ${1}"
mkdir -p ${1}/boot
umask 077
dd if=/dev/random of=${1}/boot/entropy bs=4096 count=1
dd if=/dev/random of=${1}/entropy bs=4096 count=1
chown 0:0 ${1}/boot/entropy
chown 0:0 ${1}/entropy
umask 022
}
generate_signature()
{
SIGNCMD="${TOOLSDIR}/scripts/pkg_sign.sh"

View File

@ -41,6 +41,7 @@ setup_base ${STAGEDIR}
setup_kernel ${STAGEDIR}
setup_packages ${STAGEDIR}
setup_mtree ${STAGEDIR}
setup_entropy ${STAGEDIR}
echo -n ">>> Building ISO image... "

View File

@ -52,6 +52,8 @@ cat > ${STAGEDIR}/etc/fstab << EOF
tmpfs /tmp tmpfs rw,mode=01777 0 0
EOF
setup_entropy ${STAGEDIR}
makefs -t ffs -B little -o label=${LABEL} ${VGAIMG} ${STAGEDIR}
echo "-S115200 -D" > ${STAGEDIR}/boot.config
@ -68,6 +70,8 @@ sed -i '' -e 's:</system>:<enableserial/></system>:' \
sed -i '' -Ee 's:^ttyu0:ttyu0 "/usr/libexec/getty std.9600" cons25 on secure:' ${STAGEDIR}/etc/ttys
setup_entropy ${STAGEDIR}
makefs -t ffs -B little -o label=${LABEL} ${SERIALIMG} ${STAGEDIR}
setup_bootcode()

View File

@ -157,9 +157,11 @@ setup_partition()
umount ${3}
}
setup_entropy ${STAGEDIR}
setup_partition /dev/${MD}s1 ${LABEL}0 ${MNT} ${STAGEDIR}
if [ ${NANO_IMAGES} -gt 1 ]; then
setup_entropy ${STAGEDIR}
setup_partition /dev/${MD}s2 ${LABEL}1 ${MNT} ${STAGEDIR}
fi