All pastes #997064 Raw Edit

aurcreate

public shellscript v1 · immutable
#997064 ·published 2008-04-25 13:25 UTC
rendered paste body
#!/bin/bash# aurcreate - create clean packages prepared for upload to AUR# Version: 1.1.0# Author:  Michal Krenek (Mikos) <mikos _AT_ sg1 _DOT_ cz># License: GNU General Public License v.2#          http://www.gnu.org/licenses/gpl.txt# Modifications: #     * Version 1.1.0#         Daenyth <Daenyth+arch _AT_ gmail _DOT_ com> April 2008# This will set $BUILDSCRIPT, which is usually PKGBUILDeval `grep -m 1 BUILDSCRIPT /etc/makepkg.conf`if [ -z "$*" ]; then  echo "aurcreate - create clean packages prepared for upload to AUR"  echo "Error: You must specify package name(s)"  exit 1fifor name in "$@"; do  if [ ! -d "$name" ]; then    echo "You don't have directory '$name' here. Skipping this package..."    echo    continue  fi  if [ ! -f "$name/$BUILDSCRIPT" ]; then    echo "$BUILDSCRIPT doesn't exist in '$name' directory. Skipping this package..."    echo    continue  fi  # We want to work inside the package dir directly.  # We are probably around ~/builds/$pkgname right now.  pushd "$name"   # Create a directory that will be only for the aur package  # And ensure that it will be clean  local aurdir="aur/$name"  rm -rf "$aurdir" 2> /dev/null  mkdir -p "$aurdir"  sources=($(. $BUILDSCRIPT; echo ${source[@]}))  for source in ${sources[@]}; do    if echo $source | grep -v '://' > /dev/null; then      cp "$source" "$aurdir"    fi  done  cp "$BUILDSCRIPT" "$aurdir"    # Following our assumed directory structure from before,   # we should be at ~/builds/$pkgname/aur  # with the $pkgname directory below us and full of  # goodies for all the little children  pushd "$aurdir"  cd ..  echo "Creating new package '$name'..."  tar -cvzf "$name.tar.gz" "$name"  echo    popd # Return to ~/builds/$pkgname  cp -f "$aurdir/../$name.tar.gz" "$PWD"  popd # Return to the directory we ran the script in, to prepare for the next loopdone# vim: set ts=2 sw=2 et: