apt-home

From mingus
Jump to: navigation, search

apt-home installs all of the packages provided on the command line to a subdirectory of your home directory. This includes their uninstalled prerequisites. So long as the packages contain relatively simple applications there is a good chance they will work when installed in this way, saving you a lot of time. This script is perfectly safe - simply rm -fr ~/debs in order to remove everything it has installed.

This script is a concept/demo. It works, you can use it, but I spent about 20 minutes coding it and I know it has bugs. For example, it performs that copy command unconditionally on all packages every time..:)

You'll want to set up your environment by modifying your ~/.bash_profile.

Usage: apt-home some packages

export PATH=$PATH:~/debs/usr/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/debs/lib:~/debs/usr/lib

And the script, apt-home.sh

#!/bin/bash
# Copyright, 2009, Regents of the University of Colorado, Brian Mingus
#
# This file is part of the apt-home
#
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Lesser General Public
#   License as published by the Free Software Foundation; either
#   version 2.1 of the License, or (at your option) any later version.
#
#   This library 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
#   Lesser General Public License for more details.

# apt-home - installs the provided debian packages and their uninstalled
# prerequisites into the users home directory

debdir=~/debs; mkdir -p $debdir; cd $debdir;
aptitude download $(aptitude -vys install $@ | grep Inst | cut -f2 -d" " | tr "\n" " ")
for pkg in $(echo *deb | sed 's/\.deb//g'); do
    echo $pkg*;
    dpkg -x $pkg.deb $pkg;
    cp -r $pkg/* .;
done