Skip to content

Merge Packaging on Linux

Cecil Coupe edited this page Aug 18, 2019 · 5 revisions

Merge Packaging for Linux

This is the way to build and package an application that hides Shoes-ness as much as possible. It's called Merge because it copies your app and files into a copy of Shoes and arranges to your app to start instead of shoes.rb (the splash screen). Then we create an installer for that combination. We use the AppImage format because it's much easier for you and Shoes to deal with.

The result is a single application file that doesn't depend of Shoes being installed somewhere.

AppImage

It's like Flatpack or Snap, only simpler. That said, AppImage is not all that forgiving - there are rules and it's easy to break the rules and Shoes doesn't really have the correct information. Shoes will build the appimage but more importantly, Shoes provides the scripts and data for you to package without the GUI. That way you can modify the data files to fit the rules, as best you can and (re)package from the command line until you and the app store maintainer are happy. There are several common download sites for appimages or you can distribute from your own website or both.

appimage link

There is a downside to all this goodness. You will have to do some more work and more importantly you can't package across platforms with merge packaging. If you want to make a Debian .deb, you need to do that on a Linux system running Shoes.

Command Line or GUI?

You will do both. There is a GUI wizard to help you define your app and build a configuration file. That configuration file can be used by the GUI to create another script that you have to run. Linux packaging uses the the fpm program.

There's a complication - Shoes won't call the fpm.sh for you. It turns out that fpm is actually a Ruby gem so you need to install it in an available Ruby, different from the ruby inside Shoes. gem install fpm That IS NOT the Ruby inside Shoes, probably your system installed ruby (or rvm/rbenv if using them) . lin-merge.rb you'll have to write for youself but we have a template down below.

build-lin.rb and merge-fpm.rb are scripts inside Shoes.

You can find Merge Packaging as a menu option in Cobbler. That launches the GUI. It is recommended you use the GUI to build the configuration file (yaml) at least once. While you can modify the fpm.sh file you probably shouldn't do it lightly.

Linux GUI

lin-cobbler

lin-page1

lin-page2

lin-page3

It is a very good idea to save the yaml file and reload it at the beginning to the GUI. It saves much typing.

Command line

Lets get the .deb built. The gui 'deploy' copied things to the 'packdir' directory so cd there. Mine has a fpm.sh and a Ytm-app/ directory. That -app directory has your code mixed in with a slightly modified Shoes and your desired gems.

./fpm.sh that's it. Now you have a .deb, Ytm-app.deb in this example.

You probably like to automate the build and not have to go through the GUI since nothing has changed there. Lets create the script to do it. Call it lin-merge.rb if you like.

# run this with  path-to-shoes/shoes --ruby lin-merge.rb file.yaml
require 'fileutils'
include FileUtils
require 'yaml'
opts = YAML.load_file(ARGV[0])
opts['packdir'] = Dir.getwd if ! opts['packdir']
home = ENV['HOME']
GEMS_DIR = File.join(home, '.shoes','+gem')
puts "DIR = #{DIR}"
puts "GEMS_DIR = #{GEMS_DIR}"
require "package/merge-lin"
PackShoes::merge_linux(opts) {|t| $stderr.puts t}```

Yes. it could be improved slightly. You can run this with your installed Shoes with a `~/.shoes/walkabout/shoes --ruby <path-to-cmd-merge.rb> <path-to-yaml>` [note: if you use a different Ruby to run this then set DIR to where Shoes is]  
Clone this wiki locally