Table of Contents
Creating a Custom Installer for macOS
VDN lets you create and distribute Valentina Server with your own custom solutions. You can use the following steps to package and distribute Valentina Server for your customers.
In order to create an installer, you should review the following steps.
STEP1: Prepare Folder VSERVER
- You should install Valentina Server on your computer.
The default installation of VServer includes the following major parts:
- folder “/Library/VServer_x64”
- file “/Library/LaunchDaemons/com.paradigmasoft.vserver_x64.plist”
And optional parts:
- folder “/Library/Scripts/VServer x64 Scripts” with a set of Apple Script documents to manage Valentina Server
- file “/Library/PreferencePanes/ValentinaServers.prefPane” with Valentina Server management panel shown in the System Preferences.
- COPY to other location (e.g. Desktop/PREPARE_VSERVER/Files) folder “/Library/VServer_x64”, which looks like
VServer_x64 databases masterdb.vdb may be some other dbs databases_sqlite my_sqlite_db.sqlite licenses license_mac_xxxxxxxx projects my_project1.vsp vserver_x64.app vserver_x64.ini vlogs vserver_x64_xxxxxxxx.log dummy.pem key.pem start_me.sh stop_me.sh
- REPLACE file “license_mac_xxxxxxxx” with your “license_emb_xxxxxx” file if needed.
- DELETE all .log files
- OPTIONALLY but usually: delete database files in the folder “databases”, “sqlite_databases”.
- OPTIONALLY: rename all files and folders to your application name. There are some specific steps for macOS, renaming server.app to be MyAppServer.app.
- Rename “app” itself;
- Right-click the “app” in Finder and choose “Show Package Contents”;
- Rename “Contents/MacOS/server” to “Contents/MacOS/MyAppServer”;
- Edit “Contents/Info.plist” and change every “server” entry to “MyAppServer”;
So you get the following:
MyAppServer databases licenses license_emb_xxxxxxxx MyAppServer.app MyAppServer.ini
- IMPORTANT: open ini file and specify the port number for your application.
- If you are going to use SSL you should create your own SSL keys and replace default dummy keys.
STEP 2: Prepare Scripts
- CREATE a new folder PREPARE_VSERVER/Scripts
- COPY to this folder /Library/LaunchDaemons/com.paradigmasoft.vserver_x64.plist
- If you renamed VServer_x64, then open this file and change the name here too.
- If you renamed VServer_x64, then you can RENAME com.paradigmasoft.vserver_x64.plist itself to reflect this change. In this case, it is necessary to make changes to start_me.sh and stop_me.sh scripts.
As a result, you should get folders that looks like this:
DESCRIPTION of Installer Steps
Now you have folders ready for installation on a customer computer. For installation, you can use any Installer you prefer.
For a better understanding of steps that must be executed on a customer computer let's consider MANUAL way to install MyAppServer.
On macOS, it is quite simple steps. You just need:
- COPY your folder of “VServer_x64” into folder “/Library”
So you will get “/Library/VServer_x64”
- COPY 'com.paradigmasoft.vserver_x64.plist' into folder “/Library/LaunchDaemons”.
- START Valentina Server using SHELL command
- sudo launchctl load /Library/LaunchDaemons/com.paradigmasoft.vserver_x64.plist
DESCRIPTION of Deinstaller Steps
1) STOP Valentina Server using “launchctl unload …”
2) Remove from disk folder /Library/VServer_x64 and .plist
Installer based on Packages.app
Packages.app can be used to create an installer (as a replacement for Apple Package Maker that was discontinued and doesn't support necessary features).
You can download and check our own VServer installer.
It is quite trivial. It has four items:
- LaunchD property list – installs plist script for LaunchDeamon
- Pref Panel – installs preferences panel
- VServer – installs /Library/VServer_x64
- VServer Apple Scripts – installs management scripts
Items Pref Panel and VServer Apple Scripts are optional and can be deleted.
Note, the Valentina Server preferences panel works only with the standard name and server location.
Adjust Build Path
- Select Project item
- On the Settings tab, change Path option, it defines a folder for the resulting installer.
Adjust Payloads
Installer items contain paths from the build system, it is necessary to replace them with the local filesystem paths.
- Select VServer package and switch to Payload tab
- Select VServer_x64 folder (it is missing and marked with red color) and delete it.
- Add “PREPARE_VSERVER/Files/VServer_x64” folder to the Library
Do the same for the rest of the installer packages.
Adjust Scripts
It is necessary to adjust scripts executed before and after installation of VServer item. Select it and switch to the Scripts tab.:
- In the Pre-installation section choose script (from PREPARE_VSERVER/Files/VServer_x64 folder)
- In the Post-installation section choose start_me.sh script
NOTE: there is no need to restart macOS.