1 |
On Sun, 2021-03-21 at 12:39 -0500, William Hubbs wrote: |
2 |
> All, |
3 |
> |
4 |
> the following is a script which will migrate a Gentoo system to the usr |
5 |
> merge layout. This is similar to the unsymlink-lib tool used to migrate |
6 |
> a system from the 17.0 to the 17.1 profiles. |
7 |
> |
8 |
> I'm attaching it here to get some comments before I package it, so |
9 |
> please let me know if I have missed something. |
10 |
|
11 |
To be honest, I don't think critical system modifications should be done |
12 |
in shell script, and especially not via a fringe non-standards complaint |
13 |
shell implementation in busybox. Even if you can assume you make no |
14 |
mistakes, shell is unreliable by design. For example, your script may |
15 |
start behaving in unexpected ways if you run out of space. |
16 |
|
17 |
You don't seem to be handling file collisions at all. Even today we |
18 |
have files like /bin/bzip2 and /usr/bin/bzip2, not to mention shared |
19 |
libraries. Silently ignoring the problem or requiring the users to |
20 |
manually ensure their system is clean is not going to solve it. |
21 |
|
22 |
You don't seem to provide any helpful messages. When things fail, user |
23 |
will be left in the blue with an error message from some system tool (or |
24 |
rather, cheap-ass busybox rewrite, I guess). |
25 |
|
26 |
Also, have you verified that busybox's cp(1) actually preserves all file |
27 |
properties (including xattrs, ACLs, caps...)? |
28 |
|
29 |
Please don't forget to include tests with it. Docker's good for testing |
30 |
stuff like this. |
31 |
|
32 |
-- |
33 |
Best regards, |
34 |
Michał Górny |