Spotter-VM/basic.sh

57 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/sh
set -e
2017-06-23 10:17:08 +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
# Install packages
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
# Copy boot configuration
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
>/etc/motd
# Enable support for Czech characters
cp etc/rc.conf /etc/rc.conf
cp etc/conf.d/consolefont /etc/conf.d/consolefont
# Configure NTP client
cp etc/conf.d/ntpd /etc/conf.d/ntpd
2018-09-04 21:42:26 +02:00
# Configure networking
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
# 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
cp etc/init.d/vmmgr /etc/init.d/vmmgr
rc-update -u
cp -r srv/vm /srv/vm
2018-09-04 21:42:26 +02:00
ln -s /srv/vm/cli.py /usr/bin/vmmgr
# Configure nginx and create a self-signed certificate
cp etc/nginx/nginx.conf /etc/nginx/nginx.conf
vmmgr install
2018-09-14 11:21:35 +02:00
# Configure postfix
cp etc/postfix/main.cf /etc/postfix/main.cf
2018-09-14 11:21:35 +02:00
newaliases
# Configure services
2018-09-14 11:21:35 +02:00
for SERVICE in cgroups consolefont crond iptables nginx ntpd postfix swap vmmgr; do
rc-update add ${SERVICE} boot
service ${SERVICE} start
done