You are not logged in.

#1 2010-05-03 12:30:56

blewisjr
Member
Registered: 2010-04-06
Posts: 10

Simple AUR Setup Script

I have this nasty habbit of experimenting.  I spend more time tweaking and reinstalling arch due to clutter I decided to make my life easier after a fresh install.  I found the AUR a very nice feature especially to grab packages like wmii-hg.  I hate having to type all the pacman commands to setup the AUR/Yaourt so I wrote a simple perl script to do this all for me after a fresh reinstall.

Perl and Sudo are required.  Hopefully other people can make use of the script.  It is a very simple script and anyone can modifiy it to automate everything the want to install in a one line command if they wish.  For proper permissions do not sudo the script the script uses sudo -k internally.  If you wish to not have to type your passoword you can edit sudo with visudo and add
<user> ALL=NOPASSWD: /usr/bin/pacman where <user> is replaced by the user name.

Here is the code.

#!/usr/bin/perl

use Cwd;

# yaourt and its dependancy url's
$pkgq = "http://aur.archlinux.org/packages/package-query/package-query.tar.gz";
$yao = "http://aur.archlinux.org/packages/yaourt/yaourt.tar.gz";
$wd = cwd();

# update pacman
print "updateing pacman repositories...\n";
system "sudo -k pacman --noconfirm -Syu";
print "\n\n";

# make the build directory and navagate to it
print "switching to home directory...\n\n";
chdir;
if (-d "./build") {
    print "build directory already exists...\n";
    print "switching to build directory...\n\n";
    chdir "build";
    $wd = cwd();
}
else {
    print "build directory does not exist...\n";
    print "creating build directory...\n\n";
    mkdir "build";
    chdir "build";
    $wd = cwd();
}

# install build dependancies"
print "installing build dependancies...\n";
system "sudo -k pacman --noconfirm -S base-devel";
print "\n\n";

# install mercurial
print "installing mercurial...\n";
system "sudo -k pacman --noconfirm -S mercurial";
print "\n\n";

# install package-query (dependancy of yaourt
print "installing package-query...\n";
system "wget $pkgq";
system "tar zxvf package-query.tar.gz";
chdir "package-query";
system "makepkg -si";
chdir $wd;
print "\n\n";

# install yaourt
print "installing yaourt...\n";
system "wget $yao";
system "tar zxvf yaourt.tar.gz";
chdir "yaourt";
system "makepkg -si";
chdir $wd;
print "\n\n";

print "removing directory...\n\n";
chdir;
system "rm -r build";

print "installation complete...\n\n";

Again I hope you guys can make use out of it.

Last edited by blewisjr (2010-05-03 12:31:23)

Offline

Board footer

Powered by FluxBB