added portable install option for native

This commit is contained in:
2021-01-19 00:24:57 +00:00
parent 0731aa93cb
commit 37341c087b

View File

@@ -18,15 +18,35 @@
while true; do while true; do
read -p "Do you wana use docker or native agent (D/N)" dn read -p "Do you want to use docker or native agent (D/N)" dn
case $dn in case $dn in
[Nn]* ) [Nn]* )
#Native install Methode #Native install Methode
mkdir /opt/ShellHub mkdir /opt/ShellHub
wget {{scheme}}://{{host}}/agent-amd64 -O /opt/ShellHub/agent wget {{scheme}}://{{host}}/agent-amd64 -O /opt/ShellHub/agent
chmod +x /opt/ShellHub/agent chmod +x /opt/ShellHub/agent
echo "systemctl stop ShellHubAgent; mv /opt/ShellHub/agent /opt/ShellHub/agent.bck; wget {{scheme}}://{{host}}/agent-amd64 -O /opt/ShellHub/agent; systemctl stop ShellHubAgent" > /opt/ShellHub/UpdateAgent.sh
while true; do
read -p "Do you want to use portable or Service install (P/S)" dn
case $dn in
[Pp]* )
echo "export SHELLHUB_PRIVATE_KEY=/opt/ShellHub/shellhubAgent.key" >>/opt/ShellHub/RunAgent.sh
echo "export SHELLHUB_TENANT_ID={{tenant_id}}" >>/opt/ShellHub/RunAgent.sh
echo "export SHELLHUB_SERVER_ADDRESS={{scheme}}://{{host}}" >>/opt/ShellHub/RunAgent.sh
{% if keepalive_interval ~= '' and keepalive_interval ~= nil then %}
echo "export SHELLHUB_KEEPALIVE_INTERVAL={{keepalive_interval}}" >>/opt/ShellHub/RunAgent.sh
{% end %}
{% if preferred_hostname ~= '' and preferred_hostname ~= nil then %}
echo "export SHELLHUB_PREFERRED_HOSTNAME={{preferred_hostname}}" >>/opt/ShellHub/RunAgent.sh
{% end %}
echo "/opt/ShellHub/agent" >>/opt/ShellHub/RunAgent.sh
exit;;
[Ss]* )
break;;
echo "" >>/etc/systemd/system/ShellHubAgent.service * ) echo "Please answer D(ocker) or N(ative).";;
esac
done
echo "[Unit]" >>/etc/systemd/system/ShellHubAgent.service echo "[Unit]" >>/etc/systemd/system/ShellHubAgent.service
echo "Description=ShellHub Api" >>/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 "Wants=network-online.target" >>/etc/systemd/system/ShellHubAgent.service
@@ -35,13 +55,11 @@ while true; do
echo "Environment=SHELLHUB_PRIVATE_KEY=/opt/ShellHub/shellhubAgent.key" >>/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_TENANT_ID={{tenant_id}}" >>/etc/systemd/system/ShellHubAgent.service
echo "Environment=SHELLHUB_SERVER_ADDRESS={{scheme}}://{{host}}" >>/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 %} {% if keepalive_interval ~= '' and keepalive_interval ~= nil then %}
echo "Environment=SHELLHUB_KEEPALIVE_INTERVAL={{keepalive_interval}}" >>/etc/systemd/system/ShellHubAgent.service echo "Environment=SHELLHUB_KEEPALIVE_INTERVAL={{keepalive_interval}}" >>/etc/systemd/system/ShellHubAgent.service
{% end %} {% end %}
{% if preferred_hostname ~= '' and preferred_hostname ~= nil then %} {% if preferred_hostname ~= '' and preferred_hostname ~= nil then %}
echo "Environment=SHELLHUB_PREFERRED_HOSTNAME={{preferred_hostname}}" >>/etc/systemd/system/ShellHubAgent.service echo "Environment=SHELLHUB_PREFERRED_HOSTNAME={{preferred_hostname}}" >>/etc/systemd/system/ShellHubAgent.service
{% end %} {% end %}
echo "ExecStart=/opt/ShellHub/agent" >>/etc/systemd/system/ShellHubAgent.service echo "ExecStart=/opt/ShellHub/agent" >>/etc/systemd/system/ShellHubAgent.service