Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 60 lines (48 sloc) 1.322 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#!/bin/sh
# TODO Documentation and cleanup
set -e
. rpg-sh-setup

[ "$*" ] || set -- '--help'; ARGV="$@"
USAGE '${PROGNAME} [-f] <package> [[-v] <version>] ...
${PROGNAME} [-f] <package>[/<version>]...
${PROGNAME} [-f] -s <name>
Install packages into rpg environment.

Options
-f Force package installation even if already installed
-s <name> Install from a session created with rpg-prepare'

session=default
force=false
while getopts fs: opt
do case $opt in
   s) session="$OPTARG";;
   f) force=true;;
   ?) helpthem;;
   esac
done
shift $(( $OPTIND - 1 ))

sessiondir="$RPGSESSION/$session"
packlist="$sessiondir/package-list"
delta="$sessiondir/delta"
solved="$sessiondir/solved"

test "$session" = "default" -a -d "$sessiondir" && {
    notice "rm'ing crusty session dir: $sessiondir"
    rm -rf "$sessiondir"
}

if $force
then packageinstallargs=-f
     installfrom="$solved"
else packageinstallargs=
     installfrom="$delta"
fi

test -d "$sessiondir" || {
    trap "rm -rf '$sessiondir'" 0
    rpg-prepare -i -s "$session" "$@"
}

numpacks=$(grep -c . <"$installfrom")
if $force
then heed "installing $numpacks packages (forced)"
else heed "installing $numpacks packages"
fi

<"$installfrom" xargs -n 2 rpg-package-install $packageinstallargs

heed "installation complete"

true
Something went wrong with that request. Please try again.