Skip to content

Commit

Permalink
Add aurto addpkg PACKAGES... command
Browse files Browse the repository at this point in the history
Add readme example of loading a bunch of packages
  • Loading branch information
alexheretic committed Jan 30, 2018
1 parent d7b5e18 commit 0c81b77
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A simple Arch Linux aur tool for managing a local 'aurto' repository with [aurut

![](http://image.ibb.co/kmmhPR/v.gif "Usage")

- Simple `aurto add`, `aurto remove` management of local ***aurto*** repo packages.
- Simple `aurto add`, `aurto remove`, `aurto addpkg` management of local ***aurto*** repo packages.
- Automatic hourly checks & updates aur packages in the ***aurto*** repo.
- Automatic daily checks & updates `*-git` packages in the ***aurto*** repo.
- Uses _makechrootpkg_ to build packages.
Expand All @@ -27,7 +27,7 @@ makepkg -srci
# Usage
You add aur packages to your local 'aurto' repo. This is different to installing them.
```sh
aurto add|remove PACKAGES
aurto add|addpkg|remove PACKAGES
```
Once added you can install them as normal with pacman.
The packages are automatically updated periodically,
Expand All @@ -44,6 +44,11 @@ Check recent auto-update logs.
journalctl -u update-aurto --since '12 hours ago' -e
```

Add a directory full of built packages to the ***aurto*** repo
```sh
aurto addpkg $(find /path/to/packages/*pkg.tar*)
```

Rebuild all orphans packages into the ***aurto*** repo
```sh
aurto add $(pacman -Qqm)
Expand Down
22 changes: 17 additions & 5 deletions bin/aurto
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
#!/usr/bin/env bash

set -eu
version="0.2"
version="0.3"
command=${1:-}
arg1=${2:-}

function bold { echo -e "\\e[1m$*\\e[21m"; }
function green { echo -e "\\e[32m$*\\e[39m"; }
function cyan { echo -e "\\e[36m$*\\e[39m"; }
function red { echo -e "\\e[31m$*\\e[39m"; }

if [ "$command" == "add" ] && [ -n "$arg1" ]; then
sudo pacsync aurto >/dev/null
echo "aurto: Running: \`aursync --no-view --rmdeps --no-confirm --chroot --repo=aurto ${*:2}\`" >&2
aursync --no-view --rmdeps --no-confirm --chroot --repo=aurto "${@:2}"
sudo pacsync aurto >/dev/null
elif [ "$command" == "addpkg" ] && [ -n "$arg1" ]; then
echo "aurto: Running: \`repo-add /var/cache/pacman/aurto/aurto.db.tar ${*:2}\`" >&2
repo-add /var/cache/pacman/aurto/aurto.db.tar "${@:2}"
for pkg in "${@:2}"; do
cp "$pkg" /var/cache/pacman/aurto/
done
sudo pacsync aurto >/dev/null
elif [ "$command" == "remove" ] && [ -n "$arg1" ]; then
removed=""
for pkg in "${@:2}"; do
remove_out=$(repo-remove /var/cache/pacman/aurto/aurto.db.tar "$pkg" 2>&1)
if [[ $remove_out = *"ERROR"* ]]; then
echo -e "aurto: \\e[36m$pkg \\e[31mnot found\\e[39m" >&2
echo "aurto: $(cyan "$pkg") $(red not found)" >&2
else
rm -rf /var/cache/pacman/aurto/"$pkg"*.pkg.* || true
removed="$pkg $removed"
fi
done
if [ -n "$removed" ]; then
echo -e "aurto: Removed \\e[36m$removed\\e[39m" >&2
echo -e "aurto: Removed $(cyan "$removed")" >&2
sudo pacsync aurto >/dev/null
fi
else
echo -e "\\e[1maurto \\e[21mv$version: simple management tool for the 'aurto' repository"
echo -e " Usage: \\e[32maurto add\\e[39m|\\e[32mremove \\e[36mPACKAGES...\\e[39m"
echo -e "$(bold aurto) v$version: simple management tool for the 'aurto' repository"
echo -e " Usage: $(green aurto add)|$(green addpkg)|$(green remove) $(cyan PACKAGES...)"
exit 1
fi

0 comments on commit 0c81b77

Please sign in to comment.