Skip to content

Commit

Permalink
Merge branch 'Vanilla-OS:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tobehn authored Sep 27, 2024
2 parents cec049e + 4cb9497 commit f388d27
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
20 changes: 11 additions & 9 deletions core/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
type ShellModule struct {
Name string `json:"name"`
Type string `json:"type"`
Source api.Source
Sources []api.Source
Commands []string
}

Expand All @@ -26,14 +26,16 @@ func BuildShellModule(moduleInterface interface{}, recipe *api.Recipe) (string,
return "", err
}

if strings.TrimSpace(module.Source.Type) != "" {
err := api.DownloadSource(recipe.DownloadsPath, module.Source, module.Name)
if err != nil {
return "", err
}
err = api.MoveSource(recipe.DownloadsPath, recipe.SourcesPath, module.Source, module.Name)
if err != nil {
return "", err
for _, source := range module.Sources {
if strings.TrimSpace(source.Type) != "" {
err := api.DownloadSource(recipe.DownloadsPath, source, module.Name)
if err != nil {
return "", err
}
err = api.MoveSource(recipe.DownloadsPath, recipe.SourcesPath, source, module.Name)
if err != nil {
return "", err
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion docs/articles/en/built-in-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ The following specific fields are available:
```yaml
- name: example-meson-project
type: meson
buildflags: "-Dfoo=bar"
buildflags:
- "-Dfoo=bar"
source:
url: "https://example.com/meson-project-source.tar.gz"
type: tar
Expand Down
20 changes: 18 additions & 2 deletions docs/articles/en/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Other container engines might work but have not been tested. If you have tested

## Installation

Vib is distributed as a single binary, so there's no need to install any runtime or dependencies. You can download the latest version of Vib from the [GitHub releases page](https://github.com/Vanilla-OS/Vib). Once downloaded, make the file executable and move it to a directory included in your PATH.
Vib is distributed as a single binary, so there's no need to install any runtime or dependencies. You can download the latest version of Vib from the [GitHub releases page](https://github.com/Vanilla-OS/Vib). In addition to this, Vib has official plugins which are used for all the Vanilla-OS images, they can also be downlaoded from the [Github releases page](https://github.com/Vanilla-OS/Vib) as the `plugins.tar.xz` archvie. Once downloaded, make vib executable and move it to a directory included in your PATH. Vib searches for plugins in a global search path at `/usr/share/vib/plugins/` and inside the `plugins` directory in your project directory. It is recommended to extract `plugins.tar.xz` to `/usr/share/vib/plugins/` as they are considered core vib plugins and may be used by a lot of images.

The following commands will allow you to download and install Vib:

Expand All @@ -40,11 +40,27 @@ mv vib ~/.local/bin
If wget is not installed, you can use curl:

```bash
curl -L https://github.com/Vanilla-OS/Vib/releases/latest/download/vib -o vib
curl -SLO https://github.com/Vanilla-OS/Vib/releases/latest/download/vib
chmod +x vib
mv vib ~/.local/bin
```

The following commands for the plugins:

```bash
wget https://github.com/Vanilla-OS/Vib/releases/latest/download/plugins.tar.xz
mkdir -p /usr/share/vib/plugins
tar -xvf plugins.tar.xz -C /usr/share/vib/plugins/
```

Or with curl:

```bash
curl -SLO https://github.com/Vanilla-OS/Vib/releases/latest/download/plugins.tar.xz
mkdir -p /usr/share/vib/plugins
tar xvf plugins.tar.xz -C /usr/share/vib/plugins
```

## Usage

To start using Vib, create a `vib.yml` file in a new directory. This file will contain the recipe for your container image.
Expand Down
5 changes: 4 additions & 1 deletion plugins/meson.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"C"
"encoding/json"
"fmt"
"strings"

"github.com/vanilla-os/vib/api"
)
Expand All @@ -12,6 +13,7 @@ import (
type MesonModule struct {
Name string
Type string
BuildFlags []string `json:"buildflags"`
Source api.Source
}

Expand Down Expand Up @@ -58,8 +60,9 @@ func BuildModule(moduleInterface *C.char, recipeInterface *C.char) *C.char {
// it is safe to simply use the specified checksum from the module definition
tmpDir := fmt.Sprintf("/tmp/%s-%s", module.Source.Checksum, module.Name)
cmd := fmt.Sprintf(
"cd /sources/%s && meson %s && ninja -C %s && ninja -C %s install",
"cd /sources/%s && meson %s %s && ninja -C %s && ninja -C %s install",
api.GetSourcePath(module.Source, module.Name),
strings.Join(module.BuildFlags, " "),
tmpDir,
tmpDir,
tmpDir,
Expand Down

0 comments on commit f388d27

Please sign in to comment.