1
0
mirror of synced 2026-02-04 15:13:12 +00:00
Files
xen-tools.xen-tools/etc/hook.d/70-install-ssh
steve c9f138b307 2006-05-24 20:12:21 by steve
Mount /proc.
2006-05-24 20:12:21 +00:00

82 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
#
# This script installs OpenSSH upon the new system. It must make sure
# that the server is not running before it exits - otherwise the temporary
# mounted directory will not be unmountable.
#
# Steve
# --
# http://www.steve.org.uk/
prefix=$1
dist=$2
#
# Install a Debian package onto the new system.
#
function installDebianPackage
{
package=$1
DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install ${package}
}
#
# Sets up the installation of OpenSSH on a Debian GNU/Linux system.
#
function setupDebian
{
case "${dist}" in
sarge)
installDebianPackage ssh
;;
etch|sid)
installDebianPackage openssh-server
installDebianPackage openssh-client
;;
esac
#
# Make sure sshd isn't running, this will cause our unmounting of the
# disk image to fail..
#
chroot ${prefix} /etc/init.d/ssh stop
}
#
# Sets up the installation of OpenSSH on a CentOS4 installation.
#
function setupCentOS4
{
chroot ${prefix} /bin/mount /proc
chroot ${prefix} /usr/bin/yum -y install openssh-server
chroot ${prefix} /usr/bin/yum -y install openssh-server
chroot ${prefix} /bin/umount /proc
}
#
# Entry point to the script.
#
case "${dist}" in
sarge|etch|sid)
setupDebian
;;
centos4)
setupCentOS4
;;
*)
echo "Unknown distribution '${dist}'. Fixme";
exit;
;;
esac