Skip to content

Commit

Permalink
Post install script (#1959)
Browse files Browse the repository at this point in the history
* update goreleaser and add postinstall script

* remove a missing link
  • Loading branch information
hellt committed Mar 26, 2024
1 parent 459884a commit 4926307
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yml
Expand Up @@ -14,7 +14,7 @@ env:
GO_VER: "1.20.2"
CGO_ENABLED: 0
MKDOCS_INS_VER: 9.5.9-insiders-4.52.2-hellt
GORELEASER_VER: v1.11.4
GORELEASER_VER: v1.19.2
PY_VER: "3.10"

jobs:
Expand Down
9 changes: 5 additions & 4 deletions .goreleaser.yml
Expand Up @@ -30,8 +30,7 @@ dockers:
- 'ghcr.io/srl-labs/clab:{{ replace .Version "v" ""}}'
dockerfile: goreleaser.dockerfile
archives:
- replacements:
linux: Linux
- name_template: '{{ .ProjectName }}_{{ replace .Version "v" "" }}_{{ .Os }}_{{ .Arch }}'
files:
- lab-examples/**/*
- templates/**/*
Expand All @@ -52,9 +51,9 @@ changelog:

nfpms:
- id: containerlab-nfpms
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
file_name_template: '{{ .ProjectName }}_{{ replace .Version "v" "" }}_{{ .Os }}_{{ .Arch }}'
package_name: containerlab
maintainer: Roman Dodin <dodin.roman@gmail.com>, Karim Radhouani <medkarimrdi@gmail.com>
maintainer: Roman Dodin <dodin.roman@gmail.com>, Markus Vahlenkamp <markus.vahlenkamp@nokia.com>, Karim Radhouani <medkarimrdi@gmail.com>
homepage: https://containerlab.dev
description: |
containerlab deploys containerized networking topologies
Expand All @@ -64,6 +63,8 @@ nfpms:
- rpm
- deb
- apk
scripts:
postinstall: ./utils/postinstall.sh
bindir: /usr/bin
contents:
- src: ./lab-examples
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/published-ports.md
Expand Up @@ -117,7 +117,7 @@ topology:

The `border0` node is a tiny linux container with border0 client installed. Containerlab uses this node to create the sockets and start the tunnels as per `publish` block instructions.

Internally containerlab utilizes the [Static Sockets Plugin](https://docs.border0.com/docs/static-sockets-plugin) to provide the necessary configuration to the border0 process.
Internally containerlab utilizes the Static Sockets Plugin to provide the necessary configuration to the border0 process.

## Border0.com policies

Expand Down
34 changes: 34 additions & 0 deletions utils/postinstall.sh
@@ -0,0 +1,34 @@
#!/bin/bash

# this post install script is used to count the number of installations of containerlab
# when the installation is done via apt or yum package manager

# exit if bash shell is not found
if [ ! -e /bin/bash ]; then
exit 0
fi

# exit if no /etc/apt/sources.list.d/netdevops.list or /etc/yum.repos.d/yum.fury.io_netdevops_.repo is found
if [ ! -e /etc/apt/sources.list.d/netdevops.list ] && [ ! -e /etc/yum.repos.d/yum.fury.io_netdevops_.repo ]; then
exit 0
fi

# run `containerlab version` and parse the version from the output
version=$(containerlab version | awk '/version:/{print $2}')

if [ -z "$version" ]; then
exit 0
fi

# prefixed with v
rel_version=v${version}

REPO_URL="https://github.com/srl-labs/containerlab/releases/download/${rel_version}/checksums.txt"

if type "curl" &>/dev/null; then
curl -sL -o /dev/null $REPO_URL || true
exit 0
elif type "wget" &>/dev/null; then
wget -q -O /dev/null $REPO_URL || true
exit 0
fi

0 comments on commit 4926307

Please sign in to comment.