[pacman-dev] Patch: Add install like support to makepkg for repo-add

Rémy Oudompheng remyoudompheng at gmail.com
Sun Jun 12 02:45:45 EDT 2011


On 2011/6/12 Simon Gomizelj <simongmzlj at gmail.com> wrote:
> I recently started playing with repo-add to build a custom repo. I
> have a netbook and would like to avoid building packages directly on
> the machine. However I missed the niceness of automatic install with
> makepkg's -i flag. I have attempted to recreate this support for repo
> management by adding an -a/--repoadd flag which, instead of using
> pacman to install the package, adds it to a repo.

Hello,

I like this but why are there things with sudo and su in this patch?
What are they needed for?

Rémy.


> +run_repocp() {
> +    local cmd
> +    printf -v cmd "%q " "cp" -t $REPO_PATH "$@"
> +    warning "$cmd"
> +    if (( ! ASROOT )); then
> +        if type -p sudo >/dev/null; then
> +            cmd="sudo $cmd"
> +        else
> +            cmd="su root -c '$cmd'"
> +        fi
> +    fi
> +    eval "$cmd"
> +}
> +
> +run_repoadd() {
> +    local cmd
> +    printf -v cmd "%q " "$REPO_ADD" $REPO_ADD_OPTS "$@"
> +    if (( ! ASROOT )); then
> +        if type -p sudo >/dev/null; then
> +            cmd="sudo $cmd"
> +        else
> +            cmd="su root -c '$cmd'"
> +        fi
> +    fi
> +    eval "$cmd"
> +}
> +


More information about the pacman-dev mailing list