Skip to content

Instantly share code, notes, and snippets.

@amiad
Last active November 5, 2019 21:56
Show Gist options
  • Select an option

  • Save amiad/d9876a004c3e836a69a7 to your computer and use it in GitHub Desktop.

Select an option

Save amiad/d9876a004c3e836a69a7 to your computer and use it in GitHub Desktop.

Revisions

  1. amiad revised this gist Jun 9, 2015. 1 changed file with 31 additions and 4 deletions.
    35 changes: 31 additions & 4 deletions import-to-aur4.sh
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,42 @@
    #!/bin/bash

    if [[ -z $1 ]]; then
    echo 'packages list is missed'
    echo 'run ./import-to-aur4.sh "pack1 pack2 pack3"'
    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 $1; do
    for package in $list; do
    git clone ssh://[email protected]/$package.git

    prefix=$(echo $package | cut -c1-2)
  2. amiad created this gist Jun 8, 2015.
    30 changes: 30 additions & 0 deletions import-to-aur4.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    #!/bin/bash

    if [[ -z $1 ]]; then
    echo 'packages list is missed'
    echo 'run ./import-to-aur4.sh "pack1 pack2 pack3"'
    exit
    fi

    mkdir aur4
    cd aur4

    for package in $1; do
    git clone ssh://[email protected]/$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"