Closed zbeekman closed 6 years ago
I love this idea! Please submit a pull request with your suggested implementation.
Hi Damian, What is your current workflow to publish a new release with download artifact?
I'm not sure if a PR is appropriate; there are two directions we could go:
cd
to the extracted source-code/OCA distributioninstall.sh
script located in the root directory of the extracted treeI should have an example of this (method 2) to you shortly.
Also, it would be nice to uuencode the binary data, however I tested some systems that I use and uudecode does not seem to be universally available, so I think it's best to just package the payload as a raw binary.
Hi Damian, To create a bundled installer script just do something like:
cat bundle-install.sh.in opencoarrays-1.2.1.tar.gz > opencoarrays-1.2.1-bundle-install.sh
Here is the boilerplate bundled install script, bundle-instal.sh.in
:
#!/bin/bash
#
# bundled-install-OCA
#
# -- This script self extracts the OpenCoarrays (OCA) distribution and then queries
# the user if they want to continue to install OCA and its prerequisites, via the
# install.sh script packaged in the root directory of the OpenCoarrays project.
#
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
# Copyright (c) 2015, Sourcery, Inc.
# Copyright (c) 2015, Sourcery Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
# 3. Neither the names of the copyright holders nor the names of their contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
OCA_DIR_NAME="opencoarrays" # when untaring, what will the directory be called?
function verify_payload()
{
match=$(grep --text --line-number '^PAYLOAD:$' $0 | cut -d ':' -f 1)
payload_start=$((match + 1))
tail -n +$payload_start $0 | tar -tzvf -
}
function untar_payload()
{
match=$(grep --text --line-number '^PAYLOAD:$' $0 | cut -d ':' -f 1)
payload_start=$((match + 1))
tail -n +$payload_start $0 | tar -xzvf -
}
if [[ $1 == '--verify' ]]; then
echo "Attempting to verify integrity of OpenCoarrays bundle..."
echo ""
verify_payload
exit $?
fi
echo "Extracting OpenCoarrays source tree..."
untar_payload && echo "" && echo "Extraction successful"
echo ""
echo "Changing directories to OpenCoarrays source tree, $OCA_DIR_NAME"
cd "$OCA_DIR_NAME"
echo ""
echo "Passing supplied command line arguments to $OCA_DIR_NAME/install.sh"
./install.sh "$@"
cd -
exit 0
# binary payload starts after special marker. Script should stop
# being parsed before it gets here.
PAYLOAD:
I'll also email you the resulting bundled script, as I can't seem to upload it here.
It may make more sense to use makeself a widely tested and employed script for making self extracting archives. We could add this as a git submodule or with subtree merge, since, the only time we will need it is when we ship a release. Or, we could even not include it in the repo at all, and have Travis-CI detect tags, run the git-archive and then makeself and upload as a release artifact to Github.
I am close to having this done as part of my broader automation and test-matrix expansion PR that has been in the works (intermittently) for a few weeks now.
:clap:
If we add this feature, it will have to be an additional download in addition to the tarball release asset, due to homebrew, and advanced users wanting to just build via cmake instead of install.sh.... I'm tempted to close this issue as a won't fix... since I'm not entirely sure how much added value it actually provides. What do you think, @rouson? Presumably, if we offer both, I guess that means that the advanced users just get the tarball and the other users can get the self extracting script. One advantage of the self extracting script is that the GPG signature and SHA256 checksum could be verified automatically on machines that have GPG installed.... I'm torn.
I probably don't understand everything involved, but I'd say it's fine to close it.
I like this idea, however I feel that fragmenting our release assets further (the zip files github automatically makes) in addition to a self-extracting script is just going to make analytics more annoying (i.e. how many people have downloaded and installed OC) and confuse potential users. I've decided to close this as won't fix, but I'm open to counter arguments.
You can embed tar.gz files into installation scripts, and the installation script will automatically extract the tarball and then install it. This means that there are now only two installation steps for users:
instead of:
I can submit a PR with edits to accomplish this, if you like. (But first I want to understand why
branch-1.0.0
and master have diverged so much, and which branch I should submit the PR against. Here is a link to an article describing how you can do this sort of thing: http://www.linuxjournal.com/content/add-binary-payload-your-shell-scripts.And this is how to add artifacts to releases: https://help.github.com/articles/creating-releases/
(Make sure to add a note with the cryptographic hash of the shell script, though to make sure it hasn't been tampered with.