2017-12-18 22:16:21 +01:00
|
|
|
#!/bin/sh
|
2018-10-28 16:04:11 +01:00
|
|
|
set -ev
|
2017-06-23 10:17:08 +02:00
|
|
|
|
2018-10-25 21:48:35 +02:00
|
|
|
cd $(realpath $(dirname "${0}"))/basic
|
|
|
|
|
|
|
|
# Configure APK repository
|
|
|
|
echo "@vm https://dl.dasm.cz/spotter-abuild" >>/etc/apk/repositories
|
|
|
|
cp etc/apk/keys/repokey.rsa.pub /etc/apk/keys/repokey.rsa.pub
|
2017-06-25 20:49:10 +02:00
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# Install packages
|
2018-10-25 21:48:35 +02:00
|
|
|
apk --no-cache add ca-certificates curl bridge e2fsprogs-extra gettext iptables kbd-misc libcap libressl libseccomp postfix python3 py3-bcrypt py3-cffi py3-cryptography py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux acme-sh@vm lxc@vm
|
2017-06-23 11:01:08 +02:00
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# Copy boot configuration
|
2018-10-25 21:48:35 +02:00
|
|
|
cp boot/extlinux.conf /boot/extlinux.conf
|
|
|
|
cp boot/vm.txt /boot/vm.txt
|
|
|
|
cp etc/inittab /etc/inittab
|
|
|
|
cp sbin/extend-disk /sbin/extend-disk
|
|
|
|
cp sbin/vmtty /sbin/vmtty
|
2018-03-25 22:47:19 +02:00
|
|
|
>/etc/motd
|
2017-06-25 20:49:10 +02:00
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# Enable support for Czech characters
|
2018-10-25 21:48:35 +02:00
|
|
|
cp etc/rc.conf /etc/rc.conf
|
|
|
|
cp etc/conf.d/consolefont /etc/conf.d/consolefont
|
2017-09-18 23:04:16 +02:00
|
|
|
|
2018-02-06 16:59:00 +01:00
|
|
|
# Configure NTP client
|
2018-10-25 21:48:35 +02:00
|
|
|
cp etc/conf.d/ntpd /etc/conf.d/ntpd
|
2018-02-06 16:59:00 +01:00
|
|
|
|
2018-09-04 21:42:26 +02:00
|
|
|
# Configure networking
|
2018-10-25 21:48:35 +02:00
|
|
|
cp etc/conf.d/iptables /etc/conf.d/iptables
|
|
|
|
cp etc/iptables/rules-save /etc/iptables/rules-save
|
|
|
|
cp etc/network/interfaces /etc/network/interfaces
|
2018-09-04 21:42:26 +02:00
|
|
|
service networking restart
|
|
|
|
|
2018-10-25 21:48:35 +02:00
|
|
|
# Configure LXC
|
2018-09-11 18:33:38 +02:00
|
|
|
mkdir /var/log/lxc
|
2018-09-07 15:47:44 +02:00
|
|
|
echo -e "172.17.0.1 host" >>/etc/hosts
|
2018-09-07 15:20:07 +02:00
|
|
|
|
2018-09-04 21:42:26 +02:00
|
|
|
# Copy VMMgr resources
|
2018-10-25 21:48:35 +02:00
|
|
|
cp etc/init.d/vmmgr /etc/init.d/vmmgr
|
2018-08-23 10:44:45 +02:00
|
|
|
rc-update -u
|
2018-10-25 21:48:35 +02:00
|
|
|
cp -r srv/vm /srv/vm
|
2018-09-04 21:42:26 +02:00
|
|
|
ln -s /srv/vm/cli.py /usr/bin/vmmgr
|
2017-12-04 21:51:48 +01:00
|
|
|
|
2018-10-27 21:13:35 +02:00
|
|
|
# Configure nginx and create a self-signed certificate
|
2018-10-25 21:48:35 +02:00
|
|
|
cp etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
2018-10-27 21:13:35 +02:00
|
|
|
vmmgr install
|
2018-09-03 15:57:47 +02:00
|
|
|
|
2018-09-14 11:21:35 +02:00
|
|
|
# Configure postfix
|
2018-10-25 21:48:35 +02:00
|
|
|
cp etc/postfix/main.cf /etc/postfix/main.cf
|
2018-09-14 11:21:35 +02:00
|
|
|
newaliases
|
|
|
|
|
2017-12-18 22:16:21 +01:00
|
|
|
# Configure services
|
2018-09-14 11:21:35 +02:00
|
|
|
for SERVICE in cgroups consolefont crond iptables nginx ntpd postfix swap vmmgr; do
|
2017-12-18 22:16:21 +01:00
|
|
|
rc-update add ${SERVICE} boot
|
|
|
|
service ${SERVICE} start
|
|
|
|
done
|