Fix detection of existing ssh host key, generate the new one

in floppy.tree instead of mfs_tree.

Do not cleanup ${BUILDDIR}/floppy.tree, it might be useful to look
at it after an image has been built.
This commit is contained in:
Luigi Rizzo 2002-03-11 05:54:22 +00:00
parent a914eaada5
commit 5ea9adc715
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92063

View File

@ -162,13 +162,13 @@ create_includes_and_libraries() {
INCOWN=`id -un` BINOWN=`id -un` DESTDIR=${SRC}/.. \
make -m ${SRC}/share/mk \
-DNOHTML -DNOINFO -DNOMAN -DNOSHARE -DNOFSCHG "
# need to 'make obj' in a few places. This is very
# version-specific... The following works for 5.0
log "do a 'make obj' in a few places."
# This is very version-specific... The following works for 5.0
for i in lib secure/lib gnu/lib usr.sbin/pcvt/keycap \
gnu/usr.bin/perl usr.bin/lex usr.sbin/config ; do
(cd ${i}; eval $e obj)
done
# now make the static libraries
log "now make the static libraries"
eval $e -DNOPROFILE -DNOPIC libraries
(cd ${SRC}/usr.sbin/config
eval $e # build binary
@ -376,7 +376,7 @@ this as small as possible. " 10 70 2> ${c_reply} \
{ dialog --title "MFS bytes per inode:" --inputbox \
"Enter MFS bytes per inode (typically 4096..65536). \
A larger value means fewer inodes but more space on MFS" \
10 70 2> ${c_reply} && mfs_inodes=`cat ${c_reply}` ; } || true
10 70 2> ${c_reply} && mfs_inodes=`cat ${c_reply}` ; } || true
;;
U)
@ -494,6 +494,7 @@ populate_floppy_fs() { # OK
else
log "No site-specific floppy-tree"
fi
# gzip returns an error if it fails to compress some file
(cd $dst ; gzip -9 etc/*
log "Compressed files in etc/ `echo; ls -l etc`"
@ -585,11 +586,14 @@ populate_mfs_tree() {
) || fail $? crunch
if [ -f ${dst}/stand/sshd ] ; then
log "Creating host key for sshd"
if [ -f ${dst}/etc/ssh_host_key ] ; then
log "Setting up host key for sshd:"
if [ -f ${BUILDDIR}/floppy.tree/etc/ssh_host_key.gz ] ; then
log "Using existing host key"
else
ssh-keygen -f ${dst}/etc/ssh_host_key -N "" -C "root@picobsd"
log "Generating new host key"
ssh-keygen -f ${BUILDDIR}/floppy.tree/etc/ssh_host_key \
-N "" -C "root@picobsd"
gzip -9 ${BUILDDIR}/floppy.tree/etc/ssh_host_key* || true
fi
fi
@ -598,7 +602,7 @@ populate_mfs_tree() {
if [ -d ${MFS_TREE} ] ; then
log "Copy ${MFS_TREE} ..."
(cd ${MFS_TREE} ; tar -cf - --exclude CVS . ) | \
(cd ${dst} ; tar x${o_tarv}f - )
(cd ${dst} ; tar x${o_tarv}f - )
fi
done
@ -769,7 +773,7 @@ fill_floppy_image() {
log "Newfs floppy image"
newfs -i ${fd_inodes} -m 0 -p 0 -o space -f 512 -b 4096 \
/dev/${l_vndev}a > /dev/null
/dev/${l_vndev}a > /dev/null
log "Mounting floppy image"
mount /dev/${l_vndev}a ${dst}
@ -804,7 +808,7 @@ fi
fi
)
(log "Fixing permissions"; cd ${dst}; chown -R root *)
rm -rf ${BUILDDIR}/floppy.tree || true # cleanup
# rm -rf ${BUILDDIR}/floppy.tree || true # cleanup
df -ik ${dst} | colrm 70 > .build.reply
free_vnode