unity7maintainers team mailing list archive
-
unity7maintainers team
-
Mailing list archive
-
Message #00027
Getting unity-control-center to use PRETTY_NAME in /usr/lib/os-release
Currently unity-control-center has the Ubuntu version hardcoded. It is
possible to fetch the version of Ubuntu from /etc/lsb-release or
/usr/lib/os-release in unity-control-center (like in gnome-control-center).
This will fix many issues. For example, I use Ubuntu 20.10 but
unity-control-center shows it as 20.04. It shows 20.04 LTS on a computer
which is running 20.04.1 LTS.
A sample implementation (with some left out TODOs) in C++:
void get_pretty_name () {
fstream file;
string word;
string filename = "/usr/lib/os-release"
file.open(filename.c_str());
while(file > part) {
// TODO: Check if 'part' contains PRETTY_NAME (in os-release), and if
so, proceed to get the value of PRETTY_NAME
}
file.close();
}
It would be much easier to do this in a Bash script:
#!/bin/bash
source /usr/lib/os-release
echo "$PRETTY_NAME"