@@ -13,27 +13,7 @@ export class GuideLinuxAgentComponent implements OnInit {
1313 @Input ( ) serverId : number ;
1414 @Input ( ) version : string ;
1515 token : string ;
16-
17- architectures = [
18- {
19- id : 1 , name : 'Ubuntu 16/18/20+' ,
20- install : this . getCommandUbuntu ( 'utmstack-linux-agent' ) ,
21- uninstall : this . getUninstallCommand ( 'utmstack-linux-agent' ) ,
22- shell : ''
23- } ,
24- {
25- id : 2 , name : 'Centos 7/Red Hat Enterprise Linux' ,
26- install : this . getCommandCentos7RedHat ( 'utmstack-linux-agent' ) ,
27- uninstall : this . getUninstallCommand ( 'utmstack-linux-agent' ) ,
28- shell : ''
29- } ,
30- {
31- id : 3 , name : 'Centos 8/AlmaLinux' ,
32- install : this . getCommandCentos8Almalinux ( 'utmstack-linux-agent' ) ,
33- uninstall : this . getUninstallCommand ( 'utmstack-linux-agent' ) ,
34- shell : ''
35- }
36- ] ;
16+ architectures = [ ] ;
3717
3818 constructor ( private federationConnectionService : FederationConnectionService ) { }
3919
@@ -49,51 +29,72 @@ export class GuideLinuxAgentComponent implements OnInit {
4929 } else {
5030 this . token = '' ;
5131 }
32+ this . loadArchitectures ( ) ;
5233 } ) ;
5334 }
5435
5536 getCommandUbuntu ( installerName : string ) : string {
5637 const ip = window . location . host . includes ( ':' ) ? window . location . host . split ( ':' ) [ 0 ] : window . location . host ;
5738
5839 return `sudo bash -c "apt update -y && apt install wget -y && mkdir -p /opt/utmstack-linux-agent && \
59- wget --no-check-certificate --header='connection-key: ${ this . token } ' -P /opt/utmstack-linux-agent \
40+ wget --no-check-certificate --header='connection-key: <secret> ${ this . token } </secret> ' -P /opt/utmstack-linux-agent \
6041 https://${ ip } :9001/private/dependencies/agent/${ installerName } && \
6142 chmod -R 777 /opt/utmstack-linux-agent/${ installerName } && \
62- /opt/utmstack-linux-agent/${ installerName } install ${ ip } ${ this . token } yes"` ;
43+ /opt/utmstack-linux-agent/${ installerName } install ${ ip } <secret> ${ this . token } </secret> yes"` ;
6344 }
6445
6546 getCommandCentos7RedHat ( installerName : string ) : string {
6647 const ip = window . location . host . includes ( ':' ) ? window . location . host . split ( ':' ) [ 0 ] : window . location . host ;
6748
6849 return `sudo bash -c "yum install wget -y && mkdir -p /opt/utmstack-linux-agent && \
69- wget --no-check-certificate --header='connection-key: ${ this . token } ' -P /opt/utmstack-linux-agent \
50+ wget --no-check-certificate --header='connection-key: <secret> ${ this . token } </secret> ' -P /opt/utmstack-linux-agent \
7051 https://${ ip } :9001/private/dependencies/agent/${ installerName } && \
7152 chmod -R 777 /opt/utmstack-linux-agent/${ installerName } && \
72- /opt/utmstack-linux-agent/${ installerName } install ${ ip } ${ this . token } yes"` ;
53+ /opt/utmstack-linux-agent/${ installerName } install ${ ip } <secret> ${ this . token } </secret> yes"` ;
7354 }
7455
7556 getCommandCentos8Almalinux ( installerName : string ) : string {
7657 const ip = window . location . host . includes ( ':' ) ? window . location . host . split ( ':' ) [ 0 ] : window . location . host ;
7758
7859 return `sudo bash -c "dnf install wget -y && mkdir -p /opt/utmstack-linux-agent && \
79- wget --no-check-certificate --header='connection-key: ${ this . token } ' -P /opt/utmstack-linux-agent \
60+ wget --no-check-certificate --header='connection-key: <secret> ${ this . token } </secret> ' -P /opt/utmstack-linux-agent \
8061 https://${ ip } :9001/private/dependencies/agent/${ installerName } && \
8162 chmod -R 777 /opt/utmstack-linux-agent/${ installerName } && \
82- /opt/utmstack-linux-agent/${ installerName } install ${ ip } ${ this . token } yes"` ;
63+ /opt/utmstack-linux-agent/${ installerName } install ${ ip } <secret> ${ this . token } </secret> yes"` ;
8364 }
8465
8566 getUninstallCommand ( installerName : string ) : string {
8667 return `sudo bash -c "/opt/utmstack-linux-agent/${ installerName } uninstall || true; \
87- systemctl stop UTMStackAgent 2>/dev/null || true; systemctl disable UTMStackAgent 2>/dev/null || true; \
88- rm /etc/systemd/system/UTMStackAgent.service 2>/dev/null || true; systemctl stop UTMStackRedline 2>/dev/null || true; \
89- systemctl disable UTMStackRedline 2>/dev/null || true; rm /etc/systemd/system/UTMStackRedline.service 2>/dev/null || true; \
90- systemctl stop UTMStackUpdater 2>/dev/null || true; systemctl disable UTMStackUpdater 2>/dev/null || true; \
91- rm /etc/systemd/system/UTMStackUpdater.service 2>/dev/null || true; systemctl stop UTMStackModulesLogsCollector 2>/dev/null || true; \
92- systemctl disable UTMStackModulesLogsCollector 2>/dev/null || true; \
93- rm /etc/systemd/system/UTMStackModulesLogsCollector.service 2>/dev/null || true; \
94- systemctl daemon-reload 2>/dev/null || true; \
95- echo 'Removing UTMStack Agent dependencies...' && sleep 10 && rm -rf /opt/utmstack-linux-agent && \
96- echo 'UTMStack Agent dependencies removed successfully.'"` ;
68+ systemctl stop UTMStackAgent 2>/dev/null || true; systemctl disable UTMStackAgent 2>/dev/null || true; \
69+ rm -f /etc/systemd/system/UTMStackAgent.service 2>/dev/null || true; \
70+ systemctl stop UTMStackModulesLogsCollector 2>/dev/null || true; \
71+ systemctl disable UTMStackModulesLogsCollector 2>/dev/null || true; \
72+ rm -f /etc/systemd/system/UTMStackModulesLogsCollector.service 2>/dev/null || true; \
73+ systemctl daemon-reload 2>/dev/null || true; \
74+ echo 'Removing UTMStack Agent dependencies...' && sleep 10 && rm -rf /opt/utmstack-linux-agent 2>/dev/null || true; \
75+ echo 'UTMStack Agent dependencies removed successfully.'"` ;
9776 }
9877
78+ private loadArchitectures ( ) {
79+ this . architectures = [
80+ {
81+ id : 1 , name : 'Ubuntu 16/18/20+' ,
82+ install : this . getCommandUbuntu ( 'utmstack_agent_service' ) ,
83+ uninstall : this . getUninstallCommand ( 'utmstack_agent_service' ) ,
84+ shell : ''
85+ } ,
86+ {
87+ id : 2 , name : 'Centos 7/Red Hat Enterprise Linux' ,
88+ install : this . getCommandCentos7RedHat ( 'utmstack_agent_service' ) ,
89+ uninstall : this . getUninstallCommand ( 'utmstack_agent_service' ) ,
90+ shell : ''
91+ } ,
92+ {
93+ id : 3 , name : 'Centos 8/AlmaLinux' ,
94+ install : this . getCommandCentos8Almalinux ( 'utmstack_agent_service' ) ,
95+ uninstall : this . getUninstallCommand ( 'utmstack_agent_service' ) ,
96+ shell : ''
97+ }
98+ ] ;
99+ }
99100}
0 commit comments