aaden-cli 1.6.83 → 1.6.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,7 @@
1
1
  #!/bin/bash
2
2
 
3
- deviceId=$1
4
- targetVersion=$2
5
- tseAdapterDownloadUrl=$3
6
-
7
- function sendDeviceLog() {
8
- _deviceId=$1
9
- _content=$2
10
- echo "<<< create log: $_content"
11
- curl --location 'https://cloud-v2.aaden.io/deviceLog/createEvent' \
12
- --header 'Content-Type: application/json' \
13
- --data "{
14
- \"deviceId\": \"$_deviceId\",
15
- \"content\": \"$_content\",
16
- \"type\": \"维护状态更新\",
17
- \"appendUrl\": \"\",
18
- \"operator\": \"updateAadenTse.sh\"
19
- }"
20
- return 0
21
- }
3
+ targetVersion=$1
4
+ tseAdapterDownloadUrl=$2
22
5
 
23
6
  # get tse version via php
24
7
  tseVersionCommand=$(cat <<- 'PHP'
@@ -34,7 +17,7 @@ tseVersion=`php -r "$tseVersionCommand"`
34
17
  # exit if no need to update
35
18
  if [ $tseVersion != 'null' ]; then
36
19
  if [ $targetVersion -le $tseVersion ]; then
37
- sendDeviceLog $deviceId "no need to update tse, current version is ($tseVersion)"
20
+ echo "无需更新TSE, 当前版本已是目标版本($tseVersion)"
38
21
  exit 1
39
22
  fi
40
23
  fi
@@ -52,21 +35,24 @@ PHP
52
35
  )
53
36
  os=`php -r "$osCommand"`
54
37
 
55
- sendDeviceLog $deviceId "user os is ($os)"
56
-
57
38
  # download tse adapter
58
39
  wget -O latest-tse-adapter.jar "$tseAdapterDownloadUrl"
59
40
 
60
41
  if [ $os == 'windows' ]; then
61
- sendDeviceLog $deviceId "this is a Windows system, abort"
42
+ echo "当前系统为Windows系统,更新TSE请使用 aaden-cli update-win-tse"
62
43
  exit 1
63
44
  else
64
45
  sudo cp -f latest-tse-adapter.jar /var/www/html/TseHost/tse-0.0.2.jar
65
46
  sudo service aaden-tse restart
66
47
  fi
67
48
 
68
- echo "sleep 15s to wait service restart"
69
- sleep 15s
49
+ echo "正在等待TSE服务重启"
50
+ sleep 5s
51
+ echo "还剩10秒"
52
+ sleep 5s
53
+ echo "还剩5秒"
54
+ sleep 5s
55
+ echo "开始检查新TSE版本"
70
56
 
71
57
  tseVersionCommand2=$(cat <<- 'PHP'
72
58
  $ini = parse_ini_file('/var/www/html/Resource/config/config.ini', true);
@@ -80,9 +66,9 @@ tseVersion2=`php -r "$tseVersionCommand2"`
80
66
 
81
67
  if [ $tseVersion2 != 'null' ]; then
82
68
  if [ $targetVersion -le $tseVersion2 ]; then
83
- sendDeviceLog $deviceId "tse update done, current version is ($tseVersion2)"
69
+ echo "TSE升级完成,当前版本为($tseVersion2)"
84
70
  exit 1
85
71
  fi
86
72
  fi
87
73
 
88
- sendDeviceLog $deviceId "update failed, current version is ($tseVersion2)"
74
+ echo "TSE升级失败,当前版本为($tseVersion2)"
@@ -1,24 +1,7 @@
1
1
  #!/bin/bash
2
2
 
3
- deviceId=$1
4
- targetVersion=$2
5
- tseAdapterDownloadUrl=$3
6
-
7
- function sendDeviceLog() {
8
- _deviceId=$1
9
- _content=$2
10
- echo "<<< create log: $_content"
11
- curl --location 'https://cloud-v2.aaden.io/deviceLog/createEvent' \
12
- --header 'Content-Type: application/json' \
13
- --data "{
14
- \"deviceId\": \"$_deviceId\",
15
- \"content\": \"$_content\",
16
- \"type\": \"维护状态更新\",
17
- \"appendUrl\": \"\",
18
- \"operator\": \"updateAadenTse.sh\"
19
- }"
20
- return 0
21
- }
3
+ targetVersion=$1
4
+ tseAdapterDownloadUrl=$2
22
5
 
23
6
  # get tse version via php
24
7
  tseVersionCommand=$(cat <<- 'PHP'
@@ -34,7 +17,7 @@ tseVersion=`php -r "$tseVersionCommand"`
34
17
  # exit if no need to update
35
18
  if [ $tseVersion != 'null' ]; then
36
19
  if [ $targetVersion -le $tseVersion ]; then
37
- sendDeviceLog $deviceId "no need to update tse, current version is ($tseVersion)"
20
+ echo "无需更新TSE, 当前版本已是目标版本($tseVersion)"
38
21
  exit 1
39
22
  fi
40
23
  fi
@@ -52,8 +35,6 @@ PHP
52
35
  )
53
36
  os=`php -r "$osCommand"`
54
37
 
55
- sendDeviceLog $deviceId "user os is ($os)"
56
-
57
38
  # download tse adapter
58
39
  wget -O latest-tse-adapter.jar "$tseAdapterDownloadUrl"
59
40
 
@@ -81,7 +62,7 @@ PHP
81
62
  tseDir=`php -r "$tseDirSearchCommand"`
82
63
 
83
64
  if [ tseDir == 'null' ]; then
84
- sendDeviceLog $deviceId "no TSE directory, abort"
65
+ echo "未找到TSE文件夹,自动更新失败"
85
66
  exit 1
86
67
  fi
87
68
 
@@ -89,32 +70,14 @@ PHP
89
70
  cp -f latest-tse-adapter.jar "$tseDir/tse-0.0.3.jar"
90
71
 
91
72
  echo "新TSE文件覆盖完成。请客服注意引导老板,接受弹出来的框"
73
+ echo "可以使用此命令检查tse版本:curl --location 'localhost:8014/adapterVersion'"
92
74
 
93
75
  # restart service
94
76
  $tseDir/AadenTseServiceRegister.exe restart
95
77
 
96
78
  else
97
- sendDeviceLog $deviceId "this is a Linux system, abort"
79
+ echo "当前系统为Windows系统,更新TSE请使用 aaden-cli update-tse"
98
80
  exit 1
99
81
  fi
100
82
 
101
- echo "流程结束"
102
-
103
- #tseVersionCommand2=$(cat <<- 'PHP'
104
- #$ini = parse_ini_file('/var/www/html/Resource/config/config.ini', true);
105
- #$tseUrl = $ini['TSE']['TseHost'] ?? 'http://localhost:8014';
106
- #$versionResp = file_get_contents("$tseUrl/adapterVersion");
107
- #$version = json_decode($versionResp, true)['major'] ?? 'null';
108
- #echo $version;
109
- #PHP
110
- #)
111
- #tseVersion2=`php -r "$tseVersionCommand2"`
112
- #
113
- #if [ $tseVersion2 != 'null' ]; then
114
- # if [ $targetVersion -le $tseVersion2 ]; then
115
- # sendDeviceLog $deviceId "tse update done, current version is ($tseVersion2)"
116
- # exit 1
117
- # fi
118
- #fi
119
- #
120
- #sendDeviceLog $deviceId "update failed, current version is ($tseVersion2)"
83
+ echo "自动更新脚本结束"
package/dist/index.js CHANGED
@@ -18507,7 +18507,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
18507
18507
  /***/ ((module) => {
18508
18508
 
18509
18509
  "use strict";
18510
- module.exports = {"i8":"1.6.83"};
18510
+ module.exports = {"i8":"1.6.84"};
18511
18511
 
18512
18512
  /***/ })
18513
18513
 
@@ -19258,10 +19258,9 @@ function updateWindowsTse() {
19258
19258
  const scriptPath = 'AadenDeploy/Utils/updateAadenTseOnWindows.sh'
19259
19259
  const command = getPrivilegeCMD(scriptPath)
19260
19260
 
19261
- const deviceId = getMyDeviceId()
19262
19261
  const targetVersion = 4
19263
19262
  const tseAdapterDownloadUrl = 'https://innerken.com/Download/tse-0.0.4.jar'
19264
- command.push(`./${scriptPath} ${deviceId} ${targetVersion} ${tseAdapterDownloadUrl}`)
19263
+ command.push(`./${scriptPath} ${targetVersion} ${tseAdapterDownloadUrl}`)
19265
19264
 
19266
19265
  cli.executeInShell(command, program.debug)
19267
19266
  }
@@ -19270,10 +19269,9 @@ function updateTse() {
19270
19269
  const scriptPath = 'AadenDeploy/Utils/updateAadenTse.sh'
19271
19270
  const command = getPrivilegeCMD(scriptPath)
19272
19271
 
19273
- const deviceId = getMyDeviceId()
19274
19272
  const targetVersion = 4
19275
19273
  const tseAdapterDownloadUrl = 'https://innerken.com/Download/tse-0.0.4.jar'
19276
- command.push(`./${scriptPath} ${deviceId} ${targetVersion} ${tseAdapterDownloadUrl}`)
19274
+ command.push(`./${scriptPath} ${targetVersion} ${tseAdapterDownloadUrl}`)
19277
19275
 
19278
19276
  cli.executeInShell(command, program.debug)
19279
19277
  }
package/index.js CHANGED
@@ -677,10 +677,9 @@ function updateWindowsTse() {
677
677
  const scriptPath = 'AadenDeploy/Utils/updateAadenTseOnWindows.sh'
678
678
  const command = getPrivilegeCMD(scriptPath)
679
679
 
680
- const deviceId = getMyDeviceId()
681
680
  const targetVersion = 4
682
681
  const tseAdapterDownloadUrl = 'https://innerken.com/Download/tse-0.0.4.jar'
683
- command.push(`./${scriptPath} ${deviceId} ${targetVersion} ${tseAdapterDownloadUrl}`)
682
+ command.push(`./${scriptPath} ${targetVersion} ${tseAdapterDownloadUrl}`)
684
683
 
685
684
  cli.executeInShell(command, program.debug)
686
685
  }
@@ -689,10 +688,9 @@ function updateTse() {
689
688
  const scriptPath = 'AadenDeploy/Utils/updateAadenTse.sh'
690
689
  const command = getPrivilegeCMD(scriptPath)
691
690
 
692
- const deviceId = getMyDeviceId()
693
691
  const targetVersion = 4
694
692
  const tseAdapterDownloadUrl = 'https://innerken.com/Download/tse-0.0.4.jar'
695
- command.push(`./${scriptPath} ${deviceId} ${targetVersion} ${tseAdapterDownloadUrl}`)
693
+ command.push(`./${scriptPath} ${targetVersion} ${tseAdapterDownloadUrl}`)
696
694
 
697
695
  cli.executeInShell(command, program.debug)
698
696
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aaden-cli",
3
- "version": "1.6.83",
3
+ "version": "1.6.84",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {