mklive.sh: Redefining the behavior of `option -r <repo>`
Redefine
-r <repo>will be recorded in XBPS_REPOSITORY.- if not
-r <repo>, using default repo. it is defined in lib.sh. - if adding arguments
-r <repo>, just using-r <repo>. - arguments
-r <repo>can be added multiple times.
Example
Example / 1
sudo ./mklive.sh
not -r, using default ==> rusult:
XBPS_REPOSITORY="--repository=https://repo-default.voidlinux.org/current --repository=https://repo-default.voidlinux.org/current/musl --repository=https://repo-default.voidlinux.org/current/aarch64"
Example / 2
sudo ./mklive.sh -r "https://repo-fastly.voidlinux.org/current"
add one repo ==> rusult:
XBPS_REPOSITORY="--repository=https://repo-fastly.voidlinux.org/current"
Example / 3
sudo ./mklive.sh -r "https://repo-fastly.voidlinux.org/current" -r "https://repo-fi.voidlinux.org/current"
add two repo ==> rusult:
XBPS_REPOSITORY="--repository=https://repo-fastly.voidlinux.org/current --repository=https://repo-fi.voidlinux.org/current"
Link
I don't think this is necessary or useful:
-ris designed for providing a secondary repository (like a local path or personal repo), not overriding all specified repos- we can't rely on XBPS's config file for repos because we're populating an empty root
- if 2 mirrors are specified as repositories (like the
-r repo-fastly...case), XBPS will take the first repository that has the package, so havingrepo-defaultin there isn't a bad thing, it's just ignored
Reason for modification
If the original mechanism were followed, I wouldn't be able to select only the repository I want; it would still append the three default repositories. In practice, although I know it will continue to execute, it will try repositories I don't need.
If the new mechanism is implemented, I will have the choice. I can choose only the repositories I want, and I can still add my own pre-defined repositories that are useful in the given context.
Practical explanation
original mechanism
Under the original mechanism, execute the following instructions.
run
sudo ./mklive.sh
It will display the following message: it attempts to access a repository I don't need, although I know it will continue to execute.
[1/11] Synchronizing XBPS repository data...
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 1406KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://repo-default.voidlinux.org/current/musl/x86_64-repodata': Not Found
[*] Updating repository `https://repo-default.voidlinux.org/current/aarch64/x86_64-repodata' ...
x86_64-repodata: 30KB [avg rate: 373MB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 856KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://repo-default.voidlinux.org/current/musl/x86_64-repodata': Not Found
[*] Updating repository `https://repo-default.voidlinux.org/current/aarch64/x86_64-repodata' ...
x86_64-repodata: 30KB [avg rate: 398MB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 732KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://repo-default.voidlinux.org/current/musl/x86_64-repodata': Not Found
[*] Updating repository `https://repo-default.voidlinux.org/current/aarch64/x86_64-repodata' ...
x86_64-repodata: 30KB [avg rate: 373MB/s]
[2/11] Installing software to generate the image: base-files libgcc dash coreutils sed tar gawk squashfs-tools xorriso ...
run
sudo ./mklive.sh -r "https://repo-fastly.voidlinux.org/current"
It includes the repositories I want, but I don't have the option to manually ignore repositories I don't need.
[1/11] Synchronizing XBPS repository data...
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 5225KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 1508KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://repo-default.voidlinux.org/current/musl/x86_64-repodata': Not Found
[*] Updating repository `https://repo-default.voidlinux.org/current/aarch64/x86_64-repodata' ...
x86_64-repodata: 30KB [avg rate: 218MB/s]
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 7252KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 824KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://repo-default.voidlinux.org/current/musl/x86_64-repodata': Not Found
[*] Updating repository `https://repo-default.voidlinux.org/current/aarch64/x86_64-repodata' ...
x86_64-repodata: 30KB [avg rate: 398MB/s]
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 8312KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 457KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://repo-default.voidlinux.org/current/musl/x86_64-repodata': Not Found
[*] Updating repository `https://repo-default.voidlinux.org/current/aarch64/x86_64-repodata' ...
x86_64-repodata: 30KB [avg rate: 250MB/s]
[2/11] Installing software to generate the image: base-files libgcc dash coreutils sed tar gawk squashfs-tools xorriso ...
new mechanism
Under my modified mechanism, execute the following command.
run
sudo ./mklive.sh
The mechanism is the same as before; it will attempt to access the three preset repos.
[1/11] Synchronizing XBPS repository data...
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 1042KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://repo-default.voidlinux.org/current/musl/x86_64-repodata': Not Found
[*] Updating repository `https://repo-default.voidlinux.org/current/aarch64/x86_64-repodata' ...
x86_64-repodata: 30KB [avg rate: 364MB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 754KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://repo-default.voidlinux.org/current/musl/x86_64-repodata': Not Found
[*] Updating repository `https://repo-default.voidlinux.org/current/aarch64/x86_64-repodata' ...
x86_64-repodata: 30KB [avg rate: 364MB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 1387KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-repodata' ...
ERROR: [reposync] failed to fetch file `https://repo-default.voidlinux.org/current/musl/x86_64-repodata': Not Found
[*] Updating repository `https://repo-default.voidlinux.org/current/aarch64/x86_64-repodata' ...
x86_64-repodata: 30KB [avg rate: -- stalled --]
[2/11] Installing software to generate the image: base-files libgcc dash coreutils sed tar gawk squashfs-tools xorriso ...
run
sudo ./mklive.sh -r "https://repo-fastly.voidlinux.org/current"
Only using the repo I specified.
[1/11] Synchronizing XBPS repository data...
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 5237KB/s]
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 5581KB/s]
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 14MB/s]
[2/11] Installing software to generate the image: base-files libgcc dash coreutils sed tar gawk squashfs-tools xorriso ...
run
sudo ./mklive.sh -r "https://repo-fastly.voidlinux.org/current" -r "https://repo-fi.voidlinux.org/current" -r "https://repo-default.voidlinux.org/current"
show
[1/11] Synchronizing XBPS repository data...
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 614KB/s]
[*] Updating repository `https://repo-fi.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 443KB/s]
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 5021KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 445KB/s]
[*] Updating repository `https://repo-fi.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 468KB/s]
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 3920KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 372KB/s]
[*] Updating repository `https://repo-fi.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 705KB/s]
[*] Updating repository `https://repo-fastly.voidlinux.org/current/x86_64-repodata' ...
x86_64-repodata: 2059KB [avg rate: 6642KB/s]
[2/11] Installing software to generate the image: base-files libgcc dash coreutils sed tar gawk squashfs-tools xorriso ...
in conclusion
Under the new mechanism, I have the option to choose and control which repositories I want to use. This is why I made this change.
By the way, I've already modified a version using this mechanism for my project, and it's been verified that it can generate an ISO and boot up and function normally on my machine.In the future, it is expected that void-mklive will be added to the project using the git-submodule approach.
Finally, thank you @classabbyamp for taking the time to review my pull requests.