54 lines
970 B
Bash
Executable File
54 lines
970 B
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
|
|
|
|
if [ "${rpmstrap}" ]; then
|
|
|
|
#
|
|
# Use yum to install openssh if we can.
|
|
#
|
|
if [[ -x ${prefix}/usr/bin/yum ]]; then
|
|
chroot ${prefix}/usr/bin/yum -y install openssh-server
|
|
else
|
|
echo "I don't know how to install OpenSSH for your distro."
|
|
fi
|
|
|
|
#
|
|
# Finished.
|
|
#
|
|
exit
|
|
fi
|
|
|
|
#
|
|
# This function installs a package upon the guest image.
|
|
#
|
|
function install_package
|
|
{
|
|
package=$1
|
|
|
|
DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install $package
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
# Install the package.
|
|
#
|
|
install_package ssh
|
|
|
|
#
|
|
# Make sure sshd isn't running, this will cause our unmounting of the
|
|
# disk image to fail..
|
|
#
|
|
chroot ${prefix} /etc/init.d/ssh stop
|