#!/bin/sh # # Yogurt: AUR unsupported packages builder # # Copyright (C) 2005, Federico Pelloni # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # COL_WHITE="\033[1;37m" COL_LIGHT_BLUE="\033[1;34m" COL_YELLOW="\033[1;33m" COL_NORMAL="\033[0m" COL_RED="\033[1;31m" NAME="yogurt" READER="vi" error() { echo -e "$COL_RED""Error""$COL_NORMAL"": $1\n" exit 1 } usage() { echo -e "$COL_WHITE""Usage""$COL_NORMAL"": yogurt {package-name}\n" exit 1 } echo echo -e "$COL_WHITE""Yogurt: AUR unsupported packages builder""$COL_NORMAL" echo [ -z "$1" ] && usage PKG="$1" echo -e "Installing package '""$COL_LIGHT_BLUE""$PKG$COL_NORMAL'" echo WDIR="aur-$PKG" if [ -d "$WDIR" ]; then echo -n -e " $COL_RED!!$COL_NORMAL"" Directory $WDIR already exists. Delete it? [Y/n] " read DELETE_DIR if [ -z "$DELETE_DIR" ] || [ "$DELETE_DIR" == "y" ] || [ "$DELETE_DIR" == "Y" ]; then rm -rf "$WDIR" || error "Unable to delete directory $WDIR. Please remove it using root privileges." else echo -e "\n$COL_RED""Error:$COL_NORMAL"" Unable to work without using that directory.\n" exit 1 fi fi mkdir "$WDIR" || error "Unable to create directory $WDIR. Please move to a writable directory." cd "$WDIR/" echo echo "Retrieving the tarball..." wget -q "http://aur.archlinux.org/packages/$PKG/$PKG.tar.gz" || error "Unable to retrieve the tarball." tar xfvz "$PKG.tar.gz" > /dev/null cd "$PKG/" echo "Do you want to see the PKGBUILD? [Y/n] " read SEE_PKGBUILD if [ "$SEE_PKGBUILD" != "n" ] && [ "$SEE_PKGBUILD" != "N" ]; then $READER PKGBUILD fi echo echo "Continue building and installing '$PKG'? [Y/n] " read CONTINUE_INSTALLING if [ "$CONTINUE_INSTALLING" == "n" ] || [ "$CONTINUE_INSTALLING" == "N" ]; then exit fi echo DEPS=$(grep '^depends=' PKGBUILD | cut -c 9- | tr -d "()'") DEPS="$DEPS $(grep '^makedepends=' PKGBUILD | cut -c 13- | tr -d \(\)\')" echo -e "$COL_WHITE$PKG dependencies:$COL_NORMAL" DEP_AUR="" DEP_PACMAN=0 for D in $DEPS; do pacman -Q "$D" > /dev/null 2>&1 && echo -e " - $COL_WHITE$D$COL_NORMAL (already installed)" && continue pacman -Si "$D" > /dev/null 2>&1 && echo -e " - $COL_LIGHT_BLUE$D$COL_NORMAL (package found)" && DEP_PACMAN=1 && continue echo -e " - $COL_YELLOW$D$COL_NORMAL (building from AUR)" && DEP_AUR="$DEP_AUR $D" done echo if [ -n "$DEP_AUR" ]; then DEP_AUR=$(echo "$DEP_AUR" | cut -c 2-) echo "Building missing dependencies from AUR:" echo "$DEP_AUR" for xD in $DEP_AUR; do $0 "$xD" done fi echo echo -e "$COL_WHITE""Building and installing package$COL_NORMAL\n" echo "Please provide the root password to let me install the package." makepkg -s -i || error "Makepkg was unable to create or install the package." mv *.pkg.tar.gz .. || sudo mv *.pkg.tar.gz .. cd .. exit