You are not logged in.

#1 2008-12-01 18:40:58

smartboyathome
Member
From: $HOME
Registered: 2007-12-23
Posts: 334
Website

Bash: unexpected end of file? Also: Check for difference in file?

Hi, I am making a script for myself which builds E17 from svn directly using the same PKGBUILDs as the snapshots use (I like to be up to date tongue). Anyway, when I try to run the script, I get:

e17-svn-builder.sh: line 402: syntax error: unexpected end of file

Here is my script:

#!/bin/sh
VERSION=0.1
usage(){
  echo 'E17 SVN Builder'
  echo 'This is version '$VERSION
  echo '-h, --help; Show this message.'
  echo '-E, --extra; Compile and install E17-svn-extra'
while [ "$#" -ne "0" ]; do
  case $1 in
    --help)
    usage
    exit 0
    ;;
    -h)
    usage
    exit 0
    ;;
    --extra)
    _EXTRA=1

# Remove all packages
rm *.pkg.tar.gz

echo 'Beginning to build e17-svn packages...'

#--- Begin building eina-svn ---
_E17PKG=eina-svn
echo 'Building '$_E17PKG'...'
# Check if the package directory exists, and if not, create it.
if [ -d $_E17PKG ]; then
  mkdir $_E17PKG
  cd $_E17PKG
else
  cd $_E17PKG
fi
# Check if the PKGBUILD exists, and if not, get it.
if [ -d PKGBUILD ]; then
  yaourt -G $_E17PKG
fi
makepkg PKGBUILD
mv *.pkg.tar.gz ../
cd ../

#--- Begin building eet-svn ---
_E17PKG=eet-svn
echo 'Building '$_E17PKG'...'
# Check if the package directory exists, and if not, create it.
if [ -d $_E17PKG ]; then
  mkdir $_E17PKG
  cd $_E17PKG
else
  cd $_E17PKG
fi
# Check if the PKGBUILD exists, and if not, get it.
if [ -d PKGBUILD ]; then
  yaourt -G $_E17PKG
fi
makepkg PKGBUILD
mv *.pkg.tar.gz ../
cd ../

#--- Begin building evas-svn ---
_E17PKG=evas-svn
echo 'Building '$_E17PKG'...'
# Check if the package directory exists, and if not, create it.
if [ -d $_E17PKG ]; then
  mkdir $_E17PKG
  cd $_E17PKG
else
  cd $_E17PKG
fi
# Check if the PKGBUILD exists, and if not, get it.
if [ -d PKGBUILD ]; then
  yaourt -G $_E17PKG
fi
makepkg PKGBUILD
mv *.pkg.tar.gz ../
cd ../

#--- Begin building ecore-svn ---
_E17PKG=ecore-svn
echo 'Building '$_E17PKG'...'
# Check if the package directory exists, and if not, create it.
if [ -d $_E17PKG ]; then
  mkdir $_E17PKG
  cd $_E17PKG
else
  cd $_E17PKG
fi
# Check if the PKGBUILD exists, and if not, get it.
if [ -d PKGBUILD ]; then
  yaourt -G $_E17PKG
fi
makepkg PKGBUILD
mv *.pkg.tar.gz ../
cd ../

#--- Begin building embryo-svn ---
_E17PKG=embryo-svn
echo 'Building '$_E17PKG'...'
# Check if the package directory exists, and if not, create it.
if [ -d $_E17PKG ]; then
  mkdir $_E17PKG
  cd $_E17PKG
else
  cd $_E17PKG
fi
# Check if the PKGBUILD exists, and if not, get it.
if [ -d PKGBUILD ]; then
  yaourt -G $_E17PKG
fi
makepkg PKGBUILD
mv *.pkg.tar.gz ../
cd ../

#--- Begin building edje-svn ---
_E17PKG=edje-svn
echo 'Building '$_E17PKG'...'
# Check if the package directory exists, and if not, create it.
if [ -d $_E17PKG ]; then
  mkdir $_E17PKG
  cd $_E17PKG
else
  cd $_E17PKG
fi
# Check if the PKGBUILD exists, and if not, get it.
if [ -d PKGBUILD ]; then
  yaourt -G $_E17PKG
fi
makepkg PKGBUILD
mv *.pkg.tar.gz ../
cd ../

#--- Begin building e_dbus-svn ---
_E17PKG=e_dbus-svn
echo 'Building '$_E17PKG'...'
# Check if the package directory exists, and if not, create it.
if [ -d $_E17PKG ]; then
  mkdir $_E17PKG
  cd $_E17PKG
else
  cd $_E17PKG
fi
# Check if the PKGBUILD exists, and if not, get it.
if [ -d PKGBUILD ]; then
  yaourt -G $_E17PKG
fi
makepkg PKGBUILD
mv *.pkg.tar.gz ../
cd ../

#--- Begin building efreet-svn ---
_E17PKG=efreet-svn
echo 'Building '$_E17PKG'...'
# Check if the package directory exists, and if not, create it.
if [ -d $_E17PKG ]; then
  mkdir $_E17PKG
  cd $_E17PKG
else
  cd $_E17PKG
fi
# Check if the PKGBUILD exists, and if not, get it.
if [ -d PKGBUILD ]; then
  yaourt -G $_E17PKG
fi
makepkg PKGBUILD
mv *.pkg.tar.gz ../
cd ../

#--- Begin building e-svn ---
_E17PKG=e-svn
echo 'Building '$_E17PKG'...'
# Check if the package directory exists, and if not, create it.
if [ -d $_E17PKG ]; then
  mkdir $_E17PKG
  cd $_E17PKG
else
  cd $_E17PKG
fi
# Check if the PKGBUILD exists, and if not, get it.
if [ -d PKGBUILD ]; then
  yaourt -G $_E17PKG
fi
makepkg PKGBUILD
mv *.pkg.tar.gz ../
cd ../

echo 'Finished building e17-svn packages!'

if [$_EXTRA = 1]; then
  echo 'Beginning to build e17-extra-svn packages...'

  #--- Begin building exml-svn ---
  _E17PKG=exml-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [ -d PKGBUILD ]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building emprint-svn ---
  _E17PKG=emprint-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building engrave-svn ---
  _E17PKG=engrave-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building epsilon-svn ---
  _E17PKG=epsilon-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building esmart-svn ---
  _E17PKG=esmart-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building etk-svn ---
  _E17PKG=etk-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building ewl-svn ---
  _E17PKG=ewl-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building e-modules-extra-svn ---
  _E17PKG=e-modules-extra-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building elitaire-svn ---
  _E17PKG=elitaire-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building entrance-svn ---
  _E17PKG=entrance-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  #--- Begin building exhibit-svn ---
  _E17PKG=exhibit-svn
  echo 'Building '$_E17PKG'...'
  # Check if the package directory exists, and if not, create it.
  if [ -d $_E17PKG ]; then
    mkdir $_E17PKG
    cd $_E17PKG
  else
    cd $_E17PKG
  fi
  # Check if the PKGBUILD exists, and if not, get it.
  if [-d PKGBUILD]; then
    yaourt -G $_E17PKG
  fi
  makepkg PKGBUILD
  mv *.pkg.tar.gz ../
  cd ../

  echo 'Finished building e17-extra-svn packages!'
fi

echo ''
echo 'All package building is complete!'
echo 'It is recommended you restart E17.'
echo 'To do this, go to menu > Enlightenment > Restart;'
echo 'If you cant, then issue this command to restart it:'
echo 'enlightenment_remote -restart'
echo ''
echo 'Have a nice day!'
exit 0

Can someone help me determine what is wrong? I couldn't find any unfinished if statements or anything I would expect to cause this.

Also, how would one check for any differences between files, and if there were differences, overwrite the old file with the new one?

Thanks,
Smartboy big_smile

Last edited by smartboyathome (2008-12-01 18:54:58)

Offline

#2 2008-12-01 18:50:58

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Bash: unexpected end of file? Also: Check for difference in file?

Missing a } for usage()
and done for while

Offline

#3 2008-12-01 18:56:11

smartboyathome
Member
From: $HOME
Registered: 2007-12-23
Posts: 334
Website

Re: Bash: unexpected end of file? Also: Check for difference in file?

Thanks Procyon. I edited my post. Perhaps you can help me with my second question?

Offline

#4 2008-12-01 18:58:35

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: Bash: unexpected end of file? Also: Check for difference in file?

[nevermind]

Last edited by byte (2008-12-01 18:59:30)


1000

Offline

#5 2008-12-01 19:09:14

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Bash: unexpected end of file? Also: Check for difference in file?

Also, how would one check for any differences between files, and if there were differences, overwrite the old file with the new one?

If it's just checking you should use cmp, something like cmp -s oldfile newfile || mv newfile oldfile

Offline

Board footer

Powered by FluxBB