2017-12-18 22:16:21 +01:00
|
|
|
#!/bin/sh
|
2017-06-23 10:17:08 +02:00
|
|
|
|
2017-12-04 17:48:37 +01:00
|
|
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/basic
|
2017-06-25 20:49:10 +02:00
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# Install packages
|
|
|
|
apk --no-cache add docker gettext git htop kbd-misc libressl openssh-server openssh-sftp-server postfix nginx
|
2017-06-23 11:01:08 +02:00
|
|
|
|
2017-09-17 23:05:00 +02:00
|
|
|
# Copy profile files and settings
|
2017-12-18 22:16:21 +01:00
|
|
|
mkdir /root/.ssh
|
2017-09-17 23:05:00 +02:00
|
|
|
mkdir -p /root/.config/htop
|
2017-12-18 22:16:21 +01:00
|
|
|
cp ${SOURCE_DIR}/root/.ssh/authorized_keys /root/.ssh/authorized_keys
|
2017-12-04 17:48:37 +01:00
|
|
|
cp ${SOURCE_DIR}/root/.config/htop/htoprc /root/.config/htop/htoprc
|
2017-06-23 11:01:08 +02:00
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# Copy boot configuration
|
|
|
|
cp ${SOURCE_DIR}/boot/extlinux.conf /boot/extlinux.conf
|
2017-06-23 10:37:25 +02:00
|
|
|
|
|
|
|
# Forbid login on tty1, disable tty2-6
|
2017-12-18 22:16:21 +01:00
|
|
|
cp ${SOURCE_DIR}/etc/inittab /etc/inittab
|
2017-06-25 20:49:10 +02:00
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# 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
|
2017-09-18 23:04:16 +02:00
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# 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
|
2017-09-18 23:04:16 +02:00
|
|
|
|
2017-10-14 12:07:15 +02:00
|
|
|
# Configure Postfix
|
2017-12-19 11:01:37 +01:00
|
|
|
cp ${SOURCE_DIR}/etc/postfix/main.cf /etc/postfix/main.cf
|
2017-06-25 20:49:10 +02:00
|
|
|
|
|
|
|
# Create a self-signed certificate
|
2017-12-18 22:16:21 +01:00
|
|
|
mkdir /etc/ssl/private
|
2017-06-25 20:49:10 +02:00
|
|
|
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
|
|
|
|
|
2017-09-18 17:50:13 +02:00
|
|
|
# Configure nginx
|
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
|
|
|
|
2017-09-18 17:50:13 +02:00
|
|
|
# Copy Portal resources
|
2017-12-18 22:16:21 +01:00
|
|
|
cp ${SOURCE_DIR}/usr/local/bin/portal-app-manager /usr/local/bin/portal-app-manager
|
2017-12-04 17:48:37 +01:00
|
|
|
cp -r ${SOURCE_DIR}/srv/portal /srv/portal
|
2017-12-04 21:51:48 +01:00
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# Configure services
|
|
|
|
for SERVICE in docker nginx postfix sshd; do
|
|
|
|
rc-update add ${SERVICE} boot
|
|
|
|
service ${SERVICE} start
|
|
|
|
done
|
2017-12-04 21:51:48 +01:00
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# TODO: Hide OpenRC output
|