CreateApp.sh - Simple script to create a .app of Manuskript for MacOS

I was looking for an application to use on multiple platforms to organize my various writing projects and I came upon Manuskript. It is available on Linux, MacOS and Windows which covers my requirement of multiple platforms.

In order to simplify its use on MacOS I have created a small script that takes your "manuskript" folder, renames it to Manuskript.app and creates a symlink to the executable file so that it can be started as an ordinary application on MacOS. So there is no more need to open the folder and then double click the "manuskript" executable as the operating system will now see it as an ordinary application.

How to:

  1. Download Manuskript from here (select the Mac OS X version) and extract the file.
  2. Download my script below and save it to a file, I call it CreateApp.sh, in the same folder where you downloaded Manuskript.
  3. Start a terminal and move to where you downloaded Manuskript and the file. Make the script file executable chmod +x CreateApp.sh
  4. Run the file: ./CreateApp.sh
  5. The folder should be renamed to Manuskript.app and when double clicking it the application should start like any other program on MacOS.

The script:

#!/bin/bash
#Variables
APPNAME="Manuskript.app"
EXECDIR=Contents/MacOS
CURRDIR=`/bin/pwd`

# Functions
function CreateApp {
    #Creates directory for the symlink to the executable
    /bin/mkdir -p $CURRDIR/$APPNAME/$EXECDIR

    #Creates the symlink to manuscript executable
    cd $CURRDIR/$APPNAME/$EXECDIR
    /bin/ln -s ../../manuskript
    /bin/echo "Done!"
    /bin/echo ""

    #Prints a quick guide to set a custom icon for the app
    PrintGuide
}

function RenameFolder {
    #Renames the folder
    /bin/mv manuskript $APPNAME
}

function PrintGuide {
    # Print a short guide how to set a custom icon for the newly created app.
/bin/echo "Right-click the .app file of which you want to change the icon and select" 
/bin/echo "“Get Info” (or select the file and press ⌘ + I)."
/bin/echo "Drag the icon (.icns file) you want to use over the current default one. It"
/bin/echo "should show a green plus sign when hovering the icon. Release and the icon will"
/bin/echo "update. Done :)"

}

# Check if there is a folder called manuskript or Manuskript before continuing.
if [ ! -d "manuskript" ] || [ ! -d "Manuskript" ]; then
    /bin/echo "No Manuskript folder found, exiting.."
    exit
fi

# Rename folder to Manuskript before continuing.
if [ -d "manuskript" ]; then
    /bin/echo "Folder manuskript found, renaming to Manuskript before continuing."
    RenameFolder
    CreateApp

    else
        /bin/echo "Folder Manuskript found, continuing."
        CreateApp
fi

### License ###
#Simple script to automate the update process of the self-hosted version of the Ghost.Org blogging platform.
#Copyright (C) 2018  Drakfot. 
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software Foundation,
#Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
#
#https://gnu.org/licenses/gpl.html
Mastodon