Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Mar 10th, 2006, 11:41 PM   #1
a thing
Unverified User
 
a thing's Avatar
 
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0 a thing is on a distinguished road
Bad interpreter?

#!/bin/sh
# Installer for Nexuiz 1.5 on GNU/Linux.
#confirm download
{
	printf "Welcome to the Nexuiz 1.5 for GNU/Linux installer!\nWARNING! Nexuiz's download is 178MB, so should take at least a few minutes. Really continue? "
	read dl
	dl="`echo $dl|tr 'A-Z' 'a-z'`"
	if [ "$dl" != "y" ] && [ "$dl" != "yes" ]; then
		exit
	fi
}

#make sure $installdir is global
installdir=''

#download and extract
{
	get_installdir ()
	{
		printf "Where do you want to install Nexuiz? If you do not enter anything, Nexuiz will be installed to /usr/local/games/. "
		read installdir
		if [ -z "$installdir" ]; then
			installdir="/usr/local/games/"
		fi
		if [ ! -d "$installdir" ]; then
			printf "Error! $installdir is not a directory!\n"
			get_installdir
		fi
		if [ ! -w "$installdir" ]; then
			printf "Error! You do not have write permission in $installdir!\n"
			get_installdir
		fi
		#remove trailing /
		{
			if  [ "echo ${installdir:`expr ${#installdir} - 1`}" == "/" ]; then
				installdir="${installdir:0:`expr ${#installdir} - 1`}"
			fi
		}
	}
	get_installdir
	cd $installdir
	#wget http://easynews.dl.sourceforge.net/s.../nexuiz-15.zip
	printf "Extracting archive...\n"
	unzip nexuiz-15.zip
}

#remove unneeded stuff
{
	#archive
	{
		printf "Keep 178MB downloaded archive? "
		read archive
		archive="`echo $archive|tr 'A-Z' 'a-z'`"
		if [ "$archive" != "y" ] || [ "$archive" != "yes" ]; then
			rm nexuiz-15.zip
		fi
	}
	#check CPU architecture
		if [ "`uname -m`" == "i686" ]; then
			arch="686"
			notarch="x86_64"
		elif [ "`uname -m`" == "x86_64" ]; then
			arch="x86_64"
			notarch="686"
		else
			echo "Error! Your CPU architecture is not supported by the prebuilt Nexuiz binaries. You might be able to compile Nexuiz yourself. Instructions on the WWW at http://www.alientrap.org/forum/viewtopic.php?p=353#353\n"
			exit 1
		fi
	#ask for source
	{
		printf "Keep source? "
		read source
		source="`echo $source|tr 'A-Z' 'a-z'`"
		if [ "$source" != "y" ] || [ "$source" != "yes" ]; then
			source='*source*'
		fi
	}
	#remove files
	{
		cd Nexuiz
		rm -rf *exe* *dll* *.app* "$source" "nexuiz-linux-$notarch-sdl" "nexuiz-linux-$notarch-dedicated" nexuiz-linux.sh
	}
	#remove unneeded things in binary names
	{
		mv -f nexuiz-linux-$arch-sdl nexuiz-sdl
		mv -f nexuiz-linux-$arch-dedicated nexuiz-dedicated
	}
}

#create starter scripts
{
	cd ..
	printf "#\!/bin/sh\ncd $installdir/Nexuiz\n./nexuiz-sdl \$@\n">nexuiz-sdl
	printf "#\!/bin/sh\ncd $installdir/Nexuiz\n./nexuiz-dedicated \$@\n">nexuiz-dedicated
	ln -fs nexuiz-sdl nexuiz
}

#display GGPL
{
	printf "Nexuiz license (the GGPL) will display in 3 seconds. Hit \"q\" to exit it.\n"
	sleep 3
	#for the few systems without less
	{
		whereis less>/dev/null
		if [ "$?" == "0" ]; then
			viewer="less"
		else
			viewer="more"
		fi
	}
	$viewer Nexuiz/gpl.txt
}

#leaving message
{
	case $PATH in
		*$installdir*)
			printf "Nexuiz installed! Just enter \"nexuiz\" to play Nexuiz. You can also use \"nexuiz-dedicated\" to start a dedicated server or \"nexuiz-sdl\".\n";;
		*)
			printf "Nexuiz installed! However $installdir is not in your \$PATH.\n";;
	esac
}

When I try to run it:
notroot[0:scripts]& NexuizInstaller
: bad interpreter: No such file or directoryin/sh
notroot[0:scripts]&

It doesn't make a difference if I use /bin/sh or /bin/bash.

Other shell scripts work fine. I've no clue what's wrong.
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted.
Got 'Nux?—GNU/Linux and other free software support.
It's GNU/Linux, not just Linux.
a thing is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:34 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC