[PATCH] base-files: make os-release symbolic link absolute

Florian Eckert fe at dev.tdt.de
Thu Sep 9 22:53:28 PDT 2021


>> * resolv.conf -> /tmp/resolv.conf
>> * /tmp/TZmtab -> /proc/mounts
>> 
>> For consistency, this should also apply to `/usr/lib/os-release`.
> 
> Is there any other reason than consistency to change this?

Yes, I have to elaborate on that.
I have a small script that boots the system into a called it "sandbox" 
mode.
If I do not save the sandbox config changes the system boots with old 
configuration.
This means that the changes to the configurations under /etc/ are not 
permanently saved, because I put a tmpfs over the /etc/.

For this to work, however, I have to copy the data somewhere else 
beforehand and then mount it.

mkdir -p /tmp/permetc
mount --bind /etc /tmp/permetc
mount -t tmpfs -o size="3M" none /etc
cp -r /tmp/permetc/* /etc

Now I can configure the system as I need it. If I make a mistake, I can 
reboot the system and the old configuration will be reloaded.

So if I want to check what has changed (sandbox config vs. bootup 
config).
I display a diff with the command

diff -Naur /etc/permetc/ /etc

The problem now is that the file "../usr/lib/os-release" is always shown 
as not existing, because it is a relative path and the file under 
/tmp/permetc/../usr/lib/os-release/ does not exist.

> I prefer relative links because they also work when the file system is
> accessed by the build system like Paul said.

But if that is the case, could we not write the data into the target 
file under /usr/lib/os-release and not into the linked file?
This would make such simple changes possible.
The normal case should be that the folder structure should look like on 
the target system just as we need it.

By the way, this is the only link that is relative (at least on my 
system) all others are absolute.

However thanks for the feedback and your time

-- Florian



More information about the openwrt-devel mailing list