Skip to content
Snippets Groups Projects
Commit 4f4a4106 authored by nimrod's avatar nimrod
Browse files

First implementation.

Simplest form I could find, but not all forms of invocation work.
parent e513c168
Branches
Tags first_implementation
No related merge requests found
hello
hello.uu
bundle
output
---
language: c
dist: trusty
sudo: false
group: beta
addons:
apt:
packages:
- sharutils
script:
- bats .
notifications:
email: false
on_failure: never
MIT License
Copyright (c) 2017 Adar Nimrod
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
bundle: hello.uu shellscript
cat shellscript hello.uu > bundle
chmod 755 bundle
hello.uu: hello
uuencode hello output > hello.uu
hello: hello.c
gcc -o hello hello.c
# Bundle
[![Build Status](https://travis-ci.org/adarnimrod/bundle.svg?branch=master)](https://travis-ci.org/adarnimrod/bundle)
> Bundle a binary file into a shell script.
This a proof of concept on how to create a shell script that contains a binary
file for easy installtion.
## License
This software is licensed under the MIT license (see `LICENSE.txt`).
## Author Information
Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website](
https://www.shore.co.il/). Patches are welcome via [`git send-email`](
http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located
at: <https://www.shore.co.il/git/>.
#include <stdio.h>
int main(void) {
printf("Hello world.\n");
return 0;
}
#!/bin/sh
set -eu
uudecode "$0"
./output
exit
#!/usr/bin/env bats
setup () {
git clean -fdX
make bundle
}
@test './bundle' {
run ./bundle
[ "$output" = "Hello world." ]
[ "$status" -eq 0 ]
}
@test 'sh bundle' {
run sh bundle
[ "$output" = "Hello world." ]
[ "$status" -eq 0 ]
}
@test 'cat bundle | sh' {
skip "This will fail"
run sh -c 'cat bundle | sh'
[ "$output" = "Hello world." ]
[ "$status" -eq 0 ]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment