Introducing systemd mfg.service

This commit is contained in:
D4rk4 2020-07-31 15:32:43 +02:00
parent 5adc1b90ef
commit 7e9d5f0586
4 changed files with 25 additions and 9 deletions

View file

@ -1,4 +1,5 @@
#!/bin/bash
bootflag='/.manufactured'
groot='/opt/coins-demo'
k8sDemoWA () {
@ -11,5 +12,9 @@ ansible () {
ansible-playbook bootstrap-node.yml && \
ansible-playbook init-cluster.yml
}
k8sDemoWA;
ansible;
if [ ! -f ${bootflag} ]; then
touch ${bootflag}
k8sDemoWA;
ansible;
fi

View file

@ -102,7 +102,9 @@ d-i preseed/late_command string in-target /bin/sh -c " \
curl -L https://dl.bintray.com/flant/werf/v1.1.19+fix10/werf-linux-amd64-v1.1.19+fix10 -o /usr/bin/werf ; \
chmod +x /usr/bin/werf ; \
git clone https://git.ix.gs/public/coins-demo.git /opt/coins-demo ; \
cp /opt/coins-demo/contrib/rc_local.tpl /etc/rc.local ; \
cp /opt/coins-demo/contrib/mfg.service /usr/lib/systemd/system/ ; \
systemctl daemon-reload ; \
systemctl enable mfg.service ; \
systemctl enable serial-getty@ttyS0.service ; \
systemctl enable docker.service \
|| true"

15
contrib/mfg.service Normal file
View file

@ -0,0 +1,15 @@
[Unit]
Description=Manufacturing service
After=serial-getty@ttyS0.service
After=docker.service
[Service]
Type=oneshot
ExecStart=/opt/coins-demo/contrib/firstboot.sh
StandardInput=tty
TTYPath=/dev/ttyS0
TTYReset=yes
TTYVHangup=yes
[Install]
WantedBy=multi-user.target

View file

@ -1,6 +0,0 @@
#!/bin/bash
bootflag="/.manufactured"
if [ ! -f ${bootflag} ]; then
exec /opt/coins-demo/contrib/firstboot.sh
touch ${bootflag}
fi