aur-add: support for multiple packages, remove before add
This commit is contained in:
parent
2c4f981b6c
commit
c5013ba3d7
38
aur-add
38
aur-add
@ -1,14 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -e $1 ]; then
|
||||
pkg=/tmp/$1
|
||||
cp $1 $pkg
|
||||
sudo chown repo:repo $pkg
|
||||
for pkg in "$@"; do
|
||||
if [ -e "$pkg" ]; then
|
||||
pkg_archive="/tmp/$pkg"
|
||||
cp "$pkg" "$pkg_archive"
|
||||
sudo chown repo:repo "$pkg_archive"
|
||||
shift
|
||||
sudo -u repo HOME=/data/repo local-repo repo -a $pkg "$@"
|
||||
else
|
||||
sudo -u repo HOME=/data/repo local-repo repo -A "$@"
|
||||
fi
|
||||
[[ "$?" != "0" ]] && exit $?
|
||||
echo Now you can install the package
|
||||
echo $ pacman -Sy $@
|
||||
|
||||
name="$(pacman -Qi --file $pkg_archive | awk -e '/Name/ { print $3 } ')"
|
||||
sudo -u repo HOME=/data/repo sh -c "
|
||||
cd /
|
||||
local-repo repo -r \"$name\"
|
||||
local-repo repo -a \"$pkg_archive\"
|
||||
"
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user