Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # The MIT License (MIT)
- # Copyright (c) 2017 mcmodder
- # Permission is hereby granted, free of charge, to any person obtaining a copy
- # of this software and associated documentation files (the "Software"), to deal
- # in the Software without restriction, including without limitation the rights
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- # copies of the Software, and to permit persons to whom the Software is
- # furnished to do so, subject to the following conditions:
- # The above copyright notice and this permission notice shall be included in all
- # copies or substantial portions of the Software.
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- # SOFTWARE.
- # This script will download latest xUSSR Set version.
- # Used files: .xussr.ver with current xUSSR Set version; xussr.tar with xUSSR Set, both in ~/.openttd/newgrf
- _NEWGRF_PATH="$HOME/.openttd/newgrf/"
- [ ! -e "${_NEWGRF_PATH}xussr.tar" ] && rm -f "${_NEWGRF_PATH}.xussr.ver"
- _VERSION_DATA=$(curl -sL http://bundles.openttdcoop.org/xussrset/push/LATEST/custom_tags.txt)
- _XUSSR_REMOTE=$( grep NEWGRF_VERSION <<<"$_VERSION_DATA" | cut -f2 -d':' )
- _XUSSR_DATE=$( grep REPO_DATE <<<"$_VERSION_DATA" | cut -f2 -d':' )
- _XUSSR_INSTALLED=$(<"${_NEWGRF_PATH}.xussr.ver") 2>/dev/null && echo "Installed xUSSR Set version: r${_XUSSR_INSTALLED}"
- echo "Latest xUSSR Set version: r$_XUSSR_REMOTE"
- [ ! -e "${_NEWGRF_PATH}xussr.tar" ] && _XUSSR_INSTALLED=""
- if [ "${_XUSSR_INSTALLED}" != "${_XUSSR_REMOTE}" ]; then
- echo "Downloading xUSSR Set r${_XUSSR_REMOTE}..."
- curl -qL "http://bundles.openttdcoop.org/xussrset/push/LATEST/xussr-r${_XUSSR_REMOTE}.zip" | funzip > "${_NEWGRF_PATH}xussr.tar"
- echo "${_XUSSR_REMOTE}" > "${_NEWGRF_PATH}.xussr.ver"
- echo "Downloaded xUSSR Set r${_XUSSR_REMOTE} (released ${_XUSSR_DATE})"
- echo "View changelog at http://dev.openttdcoop.org/projects/xussrset/repository/changes"
- else
- echo "Nothing to do"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement