summaryrefslogtreecommitdiff
path: root/server-build/my-simple-cdd/profiles/wootaler.postinst
blob: 27342f57250263f7fce5bf582480bf983ea1e5a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash

set -eu

cat > /etc/systemd/system/firstboot-wootaler.service <<EOF
[Unit]
After=mariadb.service network-online.target
Wants=network-online.target
Description="Logic to install WordPress, WooCommerce and Taler extension on first boot"

[Service]
ExecStart=/usr/local/bin/firstboot-script.sh

[Install]
WantedBy=default.target
EOF

cat > /usr/local/bin/firstboot-script.sh <<EOF
#!/bin/bash

set -eu

echo "Giving system time to complete setup"
sleep 60

echo "## Launching WooCommerce-Taler installation ##"

cd /root
if test -x woocommerce-taler
then
  echo "already exists, skipping"
else
  git clone git://git.taler.net/woocommerce-taler.git
fi
if test -x gnu-taler-payment-for-woocommerce
then
  echo "already exists, skipping"
else
  git clone git://git.taler.net/gnu-taler-payment-for-woocommerce.git
fi

# Get the necessary scripts
yes | tr y '\n' | woocommerce-taler/server-build/QEMU-autobuild/buildWooTalerServer.sh

yes | tr y '\n' | woocommerce-taler/server-build/QEMU-autobuild/buildWebstore.sh

cp /root/woocommerce-taler/server-build/QEMU-autobuild/buildReclaim.sh /usr/local/bin/deploy-reclaim.sh

# Remove self from boot sequence
rm /etc/systemd/system/firstboot-wootaler.service

echo "Postinstall script done"
exit 0
EOF

chmod +x /usr/local/bin/firstboot-script.sh

echo "Enabling firstboot-wootaler"

systemctl daemon-reload
systemctl enable firstboot-wootaler

echo "wootaler postinstall finished"