#!/bin/sh app="/usr/bin/${0##*/}" if [ ! -x "$app" ] ; then echo >&2 "specinst: $app not found" exit 1 fi errfile=$(mktemp -q) if (( $? )) ; then echo >&2 "specinst (${0##*/}): could not create temp file" exit 1 fi if ! "$app" $@ 2>"$errfile" ; then rpms=$(awk '/is needed by/ { print $1 }' < "$errfile") if [ ! "$rpms" ] ; then cat "$errfile" >&2 rm -f "$errfile" exit 1 fi rm -f $errfile echo "specinst (${0##*/}): installing $rpms" sudo rum in $rpms && "$app" $@ fi