82 lines
1.4 KiB
Bash
Executable File
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
|
|
|
|
|
|
|