server-scripts/aur-add

31 lines
623 B
Bash
Executable File

#!/bin/bash
for pkg in "$@"; do
if [ -e "$pkg" ]; then
pkg_archive="/tmp/$pkg"
cp "$pkg" "$pkg_archive"
sudo chown repo:repo "$pkg_archive"
shift
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