#!/usr/bin/env bash

NAME=$1

echo "### Stop odoo service"
multipass exec $NAME -- sudo systemctl stop odoo12

echo "### Remove old repostitories"
multipass exec $NAME -- sudo rm -r /home/ubuntu/odoo12
multipass exec $NAME -- sudo rm -r /home/ubuntu/custom/zdc-core-addons
multipass exec $NAME -- sudo rm -r /home/ubuntu/custom/zdc-oca-addons

echo "### Clone new repositories"
multipass exec $NAME -- /usr/bin/git clone git@gitea.egroup.sk:development/zdc-odoo --depth 1 --branch master /home/ubuntu/odoo12
multipass exec $NAME -- /usr/bin/git clone git@gitea.egroup.sk:development/zdc-core-addons --depth 1 --branch master /home/ubuntu/custom/zdc-core-addons
multipass exec $NAME -- /usr/bin/git clone git@gitea.egroup.sk:development/zdc-oca-addons --depth 1 --branch master /home/ubuntu/custom/zdc-oca-addons

echo "### Start odoo service"
multipass exec $NAME -- sudo systemctl start odoo12
