https://pantsbuild.org/ logo
#general
Title
# general
p

purple-plastic-57801

05/16/2023, 1:01 AM
Okay okay... I need to run a script with root via
run_shell_command
.. it is to build a c library with ninja and link it with ldconfig. If I have
Copy code
system_binary(
    name="git",
    binary_name="git",
    fingerprint_args=["version"],
)

adhoc_tool(
    name = "meson",
    runnable=".build/requirements:reqs-libcamera#meson",
)

run_shell_command(
    name="libcamera",
    command="./libcamera.sh",
    runnable_dependencies=[".build/requirements:reqs-libcamera#meson", ":git"]
)

shell_sources(name="shell-scripts")
Where libcamera.sh is
Copy code
#!/usr/bin/env bash

rm -rf .lc_build_temp

mkdir -p .lc_build_temp
cd .lc_build_temp \
    && git clone <https://github.com/bloop/libcamera.git> \
    && cd libcamera \
    && git checkout v0.0.4 \
    && meson setup build \
    && ninja -C build
cd .lc_build_temp/libcamera && sudo ninja -C build install
sudo ldconfig || echo "Finished ldconfig"

rm -rf .lc_build_temp
It totally works up until it needs a sudo password 🤔 Anyway to have it ask me?
e

enough-analyst-54434

05/16/2023, 1:08 AM
If you
man sudo
and read up on
-A
- that's the core of your issue.
Maybe
-S
could allow some trick and avoid the non-existent terminal?
Like echo from an env var through a pipe to sudo?
Basically you're in a world of Rube Goldberg hurt with this one afaict.
😅 1
p

purple-plastic-57801

05/16/2023, 1:34 AM
Yeahhhhhh I assumed =(
Oh -S worked =D
3 Views