0

I am using GNU bash, version 3.2.51(1)-release (sparc-sun-solaris2.10) on Solaris and trying to write a bash script to configure/compile sudo after doing a few other items. Essentially I want to be able to have operators run this script so they can install sudo from source by just running this script and not having to worry about running ./configure with options and make, etc..

It appears it works up until the config.status libtool part and then it dies with:

: creating pathnames.h config.status: pathnames.h is unchanged config.status: executing libtool commands
./install_sudo.sh: line 55: configure:: command not found

install_sudo.sh is my script which basically just untar's sudo and sets up the path. It then runs a function ConfigureSudo:

here is the script now that is not working with the above error:

#!/usr/bin/bash
Unpack(){
SRCA="sudo-1.8.7.tar.gz"
SRCB="sudo-1.8.7.tar"

if [ -f $PWD/$SRCA ]; then
 echo "sudo source appears to be here!"
 `/usr/bin/gunzip "$SRCA"`
 `/usr/bin/tar xf "$SRCB"`
  else
 echo "Check your source file."
fi
}

SetupPath(){
echo "Setting up path to use included Solaris software..."
echo "Current PATH is $PATH"
PATH=/usr/sfw/bin:/usr/sfw/sbin:/usr/sfw/sparc-sun-solaris2.10/bin:$PATH
echo "Now set to $PATH"
}

ConfigureSudo(){
dir="/tmp/sudo-1.8.7"
arg1="--prefix=/usr/local"
arg2="--sysconfdir=/etc"
arg3="--localstatedir=/var/run/sudo"
arg4="--with-pam"
arg5="--with-timedir=/var/lib/sudo"
cmd=configure

$($dir/$cmd $arg1 $arg2 $arg3 $arg4 $arg5)
}

Unpack
SetupPath
ConfigureSudo

Any help to get past with is greatly appreciated. TIA! Jeff

2 Answers2

1

One suggestion would be to place the line:

set -x

immediately after the shebang line (line #1) so that commands are echoed before being executed.

That will show you any problematic expansions that are happening and may lead you to the problem.

You may also need to put it at the start of each function, I can't remember whether it carries forward into functions or not. But try it at the top of the script first.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
  • Thanks, I have tried that and everything expands properly so it does not appear to be an issue with the actual script, but more of a problem with the libtool piece and configure. – user2766895 Sep 11 '13 at 01:52
1
$($dir/$cmd $arg1 $arg2 $arg3 $arg4 $arg5)

You don't need to place that inside process substitution I think. Its output would be executed as well. You should also quote your variables properly.

"$dir/$cmd" "$arg1" "$arg2" "$arg3" "$arg4" "$arg5"
konsolebox
  • 72,135
  • 12
  • 99
  • 105