diff --git a/.goreleaser-iofogctl-dev.yml b/.goreleaser-iofogctl-dev.yml index 269adffd..cecc72a6 100644 --- a/.goreleaser-iofogctl-dev.yml +++ b/.goreleaser-iofogctl-dev.yml @@ -34,11 +34,11 @@ builds: - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.commit={{ .ShortCommit }}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.date={{.Date}}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.platform={{.Os}}/{{.Arch}}" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.2" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.routerTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentVersion=3.7.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.debuggerTag=latest" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.natsTag=3.6.0" @@ -62,11 +62,11 @@ builds: - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.commit={{ .ShortCommit }}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.date={{.Date}}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.platform={{.Os}}/{{.Arch}}" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.2" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.routerTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentVersion=3.7.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.debuggerTag=latest" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.natsTag=3.6.0" @@ -87,11 +87,11 @@ builds: - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.commit={{ .ShortCommit }}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.date={{.Date}}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.platform={{.Os}}/{{.Arch}}" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.2" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.routerTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentVersion=3.7.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.debuggerTag=latest" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.natsTag=3.6.0" diff --git a/.goreleaser-iofogctl.yml b/.goreleaser-iofogctl.yml index 5203f0d0..ad38dbaf 100644 --- a/.goreleaser-iofogctl.yml +++ b/.goreleaser-iofogctl.yml @@ -37,11 +37,11 @@ builds: - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.commit={{ .ShortCommit }}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.date={{.Date}}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.platform={{.Os}}/{{.Arch}}" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.2" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.routerTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentVersion=3.7.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.debuggerTag=latest" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.natsTag=3.6.0" @@ -63,11 +63,11 @@ builds: - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.commit={{ .ShortCommit }}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.date={{.Date}}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.platform={{.Os}}/{{.Arch}}" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.2" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.routerTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentVersion=3.7.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.natsTag=3.6.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.repo=ghcr.io/eclipse-iofog" @@ -91,11 +91,11 @@ builds: - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.commit={{ .ShortCommit }}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.date={{.Date}}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.platform={{.Os}}/{{.Arch}}" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.2" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.routerTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentVersion=3.7.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.natsTag=3.6.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.repo=ghcr.io/eclipse-iofog" @@ -122,11 +122,11 @@ builds: - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.commit={{ .ShortCommit }}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.date={{.Date}}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.platform={{.Os}}/{{.Arch}}" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.2" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.routerTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentVersion=3.7.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.debuggerTag=latest" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.natsTag=3.6.0" @@ -148,11 +148,11 @@ builds: - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.commit={{ .ShortCommit }}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.date={{.Date}}" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.platform={{.Os}}/{{.Arch}}" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.operatorTag=3.7.2" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.routerTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerTag=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentTag=3.7.0" - - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.1" + - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.controllerVersion=3.7.3" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.agentVersion=3.7.0" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.debuggerTag=latest" - -s -w -X "github.com/eclipse-iofog/iofogctl/pkg/util.natsTag=3.6.0" diff --git a/Makefile b/Makefile index d0a1f670..46e3fc1a 100644 --- a/Makefile +++ b/Makefile @@ -19,17 +19,17 @@ COMMIT ?= $(shell git rev-parse HEAD 2>/dev/null) BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ) PREFIX = github.com/eclipse-iofog/iofogctl/pkg/util LDFLAGS += -X $(PREFIX).versionNumber=$(VERSION) -X $(PREFIX).commit=$(COMMIT) -X $(PREFIX).date=$(BUILD_DATE) -X $(PREFIX).platform=$(GOOS)/$(GOARCH) -LDFLAGS += -X $(PREFIX).operatorTag=3.7.1 +LDFLAGS += -X $(PREFIX).operatorTag=3.7.2 LDFLAGS += -X $(PREFIX).routerTag=3.7.0 -LDFLAGS += -X $(PREFIX).controllerTag=3.7.1 +LDFLAGS += -X $(PREFIX).controllerTag=3.7.3 LDFLAGS += -X $(PREFIX).agentTag=3.7.0 -LDFLAGS += -X $(PREFIX).controllerVersion=3.7.1 +LDFLAGS += -X $(PREFIX).controllerVersion=3.7.3 LDFLAGS += -X $(PREFIX).agentVersion=3.7.0 LDFLAGS += -X $(PREFIX).debuggerTag=latest LDFLAGS += -X $(PREFIX).natsTag=2.12.4 LDFLAGS += -X $(PREFIX).repo=ghcr.io/eclipse-iofog GO_SDK_MODULE = iofog-go-sdk/v3@v3.7.0 -OPERATOR_MODULE = iofog-operator/v3@v3.7.1 +OPERATOR_MODULE = iofog-operator/v3@v3.7.2 REPORTS_DIR ?= reports TEST_RESULTS ?= TEST-iofogctl.txt TEST_REPORT ?= TEST-iofogctl.xml diff --git a/README.md b/README.md index 3698c109..fa7975e3 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,11 @@ Current options include: -Welcome to the cool new iofogctl Cli! +Iofogctl is the CLI for ioFog. Think of it as a mix between terraform and kubectl. Use `iofogctl version` to display the current version. - + + Usage: iofogctl [flags] iofogctl [command] @@ -82,6 +83,7 @@ Available Commands: legacy Execute commands using legacy CLI logs Get log contents of deployed resource move Move an existing resources inside the current Namespace + nats Manage NATS resources prune prune ioFog resources rebuild Rebuilds a microservice or system-microservice rename Rename the iofog resources that are currently deployed @@ -93,7 +95,6 @@ Available Commands: view Open ECN Viewer Flags: - --detached Use/Show detached resources --debug Toggle for displaying verbose output of API clients (HTTP and SSH) -h, --help help for iofogctl -n, --namespace string Namespace to execute respective command within (default "default") diff --git a/assets/agent/install_iofog.sh b/assets/agent/install_iofog.sh index d01c92b8..b38847fc 100755 --- a/assets/agent/install_iofog.sh +++ b/assets/agent/install_iofog.sh @@ -18,7 +18,29 @@ do_stop_iofog() { fi } - +do_set_iofog_repo() { + echo "# Setting up Eclipse ioFog repository for $lsb_dist..." + + case "$lsb_dist" in + fedora|centos|rhel|ol|sles|opensuse*) + # RPM-based distros + $sh_c "cd /etc/yum.repos.d && curl -s https://iofog.datasance.com/iofog.repo -LO" + if [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "ol" ]; then + $sh_c "yum update -y" + else + $sh_c "zypper refresh" + fi + ;; + debian|ubuntu|raspbian|*) + # DEB-based distros + $sh_c "apt update -qy" + $sh_c "apt install -qy debian-archive-keyring apt-transport-https" + $sh_c "wget -qO- https://iofog.datasance.com/iofog.gpg | tee /etc/apt/trusted.gpg.d/iofog.gpg >/dev/null" + $sh_c "echo 'deb [arch=all signed-by=/etc/apt/trusted.gpg.d/iofog.gpg] https://iofog.datasance.com/deb stable main' | tee /etc/apt/sources.list.d/iofog.list >/dev/null" + $sh_c "apt update -qy" + ;; + esac +} do_install_iofog() { AGENT_CONFIG_FOLDER=/etc/iofog-agent @@ -98,5 +120,9 @@ fi do_check_install do_stop_iofog +# Set up Datasance repository and WASM only on package-managed OSes +if [ "$PACKAGE_TYPE" = "deb" ] || [ "$PACKAGE_TYPE" = "rpm" ]; then + do_set_iofog_repo +fi do_install_iofog do_start_iofog \ No newline at end of file diff --git a/go.mod b/go.mod index e134bac0..dd70b48d 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,8 @@ require ( github.com/containers/image/v5 v5.32.1 github.com/docker/docker v27.4.1+incompatible github.com/docker/go-connections v0.5.0 - github.com/eclipse-iofog/iofog-go-sdk/v3 v3.7.0-beta.0 - github.com/eclipse-iofog/iofog-operator/v3 v3.7.1-beta.1 + github.com/eclipse-iofog/iofog-go-sdk/v3 v3.7.0 + github.com/eclipse-iofog/iofog-operator/v3 v3.7.2 github.com/gorilla/websocket v1.5.3 github.com/mitchellh/go-homedir v1.1.0 github.com/opencontainers/go-digest v1.0.0 diff --git a/go.sum b/go.sum index 8801b7c4..13e1ab77 100644 --- a/go.sum +++ b/go.sum @@ -78,10 +78,10 @@ github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQ github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/eclipse-iofog/iofog-go-sdk/v3 v3.7.0-beta.0 h1:wjzFAC/XeqCnlJNT6T+5wQRcevUed46eiPChQxsKnHI= -github.com/eclipse-iofog/iofog-go-sdk/v3 v3.7.0-beta.0/go.mod h1:QMKVbhVHxFNCVTDgfg/bMsi8ZFxG1/yZgpn1RymlSQc= -github.com/eclipse-iofog/iofog-operator/v3 v3.7.1-beta.1 h1:h6JuTQY6D9kp1JxamE9I7eCRYkhrzqqwE865yfLhxEU= -github.com/eclipse-iofog/iofog-operator/v3 v3.7.1-beta.1/go.mod h1:r5Jp1ToVbxH1jTz7yHi9yUmdQGSzaUuF3+UR0/x9RmY= +github.com/eclipse-iofog/iofog-go-sdk/v3 v3.7.0 h1:uxShVC0dxiDVAphCn6cNlV5m1T+ZV6aMOMVjHsPhuwE= +github.com/eclipse-iofog/iofog-go-sdk/v3 v3.7.0/go.mod h1:QMKVbhVHxFNCVTDgfg/bMsi8ZFxG1/yZgpn1RymlSQc= +github.com/eclipse-iofog/iofog-operator/v3 v3.7.2 h1:zIL8xM4X1wrbbPnzu/mrJ0Q5l2xN9PCjqYVo/J+xIFo= +github.com/eclipse-iofog/iofog-operator/v3 v3.7.2/go.mod h1:9XGWMGrjCiBoSA772L1bDvjPmBX2W5j4aJI303t1NPc= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= diff --git a/pkg/util/rice-box.go b/pkg/util/rice-box.go index 32088f31..404b741d 100644 --- a/pkg/util/rice-box.go +++ b/pkg/util/rice-box.go @@ -24,7 +24,7 @@ func init() { } file5 := &embedded.EmbeddedFile{ Filename: "agent/install_container_engine.sh", - FileModTime: time.Unix(1775031421, 0), + FileModTime: time.Unix(1776372893, 0), Content: string("#!/bin/sh\n# Script to install Docker/Podman based on Linux distribution\n# Sources init.sh for distribution detection\n\nset -x\nset -e\n\nCONTAINER_ENGINE_MSG=\"This operating system does not support automatic container engine installation. Please install Docker 25+ or Podman 4+ on the target host and re-run, or use an airgap deployment with a pre-installed engine.\"\n\n# Check Docker version (need >= 25). Sets docker_version_num for comparison.\ncheck_docker_version() {\n docker_version_num=0\n if command -v docker >/dev/null 2>&1; then\n raw=$(docker -v 2>/dev/null | sed 's/.*version \\([^,]*\\),.*/\\1/' | tr -d '.')\n [ -n \"$raw\" ] && docker_version_num=\"$raw\"\n fi\n [ \"$docker_version_num\" -ge 2500 ] 2>/dev/null || return 1\n}\n\n# Check Podman version (need >= 4). Sets podman_version_num for comparison.\ncheck_podman_version() {\n podman_version_num=0\n if command -v podman >/dev/null 2>&1; then\n raw=$(podman --version 2>/dev/null | sed -n 's/.*version \\([0-9][0-9]*\\).*/\\1/p')\n [ -n \"$raw\" ] && podman_version_num=\"$raw\"\n fi\n [ \"$podman_version_num\" -ge 4 ] 2>/dev/null || return 1\n}\n\n# Start Docker daemon (init-aware)\nstart_docker() {\n set +e\n if $sh_c \"docker ps\" >/dev/null 2>&1; then\n set -e\n return 0\n fi\n err_code=1\n case \"${INIT_SYSTEM:-unknown}\" in\n systemd)\n $sh_c \"systemctl start docker\" >/dev/null 2>&1\n err_code=$?\n ;;\n sysvinit)\n $sh_c \"service docker start\" >/dev/null 2>&1 || $sh_c \"/etc/init.d/docker start\" >/dev/null 2>&1\n err_code=$?\n ;;\n openrc)\n $sh_c \"rc-service docker start\" >/dev/null 2>&1\n err_code=$?\n ;;\n *)\n $sh_c \"/etc/init.d/docker start\" >/dev/null 2>&1\n err_code=$?\n [ $err_code -ne 0 ] && $sh_c \"systemctl start docker\" >/dev/null 2>&1 && err_code=0\n [ $err_code -ne 0 ] && $sh_c \"service docker start\" >/dev/null 2>&1 && err_code=0\n [ $err_code -ne 0 ] && $sh_c \"snap start docker\" >/dev/null 2>&1 && err_code=0\n ;;\n esac\n set -e\n if [ $err_code -ne 0 ]; then\n echo \"Could not start Docker daemon\"\n exit 1\n fi\n}\n\n# Start Podman (init-aware)\nstart_podman() {\n set +e\n case \"${INIT_SYSTEM:-unknown}\" in\n systemd)\n $sh_c \"systemctl start podman\" >/dev/null 2>&1\n $sh_c \"systemctl start podman.socket\" >/dev/null 2>&1\n ;;\n sysvinit)\n $sh_c \"service podman start\" >/dev/null 2>&1 || $sh_c \"/etc/init.d/podman start\" >/dev/null 2>&1\n ;;\n openrc)\n $sh_c \"rc-service podman start\" >/dev/null 2>&1\n ;;\n *)\n $sh_c \"systemctl start podman\" >/dev/null 2>&1 || true\n $sh_c \"systemctl start podman.socket\" >/dev/null 2>&1 || true\n $sh_c \"service podman start\" >/dev/null 2>&1 || true\n ;;\n esac\n set -e\n}\n\n\ndo_modify_daemon() {\n # Skip for Podman installations\n if [ \"$USE_PODMAN\" = \"true\" ]; then\n echo \"# Configuring Podman for CDI directory support...\"\n\n # Create CDI directories\n $sh_c \"mkdir -p /etc/cdi /var/run/cdi\"\n\n # Ensure /etc/containers exists\n $sh_c \"mkdir -p /etc/containers\"\n\n # Create containers.conf if it doesn't exist\n if [ ! -f \"/etc/containers/containers.conf\" ]; then\n $sh_c 'cat > /etc/containers/containers.conf <> /etc/containers/containers.conf'\n fi\n fi\n\n # Enable and start Podman (init-aware)\n case \"${INIT_SYSTEM:-unknown}\" in\n systemd)\n $sh_c \"systemctl enable podman\" 2>/dev/null || true\n $sh_c \"systemctl enable podman.socket\" 2>/dev/null || true\n ;;\n openrc)\n $sh_c \"rc-update add podman default\" 2>/dev/null || true\n ;;\n sysvinit)\n $sh_c \"update-rc.d podman defaults\" 2>/dev/null || $sh_c \"chkconfig podman on\" 2>/dev/null || true\n ;;\n *) ;;\n esac\n start_podman\n return\n fi\n \n # Original Docker daemon configuration\n if [ ! -f /etc/docker/daemon.json ]; then\n echo \"Creating /etc/docker/daemon.json...\"\n $sh_c \"mkdir -p /etc/docker\"\n $sh_c 'cat > /etc/docker/daemon.json << EOF\n{\n\t\"storage-driver\": \"overlayfs\",\n \"features\": {\n \"containerd-snapshotter\": true,\n \"cdi\": true\n },\n \"cdi-spec-dirs\": [\"/etc/cdi/\", \"/var/run/cdi\"]\n}\nEOF'\n else\n echo \"/etc/docker/daemon.json already exists\"\n fi\n echo \"Restarting Docker daemon...\"\n case \"${INIT_SYSTEM:-unknown}\" in\n systemd)\n $sh_c \"systemctl daemon-reload\"\n $sh_c \"systemctl restart docker\"\n ;;\n *)\n $sh_c \"systemctl daemon-reload\" 2>/dev/null || true\n $sh_c \"systemctl restart docker\" 2>/dev/null || start_docker\n ;;\n esac\n}\n\ndo_install_container_engine() {\n # PACKAGE_TYPE other: only check engine presence/version, do not install\n if [ \"$PACKAGE_TYPE\" = \"other\" ]; then\n if check_docker_version; then\n USE_PODMAN=\"false\"\n echo \"# Docker (>= 25) found; using Docker.\"\n start_docker\n do_modify_daemon\n return 0\n fi\n if check_podman_version; then\n USE_PODMAN=\"true\"\n echo \"# Podman (>= 4) found; using Podman.\"\n do_modify_daemon\n return 0\n fi\n echo \"Error: $CONTAINER_ENGINE_MSG\"\n exit 1\n fi\n\n if [ \"$USE_PODMAN\" = \"true\" ]; then\n echo \"# Installing Podman and related packages...\"\n case \"$lsb_dist\" in\n fedora|centos|rhel|ol)\n $sh_c \"yum install -y podman crun podman-docker\"\n ;;\n sles|opensuse*)\n $sh_c \"zypper install -y podman crun podman-docker\"\n ;;\n esac\n if ! check_podman_version; then\n echo \"Error: Podman 4+ is required. Please upgrade Podman.\"\n exit 1\n fi\n do_modify_daemon\n return\n fi\n\n # Docker: check existing version first\n if command_exists docker; then\n docker_version=$(docker -v 2>/dev/null | sed 's/.*version \\([^,]*\\),.*/\\1/' | tr -d '.')\n if [ -n \"$docker_version\" ] && [ \"$docker_version\" -ge 2500 ] 2>/dev/null; then\n echo \"# Docker already installed (>= 25)\"\n start_docker\n do_modify_daemon\n return\n fi\n fi\n\n echo \"# Installing Docker...\"\n case \"$lsb_dist\" in\n debian|ubuntu|raspbian)\n case \"$dist_version\" in\n \"stretch\")\n $sh_c \"apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common\"\n curl -fsSL https://download.docker.com/linux/debian/gpg | $sh_c \"apt-key add -\"\n $sh_c \"add-apt-repository \\\"deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable\\\"\"\n $sh_c \"apt update -y\"\n $sh_c \"apt install -y docker-ce\"\n ;;\n *)\n curl -fsSL https://get.docker.com/ | $sh_c \"sh\"\n ;;\n esac\n ;;\n *)\n curl -fsSL https://get.docker.com/ | $sh_c \"sh\"\n ;;\n esac\n\n if ! command_exists docker; then\n echo \"Failed to install Docker\"\n exit 1\n fi\n if ! check_docker_version; then\n echo \"Error: Docker 25+ is required. Please upgrade Docker.\"\n exit 1\n fi\n start_docker\n do_modify_daemon\n}\n\n# Check if we should use Podman based on distribution\ndetermine_container_engine() {\n USE_PODMAN=\"false\"\n case \"$lsb_dist\" in\n fedora|centos|rhel|ol|sles|opensuse*)\n USE_PODMAN=\"true\"\n echo \"# Using Podman for $lsb_dist\"\n ;;\n *)\n echo \"# Using Docker for $lsb_dist\"\n ;;\n esac\n}\n\n# Source init.sh to get distribution info\n. /etc/iofog/agent/init.sh\ninit\n\n# Configure container engine based on distribution\ndetermine_container_engine\n\n# Install appropriate container engine\ndo_install_container_engine\n\necho \"# Installation completed successfully\""), } @@ -36,9 +36,9 @@ func init() { } file7 := &embedded.EmbeddedFile{ Filename: "agent/install_iofog.sh", - FileModTime: time.Unix(1774969763, 0), + FileModTime: time.Unix(1776372997, 0), - Content: string("#!/bin/sh\nset -x\nset -e\n\ndo_check_install() {\n\tif command_exists iofog-agent; then\n\t\tlocal VERSION=$(sudo iofog-agent version | head -n1 | sed \"s/ioFog//g\" | tr -d ' ' | tr -d \"\\n\")\n\t\tif [ \"$VERSION\" = \"$agent_version\" ]; then\n\t\t\techo \"Agent $VERSION already installed.\"\n\t\t\texit 0\n\t\tfi\n\tfi\n}\n\ndo_stop_iofog() {\n\tif command_exists iofog-agent; then\n\t\tsudo systemctl stop iofog-agent\n\tfi\n}\n\n\n\ndo_install_iofog() {\n\tAGENT_CONFIG_FOLDER=/etc/iofog-agent\n\tSAVED_AGENT_CONFIG_FOLDER=/tmp/agent-config-save\n\techo \"# Installing ioFog agent...\"\n\n\t# Save iofog-agent config\n\tif [ -d ${AGENT_CONFIG_FOLDER} ]; then\n\t\tsudo rm -rf ${SAVED_AGENT_CONFIG_FOLDER}\n\t\tsudo mkdir -p ${SAVED_AGENT_CONFIG_FOLDER}\n\t\tsudo cp -r ${AGENT_CONFIG_FOLDER}/* ${SAVED_AGENT_CONFIG_FOLDER}/\n\tfi\n\n\techo $lsb_dist\n\tcase \"$lsb_dist\" in\n\t\tfedora|rhel|ol|centos)\n\t\t\t$sh_c \"yum update -y\"\n\t\t\t$sh_c \"yum install -y iofog-agent-$agent_version-1.noarch\"\n\t\t\t;;\n\t\tsles|opensuse)\n\t\t\t$sh_c \"zypper refresh\"\n\t\t\t$sh_c \"zypper install -y iofog-agent=$agent_version\"\n\t\t\t;;\n\t\t*)\n\t\t\t$sh_c \"apt update -qy\"\n\t\t\t$sh_c \"apt install --allow-downgrades iofog-agent=$agent_version -qy\"\n\t\t\t;;\n\tesac\n\n\t# Restore iofog-agent config\n\tif [ -d ${SAVED_AGENT_CONFIG_FOLDER} ]; then\n\t\tsudo mv ${SAVED_AGENT_CONFIG_FOLDER}/* ${AGENT_CONFIG_FOLDER}/\n\t\tsudo rmdir ${SAVED_AGENT_CONFIG_FOLDER}\n\tfi\n\tsudo chmod 775 ${AGENT_CONFIG_FOLDER}\n}\n\ndo_start_iofog(){\n\n\tsudo systemctl start iofog-agent > /dev/null 2&>1 &\n\tlocal STATUS=\"\"\n\tlocal ITER=0\n\twhile [ \"$STATUS\" != \"RUNNING\" ] ; do\n ITER=$((ITER+1))\n if [ \"$ITER\" -gt 600 ]; then\n echo 'Timed out waiting for Agent to be RUNNING'\n exit 1;\n fi\n sleep 1\n STATUS=$(sudo iofog-agent status | cut -f2 -d: | head -n 1 | tr -d '[:space:]')\n echo \"${STATUS}\"\n\tdone\n\tsudo iofog-agent \"config -cf 10 -sf 10\"\n\tif [ \"$lsb_dist\" = \"rhel\" ] || [ \"$lsb_dist\" = \"centos\" ] || [ \"$lsb_dist\" = \"fedora\" ] || [ \"$lsb_dist\" = \"ol\" ] || [ \"$lsb_dist\" = \"sles\" ] || [ \"$lsb_dist\" = \"opensuse\" ]; then\n sudo iofog-agent \"config -c unix:///var/run/podman/podman.sock\"\n fi \n}\n\nagent_version=\"$1\"\necho \"Using variables\"\necho \"version: $agent_version\"\n\n. /etc/iofog/agent/init.sh\ninit\n\n# Native agent is supported only on package-managed OSes (deb/rpm) with systemd\nif [ \"$PACKAGE_TYPE\" != \"deb\" ] && [ \"$PACKAGE_TYPE\" != \"rpm\" ]; then\n\techo \"Error: This operating system is not supported for native agent installation.\"\n\techo \"Please deploy the agent as a container (container agent) on this host.\"\n\texit 1\nfi\nif [ \"$INIT_SYSTEM\" != \"systemd\" ]; then\n\techo \"Error: Native agent is supported only on systemd. This system uses $INIT_SYSTEM.\"\n\techo \"Please deploy the agent as a container (container agent) on this host.\"\n\texit 1\nfi\n\ndo_check_install\ndo_stop_iofog\ndo_install_iofog\ndo_start_iofog"), + Content: string("#!/bin/sh\nset -x\nset -e\n\ndo_check_install() {\n\tif command_exists iofog-agent; then\n\t\tlocal VERSION=$(sudo iofog-agent version | head -n1 | sed \"s/ioFog//g\" | tr -d ' ' | tr -d \"\\n\")\n\t\tif [ \"$VERSION\" = \"$agent_version\" ]; then\n\t\t\techo \"Agent $VERSION already installed.\"\n\t\t\texit 0\n\t\tfi\n\tfi\n}\n\ndo_stop_iofog() {\n\tif command_exists iofog-agent; then\n\t\tsudo systemctl stop iofog-agent\n\tfi\n}\n\ndo_set_iofog_repo() {\n echo \"# Setting up Eclipse ioFog repository for $lsb_dist...\"\n \n case \"$lsb_dist\" in\n fedora|centos|rhel|ol|sles|opensuse*)\n # RPM-based distros\n $sh_c \"cd /etc/yum.repos.d && curl -s https://iofog.datasance.com/iofog.repo -LO\"\n if [ \"$lsb_dist\" = \"fedora\" ] || [ \"$lsb_dist\" = \"centos\" ] || [ \"$lsb_dist\" = \"rhel\" ] || [ \"$lsb_dist\" = \"ol\" ]; then\n $sh_c \"yum update -y\"\n else\n $sh_c \"zypper refresh\"\n fi\n ;;\n debian|ubuntu|raspbian|*)\n # DEB-based distros\n $sh_c \"apt update -qy\"\n $sh_c \"apt install -qy debian-archive-keyring apt-transport-https\"\n $sh_c \"wget -qO- https://iofog.datasance.com/iofog.gpg | tee /etc/apt/trusted.gpg.d/iofog.gpg >/dev/null\"\n $sh_c \"echo 'deb [arch=all signed-by=/etc/apt/trusted.gpg.d/iofog.gpg] https://iofog.datasance.com/deb stable main' | tee /etc/apt/sources.list.d/iofog.list >/dev/null\"\n $sh_c \"apt update -qy\"\n ;;\n esac\n}\n\ndo_install_iofog() {\n\tAGENT_CONFIG_FOLDER=/etc/iofog-agent\n\tSAVED_AGENT_CONFIG_FOLDER=/tmp/agent-config-save\n\techo \"# Installing ioFog agent...\"\n\n\t# Save iofog-agent config\n\tif [ -d ${AGENT_CONFIG_FOLDER} ]; then\n\t\tsudo rm -rf ${SAVED_AGENT_CONFIG_FOLDER}\n\t\tsudo mkdir -p ${SAVED_AGENT_CONFIG_FOLDER}\n\t\tsudo cp -r ${AGENT_CONFIG_FOLDER}/* ${SAVED_AGENT_CONFIG_FOLDER}/\n\tfi\n\n\techo $lsb_dist\n\tcase \"$lsb_dist\" in\n\t\tfedora|rhel|ol|centos)\n\t\t\t$sh_c \"yum update -y\"\n\t\t\t$sh_c \"yum install -y iofog-agent-$agent_version-1.noarch\"\n\t\t\t;;\n\t\tsles|opensuse)\n\t\t\t$sh_c \"zypper refresh\"\n\t\t\t$sh_c \"zypper install -y iofog-agent=$agent_version\"\n\t\t\t;;\n\t\t*)\n\t\t\t$sh_c \"apt update -qy\"\n\t\t\t$sh_c \"apt install --allow-downgrades iofog-agent=$agent_version -qy\"\n\t\t\t;;\n\tesac\n\n\t# Restore iofog-agent config\n\tif [ -d ${SAVED_AGENT_CONFIG_FOLDER} ]; then\n\t\tsudo mv ${SAVED_AGENT_CONFIG_FOLDER}/* ${AGENT_CONFIG_FOLDER}/\n\t\tsudo rmdir ${SAVED_AGENT_CONFIG_FOLDER}\n\tfi\n\tsudo chmod 775 ${AGENT_CONFIG_FOLDER}\n}\n\ndo_start_iofog(){\n\n\tsudo systemctl start iofog-agent > /dev/null 2&>1 &\n\tlocal STATUS=\"\"\n\tlocal ITER=0\n\twhile [ \"$STATUS\" != \"RUNNING\" ] ; do\n ITER=$((ITER+1))\n if [ \"$ITER\" -gt 600 ]; then\n echo 'Timed out waiting for Agent to be RUNNING'\n exit 1;\n fi\n sleep 1\n STATUS=$(sudo iofog-agent status | cut -f2 -d: | head -n 1 | tr -d '[:space:]')\n echo \"${STATUS}\"\n\tdone\n\tsudo iofog-agent \"config -cf 10 -sf 10\"\n\tif [ \"$lsb_dist\" = \"rhel\" ] || [ \"$lsb_dist\" = \"centos\" ] || [ \"$lsb_dist\" = \"fedora\" ] || [ \"$lsb_dist\" = \"ol\" ] || [ \"$lsb_dist\" = \"sles\" ] || [ \"$lsb_dist\" = \"opensuse\" ]; then\n sudo iofog-agent \"config -c unix:///var/run/podman/podman.sock\"\n fi \n}\n\nagent_version=\"$1\"\necho \"Using variables\"\necho \"version: $agent_version\"\n\n. /etc/iofog/agent/init.sh\ninit\n\n# Native agent is supported only on package-managed OSes (deb/rpm) with systemd\nif [ \"$PACKAGE_TYPE\" != \"deb\" ] && [ \"$PACKAGE_TYPE\" != \"rpm\" ]; then\n\techo \"Error: This operating system is not supported for native agent installation.\"\n\techo \"Please deploy the agent as a container (container agent) on this host.\"\n\texit 1\nfi\nif [ \"$INIT_SYSTEM\" != \"systemd\" ]; then\n\techo \"Error: Native agent is supported only on systemd. This system uses $INIT_SYSTEM.\"\n\techo \"Please deploy the agent as a container (container agent) on this host.\"\n\texit 1\nfi\n\ndo_check_install\ndo_stop_iofog\n# Set up Datasance repository and WASM only on package-managed OSes\nif [ \"$PACKAGE_TYPE\" = \"deb\" ] || [ \"$PACKAGE_TYPE\" = \"rpm\" ]; then\n do_set_iofog_repo\nfi\ndo_install_iofog\ndo_start_iofog"), } file8 := &embedded.EmbeddedFile{ Filename: "agent/install_java.sh",