Advertisement
krzys_h

update-models.sh

Aug 5th, 2014
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.75 KB | None | 0 0
  1. #!/bin/bash
  2. echo -n "Ładowanie listy modeli z forum ... "
  3. modellist=`curl --silent "http://colobot.info/forum/viewtopic.php?f=15&t=610" | grep -o "<a class=\"postlink\" href=\"https://www.dropbox.com/s/[A-Za-z0-9.]*/[A-Za-z0-9.]*\">"`
  4. echo "ok"
  5. while read -r line; do
  6.     [[ $line =~ \"https://www.dropbox.com/s/(.*)/(.*)\" ]]
  7.     model=${BASH_REMATCH[2]}
  8.     url="https://www.dropbox.com/s/${BASH_REMATCH[1]}/${BASH_REMATCH[2]}"
  9.     echo -n "Pobieranie $model ... "
  10.     curl -L --silent $url > ./data/models-new/$model
  11.     echo "ok"
  12. done <<< "$modellist"
  13. echo -n "Instalowanie nowych modeli ... "
  14. chmod -R 0644 ./data/models-new/*
  15. sudo rm -r /usr/local/share/games/colobot/models-new
  16. sudo cp -r ./data/models-new /usr/local/share/games/colobot/models-new
  17. echo "ok"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement