westandskif/rate-mirrors

Unable to save to file owned by root

Closed this issue · 1 comments

sm9cc commented

I find the suggested way of updating the mirrorlist file extremely inelegant since reflector can be run as root and directly save to the mirrorlist file.

Here is the issue I am having:

With root

/etc/pacman.d ❯ sudo /bin/bash -c '/usr/bin/rate-mirrors --save=/etc/pacman.d/mirrorlist arch && /usr/bin/rate-mirrors --save=/etc/pacman.d/cachyos-mirrorlist cachyos && test -f /etc/pacman.d/cachyos-v3-mirrorlist && /usr/bin/rate-mirrors --save=/etc/pacman.d/cachyos-v3-mirrorlist cachyos --arch=v3'

Error

thread 'main' panicked at 'do not run rate-mirrors with root permissions', src/main.rs:82:9
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Without root

/etc/pacman.d ❯ /bin/bash -c '/usr/bin/rate-mirrors --save=/etc/pacman.d/mirrorlist arch && /usr/bin/rate-mirrors --save=/etc/pacman.d/cachyos-mirrorlist cachyos && test -f /etc/pacman.d/cachyos-v3-mirrorlist && /usr/bin/rate-mirrors --save=/etc/pacman.d/cachyos-v3-mirrorlist cachyos --arch=v3'

Error

Error: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }

Thank you.

if you absolutely need running as root, there is
rate-mirrors --allow-root arch top level option

the tool just doesn't need this, it is supposed to rate mirrors and that's it. initially it didn't even have save option