Makefile: Move most of the provision process into build system

Tests:

- Performing a fresh container setup works.

- Performing a fresh VM setup works.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-02-01 10:39:23 -08:00 committed by James Valleroy
parent 808380ff52
commit ba55d8fe2e
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 35 additions and 34 deletions

View File

@ -127,4 +127,35 @@ clean:
rm -rf Plinth.egg-info
find plinth/locale -name *.mo -delete
.PHONY: update-translations configure build install check clean
# Run basic setup for a developer environment (VM or container)
provision-dev:
# Install newer build dependencies if any
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get build-dep --yes .
# Install latest code over .deb
$(MAKE) build install
# Reload newer systemd units, ignore failure
-systemctl daemon-reload
# Stop any ongoing upgrade, ignore failure
-killall -9 unattended-upgr
# Fix any broken packages
dpkg --configure -a
apt-get -f install
apt-get update
# Install new packages needed by essential apps. Don't uninstall
# freedombox in case new dependencies conflict with old dependencies
apt-mark hold freedombox
DEBIAN_FRONTEND=noninteractive apt-get install --no-upgrade --yes \
$$(sudo -u plinth ./run --develop --list-dependencies)
apt-mark unhold freedombox
# Install additional packages
DEBIAN_FRONTEND=noninteractive apt-get install --yes ncurses-term \
sshpass bash-completion
.PHONY: update-translations configure build install check clean provision

17
Vagrantfile vendored
View File

@ -23,21 +23,8 @@ Vagrant.configure(2) do |config|
SHELL
config.vm.provision "shell", inline: <<-SHELL
cd /freedombox/
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get build-dep --no-install-recommends --yes .
make build install
systemctl daemon-reload
# Stop any ongoing upgrade
killall -9 unattended-upgr
dpkg --configure -a
apt -f install
apt-get update
# In case new dependencies conflict with old dependencies
apt-mark hold freedombox
DEBIAN_FRONTEND=noninteractive apt-get install --no-upgrade -y $(sudo -u plinth ./run --develop --list-dependencies)
apt-mark unhold freedombox
# Install ncurses-term
DEBIAN_FRONTEND=noninteractive apt-get install -y ncurses-term
make provision-dev
echo 'alias freedombox-develop="cd /freedombox; sudo -u plinth /freedombox/run --develop"' >> /home/vagrant/.bashrc
SHELL
config.vm.provision "tests", run: "never", type: "shell", path: "plinth/tests/functional/install.sh"

View File

@ -159,24 +159,7 @@ set -xe pipefail
cd /freedombox/
sudo apt-get update
if [ $(lsb_release --release --short) != '10' ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-get build-dep \
--no-install-recommends --yes .
fi
sudo make build install
sudo systemctl daemon-reload
# In case new dependencies conflict with old dependencies
sudo apt-mark hold freedombox
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-upgrade --yes \
$(sudo -u plinth /freedombox/run --develop --list-dependencies)
sudo apt-mark unhold freedombox
# Install additional packages
sudo DEBIAN_FRONTEND=noninteractive apt-get install --yes ncurses-term \
sshpass bash-completion
sudo make provision-dev
echo 'alias freedombox-develop="cd /freedombox; sudo -u plinth /freedombox/run --develop"' \
>> /home/fbx/.bashrc