diff --git a/Makefile b/Makefile index e447e25b7..817b986b7 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/Vagrantfile b/Vagrantfile index d25f7c7c8..672172aa6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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" diff --git a/container b/container index 26fec6f96..08873e84f 100755 --- a/container +++ b/container @@ -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