Linux: Change reference file of lsb_release from /etc/lsb-release

This article will describe changing reference file of lsb_release from /etc/lsb-release to other file and changing output result.

1 Reason to change lsb_release reference file from /etc/lsb-release

Since lsb_release outputs distribution information, it is convenient to describe processing for each distribution.

However, there may not be processing of your distribution. And, if the distribution is derived from a upstream distribution, processing for the upstream distribution is often sufficient. For example, Ubuntu's processing is often enough for LinuxMint.

If LinuxMint can change the output of lsb_release to Ubuntu's output, LinuxMint can use Ubuntu's processing. This is also useful for createing script which uses lsb_release.

2 Change reference file of lsb_release from /etc/lsb-release

The lsb_release command refers to /etc/lsb-release and outputs information. But if LSB_ETC_LSB_RELEASE is set, it will be referenced.

Therefore, by setting LSB_ETC_LSB_RELEASE, you can change the reference file of lsb_release from /etc/lsb-release.

3 Example

For LinuxMint 18, it is as follows. Ubuntu 16.04 information is output by setting LSB_ETC_LSB_RELEASE to that of Ubuntu 16.04.

$ lsb_release -cs
linuxmint
$ export LSB_ETC_LSB_RELEASE=/etc/upstream-release/lsb-release
$ lsb_release -cs
xenial