Skip to content

Instantly share code, notes, and snippets.

@ammmze
Last active November 24, 2025 11:49
Show Gist options
  • Select an option

  • Save ammmze/3243dd878ccde5d0c486e3650e0daa49 to your computer and use it in GitHub Desktop.

Select an option

Save ammmze/3243dd878ccde5d0c486e3650e0daa49 to your computer and use it in GitHub Desktop.
Script to swap mainsail source

Switch Mainsail

This script provides an easy way to switch the mainsail release to different zip.

First you must download the script.

Run the following commands on your host machine running mainsail to download the script.

wget -O ~/switch-mainsail.sh https://gist.githubusercontent.com/ammmze/3243dd878ccde5d0c486e3650e0daa49/raw/switch-mainsail.sh
chmod +x ~/switch-mainsail.sh

Usage

Use one of the following options to switch to the official Mainsail crew release or the Happy hare alpha

Option 1: Install latest official Mainsail release

Tip

Use this option when you are done using the Happy Hare fork and want to revert back to stock mainsail when Happy Hare changes are merged.

Run the script without any parameters to install to the latest official mainsail release.

~/switch-mainsail.sh

Update moonraker update_manager to track this fork instead. Find your existing update_manager for mainsail and update it back to the stock values, which should like this:

[update_manager mainsail]
type: web
channel: stable
repo: mainsail-crew/mainsail
path: ~/mainsail

Option 2: Install Happy Hare alpha/beta release

Update mainsail version to Happy Hare alpha/beta release. This is my own fork of the Happy Hare alpha code. It is updated with moggieuk's fork every half hour. It also contains an additional feature I am working on to automatically display the print dialog when a new gcode file is added. This can be useful for use in slicers like Orca Slicer that can automatically switch to the device/mainsail tab after uploading. This will then enable you to perform the tool mapping in mainsail before actually starting the print.

~/switch-mainsail.sh https://github.com/ammmze/mainsail/releases/download/hh-alpha/mainsail-latest.zip

Tip

If you don't see the new MMU panel after reloading the page, you may need to perform a hard refresh. A hard refresh instructs your browser to ignore its cache when reloading the page and will build a new cache. On windows this can be done by pressing ctrl+shift+r or on macOS with cmd+shift+r.

Update moonraker update_manager to track this fork instead. Find your existing update_manager for mainsail and update it with the following:

repo: ammmze/mainsail
channel: beta

Tip

If you want moonraker to check for mainsail updates more frequently, you can also set refresh_interval to customize that. For example:

refresh_interval: 12

Here is a complete example mainsail update_manager:

[update_manager mainsail]
type: web
repo: ammmze/mainsail
channel: beta
path: ~/mainsail
refresh_interval: 12

Restart Moonraker to have it use the updated update_manager.

#!/bin/sh
RELEASE_ZIP_URL="${1:-https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip}"
echo "Downloading mainsail release from ${RELEASE_ZIP_URL}"
wget -O /tmp/mainsail.zip "${RELEASE_ZIP_URL}"
if [ -d ~/mainsail ]; then
ts=$(date +%Y%m%d%H%M%S)
echo "Backing up existing install to ~/mainsail-${ts}"
mv ~/mainsail ~/mainsail-${ts}
fi
mkdir ~/mainsail
unzip /tmp/mainsail.zip -d ~/mainsail
rm /tmp/mainsail.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment