Last active
November 5, 2019 21:56
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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