#!/bin/sh # This file is a template which gets run through the "/kickstart.sh" route to # generate the final script file. PLEASE NEVER RUN THIS FILE DIRECTLY, instead # run me with: # # sh <(curl -Ss "http:///kickstart.sh?tenant_id=") # # Where: # is the ShellHub server address # is your tenant ID # # List of URL parameters of /kickstart.sh URL: # # keepalive_interval = Specifies in seconds the keep alive message interval # preferred_hostname = The preferred hostname to use rather than generated # value from ethernet MAC address while true; do read -p "Do you wana use docker or native agent (D/N)" dn case $dn in [Nn]* ) #Native install Methode mkdir /opt/ShellHub wget {{scheme}}://{{host}}/agent-amd64 -O /opt/ShellHub/agent chmod +x /opt/ShellHub/agent echo "" >>/etc/systemd/system/ShellHubAgent.service echo "[Unit]" >>/etc/systemd/system/ShellHubAgent.service echo "Description=ShellHub Api" >>/etc/systemd/system/ShellHubAgent.service echo "Wants=network-online.target" >>/etc/systemd/system/ShellHubAgent.service echo "[Service]" >>/etc/systemd/system/ShellHubAgent.service echo "Type=simple" >>/etc/systemd/system/ShellHubAgent.service echo "Environment=SHELLHUB_PRIVATE_KEY=/opt/ShellHub/shellhubAgent.key" >>/etc/systemd/system/ShellHubAgent.service echo "Environment=SHELLHUB_TENANT_ID={{tenant_id}}" >>/etc/systemd/system/ShellHubAgent.service echo "Environment=SHELLHUB_SERVER_ADDRESS={{scheme}}://{{host}}" >>/etc/systemd/system/ShellHubAgent.service {% if keepalive_interval ~= '' and keepalive_interval ~= nil then %} echo "Environment=SHELLHUB_KEEPALIVE_INTERVAL={{keepalive_interval}}" >>/etc/systemd/system/ShellHubAgent.service {% end %} {% if preferred_hostname ~= '' and preferred_hostname ~= nil then %} echo "Environment=SHELLHUB_PREFERRED_HOSTNAME={{preferred_hostname}}" >>/etc/systemd/system/ShellHubAgent.service {% end %} echo "ExecStart=/opt/ShellHub/agent" >>/etc/systemd/system/ShellHubAgent.service echo "[Install]" >>/etc/systemd/system/ShellHubAgent.service echo "WantedBy=multi-user.target" >>/etc/systemd/system/ShellHubAgent.service if [ "$(grep -oP '(?<=^PLATFORM_ID=).+' /etc/os-release | tr -d '"')" = "platform:el8" ]; then ##Resetting reseting service permissions restorecon -Rv /etc/systemd/system fi systemctl enable --now ShellHubAgent exit;; [Dd]* ) break;; * ) echo "Please answer D(ocker) or N(ative).";; esac done #Docker install Methode type docker > /dev/null 2>&1 || { echo "Docker is not instaled"; exit 1; } if ! docker info > /dev/null 2>&1; then cat <