Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 1st, 2011  |  syntax: None  |  size: 1.09 KB  |  views: 84  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3.  
  4. DIR=/opt/sources
  5. FOO=FOO-PKGBUILD
  6.  
  7. cd $DIR
  8. #[ $1 ] && wget -c $(wget http://help.2gis.ru/linux/ -qO- | egrep -o "http:\/\/.*2GISData_$1.*.zip") || wget -c $(wget http://help.2gis.ru/linux/ -qO- | egrep -o "http:\/\/.*2GISData.*.zip")
  9. wget -c $(wget http://help.2gis.ru/linux/ -qO- | egrep -o "http:\/\/.*2GISData_$1.*.zip")
  10.  
  11. for i in *.zip
  12. do
  13.     CITY=$(echo $i| cut -d"_" -f2,3 | cut -d"-" -f1);
  14.     cit=$(echo $CITY| tr A-Z a-z | tr -d _ );
  15.     wget -qP/var/abs/local/2gis-$cit http://aur.archlinux.org/packages/2gis-$cit/2gis-$cit/PKGBUILD
  16.     if [ $? -ne 0 ]
  17.     then
  18.         mkdir /var/abs/local/2gis-$cit;
  19.         sed "s/Foo/$CITY/g" $FOO > /var/abs/local/2gis-$cit/PKGBUILD;
  20.         sed -i "s/foo/$cit/g" /var/abs/local/2gis-$cit/PKGBUILD;
  21.     fi
  22.     k=${i#*-}; k=${k%%.*};
  23.     md5=$(md5sum $i | cut -d" " -f1);
  24.     echo $CITY $k
  25.     sed -i "s/pkgver=[0-9]*/pkgver=$k/g" /var/abs/local/2gis-$cit/PKGBUILD
  26.     sed -i "s/md5sums=('[0-9a-z]*')/md5sums=('$md5')/g" /var/abs/local/2gis-$cit/PKGBUILD
  27.     cd /var/abs/local/2gis-$cit
  28.     makepkg --source
  29.     cd $DIR
  30. done