![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
Try using the dos2unix command on the shell script. I know I've had problems in the past with shell scripts formatted with \r\ns instead of \ns.
|
|
|
|
|
|
#3 |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
That fixed it
Ionno why it would have DOS EOFs.
__________________
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. |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4
![]() |
vi or nano both show ^M at the end of a line when you have this problem.
|
|
|
|
|
|
#5 |
|
Newbie
|
Or just have [dos] etc displayed down the botton whilst the file is open.
this in vi will fix it too :se ff=unix |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|