Spotter-VM/basic.sh

50 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/sh
2017-06-23 10:17:08 +02:00
SOURCE_DIR=$(realpath $(dirname "${0}"))/basic
# Install packages
apk --no-cache add --virtual .useful git file htop libressl openssh-server openssh-sftp-server
2017-12-19 20:43:20 +01:00
apk --no-cache add docker gettext kbd-misc postfix python2 nginx
2017-09-17 23:05:00 +02:00
# Copy profile files and settings
mkdir /root/.ssh
2017-09-17 23:05:00 +02:00
mkdir -p /root/.config/htop
cp ${SOURCE_DIR}/root/.ssh/authorized_keys /root/.ssh/authorized_keys
cp ${SOURCE_DIR}/root/.config/htop/htoprc /root/.config/htop/htoprc
# Copy boot configuration
cp ${SOURCE_DIR}/boot/extlinux.conf /boot/extlinux.conf
cp ${SOURCE_DIR}/etc/inittab /etc/inittab
# Enable support for Czech characters
cp ${SOURCE_DIR}/etc/rc.conf /etc/rc.conf
cp ${SOURCE_DIR}/etc/conf.d/consolefont /etc/conf.d/consolefont
rc-update add consolefont boot
# Set legal banner with URL
cp ${SOURCE_DIR}/etc/issue.template /etc/issue.template
2017-12-19 10:09:33 +01:00
cp ${SOURCE_DIR}/sbin/issue-gen /sbin/issue-gen
# Configure Postfix
2017-12-19 11:01:37 +01:00
cp ${SOURCE_DIR}/etc/postfix/main.cf /etc/postfix/main.cf
# Create a self-signed certificate
mkdir /etc/ssl/private
openssl req -x509 -new -out /etc/ssl/certs/services.pem -keyout /etc/ssl/private/services.key -nodes -days 3654 -subj "/C=CZ/CN=$(hostname -f)"
chmod 640 /etc/ssl/private/services.key
# Configure nginx
2017-12-19 19:42:10 +01:00
mkdir /etc/nginx/apps
2017-12-19 10:09:33 +01:00
cp ${SOURCE_DIR}/etc/nginx/nginx.conf /etc/nginx/nginx.conf
cp ${SOURCE_DIR}/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
2017-09-20 14:15:57 +02:00
# Copy Portal resources
cp ${SOURCE_DIR}/usr/local/bin/portal-app-manager /usr/local/bin/portal-app-manager
cp -r ${SOURCE_DIR}/srv/portal /srv/portal
# Configure services
2017-12-21 10:38:28 +01:00
for SERVICE in crond docker nginx postfix sshd; do
rc-update add ${SERVICE} boot
service ${SERVICE} start
done