integrate-distro.sh: Ongoing improvements

- Carry ssh-agent authentication into chroot
  - Do jcs setup there
  - Fix half-functional -a arch command-line option

Signed-off-by: Jan Lindemann <jan@jannet.de>
This commit is contained in:
Jan Lindemann 2013-04-07 20:45:30 +00:00 committed by Jan Lindemann
commit 77bfdf47de

View file

@ -722,6 +722,13 @@ make_etc_jcs_jcs_conf()
EOT
}
make_home_ssh_conf()
{
_cat << EOT
|StrictHostKeyChecking=no
EOT
}
setup_boot_loader_local()
{
check_var_set grub_boot_partition_num grub_slash_boot_partition_num || \
@ -920,7 +927,6 @@ cmd_install()
make_etc_sysctl_conf > $root/etc/sysctl.conf
make_etc_issue > $root/etc/issue
make_etc_issue_net > $root/etc/issue.net
make_etc_jcs_jcs_conf > $root/etc/jcs/jcs.conf
host_zypper "base" install --auto-agree-with-licenses $base_pkgs
host_zypper "base update" install --auto-agree-with-licenses $update_pkgs
@ -943,10 +949,18 @@ cmd_install()
# chroot $root zypper $zypper_global_opts -t srcpackage --download-only $payload_pkgs
#kernel_version=`readlink -f $root/boot/vmlinuz 2>/dev/null | xargs basename | sed 's/vmlinuz-//'`
make_etc_jcs_jcs_conf > $root/etc/jcs/jcs.conf
mkdir -p -m 700 $root/root/.ssh
make_home_ssh_conf > $root/root/.ssh/config
chmod 600 $root/.ssh/config
[ "$copy_source_dir" ] && {
echo "=== copying over dir $copy_source_dir"
cp -rLp $copy_source_dir/* $root/
chroot $root /sbin/mkinitrd_setup # TODO remove this
chroot $root /sbin/mkinitrd_setup # TODO: remove this
touch $root/opt/ytools/bin/jcs # TODO: remove this
chroot $root /opt/ytools/bin/jcs init # TODO: remove this
}
# seed the ldap database
@ -986,7 +1000,12 @@ cmd_install()
chroot $root /usr/sbin/pam-config -a --ldap
echo "=== running jcs setup"
if [ "$SSH_AUTH_SOCK" ]; then
mkdir -m 700 -p `dirname $root/$SSH_AUTH_SOCK`
ln $SSH_AUTH_SOCK $root/$SSH_AUTH_SOCK
fi
chroot $root jcs setup
rm -f $root/$SSH_AUTH_SOCK
unmount_devices
[ -w "$install_dev" ] || {
@ -1013,10 +1032,20 @@ if [ `whoami` != root ]; then
exe=`/bin/pwd`/$exe
exe=`readlink -f $exe`
}
sudo -i $exe $@ -p $root_password_file
# preferring "ssh -l root localhost" over "sudo" to keep ssh-agent environment
#sudo -i $exe $@ -p $root_password_file
ssh -l root localhost $exe $@ -p $root_password_file
exit $?
fi
case $arch in
i386,i586,i686)
linux32;;
x86_64)
setarch x86_64;;
esac
name=$o_name-$arch
root=/srv/nfs/boot/distros/$name/ro