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

Paul Spooren mail at aparcar.org
Fri Sep 10 12:55:49 PDT 2021


On 9/9/21 19:53, Florian Eckert wrote:
>>> * 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
If you already run such script, can't you hard link os-release anyway?
>
> 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.
>

Looking at this I'm wondering if there is a good reason to have the file 
twice? From my understanding there should be only a single place to have 
this file?





More information about the openwrt-devel mailing list