On 2011/6/12 Simon Gomizelj <simongm...@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" > +} > +