apt-get update in building Meilix through Travis
Meilix uses Travis to build and then make a github release of the ISO. There are packages that get built in the script executed by Travis.
What problem it is solving? It’s the need of apt-get update which are:
- Update of the system to support for the newest builds.
- Adding of the repo after adding a Personal Package Archives (‘PPAs’)
By default, Travis disabled apt-get update for every build. So if we want to run it automatically for each build, we can do it in two different ways.
Way 1:Running apt-get update in before_install step.
Implementation in .travis.yml of Meilix
print 'hello world!' sudo: required before_install: - apt-get update
We already used sudo so there is no need to use sudo in the apt-get update.
This is the most simplistic approach and it update the system packages and source list before installing any packages.
Way 2: executing apt-get update in Travis through APT addon.
The addon comes under the include step and the lint follows this order:
include: - os: linux addons: apt: update: true sources: - ubuntu-toolchain-r-test packages: - debootstrap - genisoimage - p7zip-full - squashfs-tools - ubuntu-dev-tools - dpkg-dev - debhelper - fakeroot - devscripts
This is helpful in case when we don’t have the before_install step. Additionally, it allows us to specify the packages we need to install.
Choosing between the two options
One can adopt any of the above process to implement apt-update in Travis.
Meilix uses the second approach as because we don’t have before_install parameter.
Sometimes we need some commands to get executed before updating the system, so in that case we prefer before_install to prioritize the tasks.
Ubuntu LaunchPad – Personal Package Archives (‘PPAs’)