aur-add: support for multiple packages, remove before add

This commit is contained in:
root 2015-01-10 08:39:34 +01:00
parent 2c4f981b6c
commit c5013ba3d7

38
aur-add
View File

@ -1,14 +1,30 @@
#!/bin/bash #!/bin/bash
if [ -e $1 ]; then for pkg in "$@"; do
pkg=/tmp/$1 if [ -e "$pkg" ]; then
cp $1 $pkg pkg_archive="/tmp/$pkg"
sudo chown repo:repo $pkg cp "$pkg" "$pkg_archive"
sudo chown repo:repo "$pkg_archive"
shift shift
sudo -u repo HOME=/data/repo local-repo repo -a $pkg "$@"
else name="$(pacman -Qi --file $pkg_archive | awk -e '/Name/ { print $3 } ')"
sudo -u repo HOME=/data/repo local-repo repo -A "$@" sudo -u repo HOME=/data/repo sh -c "
fi cd /
[[ "$?" != "0" ]] && exit $? local-repo repo -r \"$name\"
echo Now you can install the package local-repo repo -a \"$pkg_archive\"
echo $ pacman -Sy $@ "
else
name="$@"
sudo -u repo HOME=/data/repo sh -c "
cd /
local-repo repo -r \"$pkg\"
local-repo repo -A \"$pkg\"
"
fi
[[ "$?" != "0" ]] && exit $?
echo Now you can install the package
echo \$ pacman -Sy $name
done