diff options
| -rw-r--r-- | LICENSE | 21 | ||||
| -rw-r--r-- | Makefile | 10 | ||||
| -rw-r--r-- | README.md | 37 | ||||
| -rwxr-xr-x | btupdater | 87 |
4 files changed, 155 insertions, 0 deletions
@@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 seth + +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. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fb0b151 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +PREFIX ?= /usr/local + +all: + @echo RUN \'make PREFIX="$HOME/.local"\' to install + +install: + @install -Dm755 btupdater $(DESTDIR)$(PREFIX)/bin/btupdater + +uninstall: + @rm -rf $(DESTDIR)$(PREFIX)/bin/btupdater diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f25880 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# btupdater + +A small bash script for updating [Northstar](https://github.com/R2Northstar/Northstar) + +## How to Use +### Installation + +``` +make PREFIX="$HOME/.local" install +``` + +### First Launch +On first launch, `btupdater` will ask for the absolute path to your Titanfall 2 installation (usually under `~/.steam/steam/steamapps/common/Titanfall2` if installed through steam). + +Afterwards, `btupdater` is able to install any new Northstar release and extract it to your game directory whenever a new one is published on github. + +## Differences from other Launchers +Most other launchers for Northstar don't support Linux ([yet](https://github.com/0neGal/viper/issues/38)), so this was just a quick script I made to make a simple one for Linux. + +...and see [Warnings](#warnings) + +## Troubleshooting +### `No such file or directory` error +- If you're getting this error, your game directly is most likely + +## Warnings +### `btupdater` **will extract to anywhere it's told** +- There is currently no verification in place for the game directory path to make sure it is for Titanfall 2, so be careful + +### `btupdater` **does not actually enable Northstar** +- Northstar is only extracted to the game directory. You will need to move `Titanfall2.exe` to `Titanfall2old.exe` and symlink `NorthstarLauncher.exe` to `Titanfall2.exe` + - See [Playing on Linux](https://r2northstar.gitbook.io/r2northstar-wiki/using-northstar/playing-on-linux) on the Northstar Wiki + +## Thanks +- [lukechilds](https://github.com/lukechilds) for the [bash script](https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c) used to fetch github api info +- [0neGal](https://github.com/0neGal) for creating [viper](https://github.com/0neGal/viper) - the inspiration for this script +- [The Northstar Team](https://github.com/orgs/R2Northstar/people) for creating Northstar diff --git a/btupdater b/btupdater new file mode 100755 index 0000000..5d4e747 --- /dev/null +++ b/btupdater @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +################ +# btupdater - a small bash script for updating northstar on linux +################ + +## constants +REPO=R2Northstar/Northstar +BTUPDATER_DOTDIR="$HOME/.config/btupdater" +BTUPDATER_CONF="$BTUPDATER_DOTDIR/btupdater.conf" + +function get_path() { + ## make config file and get titanfall path + mkdir -p "$BTUPDATER_DOTDIR" + touch "$BTUPDATER_CONF" + + echo "what is the absolute path to titanfall 2?" + read -r tf_path + echo "tf_path=$tf_path" > "$BTUPDATER_CONF" +} + +function setup_conf() { + ## check for conf file and titanfall path variable + if [ -f "$BTUPDATER_CONF" ] + then + source "$BTUPDATER_CONF" + fi + + if [ -z "$tf_path" ] + then + echo "it looks like you're running btupdater for the first time. making a config file..." + get_path + fi +} + +function get_current_version() { + ## check for current release + if [ ! -f "$tf_path/ns_version.txt" ] + then + echo "NULL" + else + cat "$tf_path/ns_version.txt" + fi +} + +# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c +function repo_api_request() { + ## get info from latest release + curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" | + grep "\"$1\":" | + sed -E 's/.*"([^"]+)".*/\1/' +} + +function update_northstar() { + download_url="$(repo_api_request browser_download_url)" + echo "downloading..." + curl -fsSLo "$tf_path/northstar-$newest_version.zip" "$download_url" + echo "unziping..." + unzip -q -o "$tf_path/northstar-$newest_version.zip" -d "$tf_path/" + echo "updating version number" + echo "$newest_version" > "$tf_path/ns_version.txt" + echo "done." +} + +## get stuff for main function +setup_conf +current_version=$(get_current_version 2>&1) +echo "current version is $current_version" +newest_version=$(repo_api_request tag_name 2>&1) +echo "newest version is $newest_version" + +## check if updated is needed +if [ "$current_version" == "$newest_version" ] +then + echo "northstar is update to date." + exit +## check if northstar is installed +elif [ "$current_version" == NULL ] +then + echo "installing northstar for the first time..." +## update otherwise +else + echo "northstar is out of date. getting the newest release..." +fi + +update_northstar +exit |
