Skip to content

Autoupdate Script

BigOokie edited this page Aug 29, 2018 · 2 revisions

Autoupdate Script

Overview

The following outlines a shell script that I have been using to help automate the update and re-installation of the Wing Commander Bot from source on GitHub. As of v0.2.0-beta.8, the script is included in the main source repository. You will need to be running a v0.2.0-beta.8 or newer to access it from the repository.

What it does

The script will perform the following actions:

  • Change directory to where the Wing Commander GitHub source is expected to be located.
  • Perform a HARD RESET of your local working copy (source code). This is DESTRUCTIVE and any changes made in the local working folders will be lost!
  • Pull the latest source from the master branch.
  • Build and Install the application. This will place the newly built app into your $GOPATH/bin folder.
  • Checks if an existing instance of Wing Commander is already running, and terminates it if found.
  • Runs the newly built version of Wing Commander using the -v parameter to perform a version check. This is informational only.
  • Runs the newly built version of Wing Commander as a background process.
  • Reports on the success or failure of the upgrade attempt.

Setup (required prior to v0.2.0-beta.8)

If you have updated to v0.2.0-beat.8 or newer, you can skip this step as the script will be included in the source you have already downloaded.

For versions prior to v0.2.0-beta.8, you will need to log into your target machine using SSH. Use your preferred editor (such as nano) to create a new file (wc-update.sh) in your users home folder (should be the default folder when you login).

Copy the following script into your newly created wc-update.sh file and save.

The Script

The source for the wc-update.sh script can be found in the main repository here:

The source will no longer be contained here to prevent the two from getting out-of-sync.

Running the script

Prior to v0.2.0-beta.8

Use the following command line to run the upgrade script (assuming you are in the same folder as the script):

sh ./wc-update.sh

v0.2.0-beta.8 or newer

You should use the script provided by the repository as it will be maintained and updated. Use the following command to run it:

Use the following command line to run the upgrade script (assuming you are in the same folder as the script):

sh $GOPATH/src/github.com/BigOokie/skywire-wing-commander/scripts/wc-update.sh