master
Alessandro Mauri 4 years ago
parent 7f342df5d3
commit f865965e7c
  1. 39
      PROCESS.md
  2. 78
      README.md
  3. 11
      TODO.md

@ -0,0 +1,39 @@
# Making a tarinstall
## Detailed creation process
1. A temporary directory is created, from now it will be referred to as `tmp/`
2. Inside `tmp/` the structure is created (`bin/`, `lib/`, `env`, etc.)
3. The file `tmp/id` gets written
4. `tmp/bin/` gets populated with the executables listed in the `deps`
file
5. The binaries inside `tmp/bin/` get read and the list of shared libraries gets
written to `liblist`
6. The `liblist` file gets read and all the necessary libraries get downloaded
and/or copied to `tmp/lib/`, then `liblist` gets deleted
7. The binaries inside `tmp/bin/` get modified so that their `RPATH` value points
to `tmp/lib`
8. The `tmp/env` gets generated
9. The `tmp/man/` and `tmp/ext/` directories get populated with the right files
10. The checksum for the files inside `tmp` gets calculated and written to
`tmp/checksum`
11. The `tmp` directory gets compressed as a tar archive
12. The decompressor and loader programs get applied to the tar archive
13. The archive gets renamed `<id>.ti` and granted executable permission
## The project's root directory structure
The project's root directory has to contain a subdirectory called `tarinstall`
which has to contain the following elements:
- `id` file: contains the id name of the program
- `type` file: contains the type of project
- `deps` file: contains a list of the binary files that the program uses
## Types of project
The `type` file may contain one or more of these option separated by a newline
in order to determine which binaries/libraries to download or copy from the
system and in order to generate the right `env` file.
This requirement may be removed in favour of automatic recognition.
- C (also the option for C++)
- python
- go
- perl

@ -18,9 +18,13 @@ An application packaged as a tarinstall is made as such
| |
|----- App Tarball ----|
| |
| app/ |
| bin/ |
| lib/ |
| man/ |
| ext/ |
| env |
| checksum |
| id |
| |
------------------------
```
@ -29,7 +33,31 @@ Decompressor: It decompresses the archive and then runs the loader
Loader: It reads the `env` file in the tarball and enumerates the `lib/`
directory to loads all the necessary libraries and sets the correct environment
before executing the correct binary in the `app/` directory
before executing the correct binary in the `bin/` directory.
This may include changing the RPATH section of the binaries inside `bin/`
## Files and folders
- `lib/`: contains the required shared libraries
- `bin/`: will substitute `PATH` and contains all the binaries that the
application requires, such as POSIX utilities, a python interpreter, etc. As well
as the application's binaries
- `man/`: contains the manual pages for the biaries in `app`
- `ext/`: contains all other files, such as example configurations, etc.
- `env`: lists the cutom environment variables to start the application
- `checksum`: contains the checksum of the application
- `id`: contains the application id
## Utilities
### User
- `tarman`: get manual pages from a tarinstall application
- `tarext`: extract the files in `ext/`
- `tarup`: tries to find a newer version of the application using it's `id` and
`checksum` and updates it using a differential algorithm
### Devs
- `tarpack`: package a tarinstall application
## TODO
- Find a way to include external files
@ -39,18 +67,6 @@ before executing the correct binary in the `app/` directory
- Package manager for shared objects (libraries)
- Standardized way to define dependencies
## Experimental optional components in App Tarball
`ext/` directory: it includes all of the external files that have to be installed
upon running the application for the first time
`deps` file: lists all the required dependencies and their version to allow for
an empty `lib/` directory at first start, all the dependencies can be downloaded
upon running the application for the first time. It can also be used when
packaging the tarinstall to automatically download the dependencies.
`bin/` directory: it contains all other binary programs that the app may use
such as POSIX utilies and shell
## Advantages
- Allows for application compression
- Simpler and configyred in plaintext
@ -72,22 +88,23 @@ the extraction everytime.
## How it works
1. On executing the tarinstall the decompressor is executed which:
1. Calculates the cheksum of the tar application
2. It then checks the destination directory for a `checksum` file
3. If the calculated checksum matches the one in the `checksum` file it
skips the extraction
4. Else it extracts the content of the tar application in the destination
1. If the checksum matches the one in the destination directory it skips
the extraction
2. Else it extracts the content of the tar application in the destination
directory
2. The decompressor then executes the loader inside the destination directory
which:
1. It sets environment according to the `env` file
2. It overrides the loader libraries with the contents of `lib/`
3. it enters the `app/` directory and executes the binary named
3. it enters the `bin/` directory and executes the binary named
`argv[0]` with all the passed arguments
Upon packaging the tarinstall all the executables in the `bin/` directory are
modified so that their `RPATH` points to `lib/`.
## Examples
### Simple example, one binary in `app/`
### Simple example, one binary in `bin/`
```
/home/anon/.local/bin/
foo.ti
@ -95,10 +112,11 @@ which:
/bin/
foo -> /home/anon/.local/bin/foo.ti
```
executing `foo -h` starts `app/foo -h` inside `foo.ti`
- executing `foo -h` starts `bin/foo -h` inside `foo.ti`
- trying to execute `foo.ti` directly results in the execution of the only binary
in `bin/`
###More complex example, multiple biaries inside `app/`
### More complex example, multiple biaries inside `bin/`
```
/home/anon/.local/bin/
foo.ti
@ -108,6 +126,12 @@ executing `foo -h` starts `app/foo -h` inside `foo.ti`
bar -> /home/anon/.local/bin/foo.ti
baz -> /home/anon/.local/bin/foo.ti
```
- executing `foo -v` starts `app/foo -v` inside `foo.ti`
- executing `bar -h` starts `app/bar -h` inside `foo.ti`
- executing `baz -o file` starts `app/baz -o file` inside `foo.ti`
- executing `foo -v` starts `bin/foo -v` inside `foo.ti`
- executing `bar -h` starts `bin/bar -h` inside `foo.ti`
- executing `baz -o file` starts `bin/baz -o file` inside `foo.ti`
- executing `foo.ti` directly results in the execution of the binary named `foo`
inside `bin/`, if it doesn't exist
## Language
- POSIX shell (tools)
- C (loader and decompressor)

@ -0,0 +1,11 @@
# Stuff to make
- simple checksum calculator
- enter directory
- checksum of all file
- write file inside directory
- simple RPATH changer
- open file
- determine type of file, exit if not binary
- read RPATH section if present
- modify it with custom path
- save file
Loading…
Cancel
Save