Skip to content

Instantly share code, notes, and snippets.

@amiad
Last active November 5, 2019 21:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amiad/d9876a004c3e836a69a7 to your computer and use it in GitHub Desktop.
Save amiad/d9876a004c3e836a69a7 to your computer and use it in GitHub Desktop.
moved to: https://github.com/amiad/aur2aur4 | Import packages from aur3 to aur4 by packages list or aur user
#!/bin/bash
function help_script(){
echo 'argument is missed'
echo 'Usage:'
echo './import-to.aur4.sh -l "pack1 pack2 pack3"'
echo 'or'
echo './import-to.aur4.sh -u username'
exit
}
if [[ -z $1 ]]; then
help_script
fi
while getopts ":l:u:" o; do
case "${o}" in
l)
list=$OPTARG
;;
u)
results=$(curl "https://aur.archlinux.org/rpc.php?type=msearch&arg=$OPTARG")
list=$(echo $results | grep -Po '"Name":.*?[^\\],' | cut -d'"' -f4)
if [[ ! $list ]]; then
echo 'This user has no packages';
exit;
fi
;;
\?)
help_script
;;
esac
done
mkdir aur4
cd aur4
for package in $list; do
git clone ssh://aur@aur4.archlinux.org/$package.git
prefix=$(echo $package | cut -c1-2)
wget "https://aur.archlinux.org/packages/$prefix/$package/$package.tar.gz"
tar xzf $package.tar.gz
rm -rf $package.tar.gz
cd $package
mksrcinfo
git add .
git commit -m "Initial import"
git push origin master
cd ..
done
cd ..
echo "Import finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment