aaden-cli 1.6.91 → 1.6.95

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.
@@ -0,0 +1,84 @@
1
+ #!/bin/bash
2
+
3
+ # 此脚本为指定的网卡设置静态 IP
4
+ # IP: 192.168.121.20/24
5
+ # 网关: 192.168.121.1
6
+ # DNS: 192.168.121.1
7
+ # 在 /etc/netplan/ 下新增文件 30-cotti.yaml 并应用配置
8
+ # 需要 root 权限运行(推荐使用 sudo)
9
+
10
+ set -e # 遇到错误立即退出
11
+
12
+ # 查找所有非 lo 的以太网接口
13
+ mapfile -t INTERFACES < <(ip -o link show | awk -F': ' '/state UP|state DOWN/ && $2 !~ /lo/ {print $2}')
14
+
15
+ if [ ${#INTERFACES[@]} -eq 0 ]; then
16
+ echo "错误:未找到任何可用网卡!"
17
+ exit 1
18
+ fi
19
+
20
+ # 优先尝试自动选择以 enp 开头的网卡
21
+ INTERFACE=""
22
+ for iface in "${INTERFACES[@]}"; do
23
+ if [[ $iface == enp* ]]; then
24
+ INTERFACE="$iface"
25
+ break
26
+ fi
27
+ done
28
+
29
+ # 如果没有找到 enp 开头的网卡,或者用户想手动选择,则进入手动选择流程
30
+ if [ -z "$INTERFACE" ]; then
31
+ echo "未找到以 enp 开头的网卡,下面列出所有可用网卡:"
32
+ for i in "${!INTERFACES[@]}"; do
33
+ idx=$((i+1))
34
+ echo "$idx) ${INTERFACES[i]}"
35
+ done
36
+
37
+ if [ ${#INTERFACES[@]} -eq 1 ]; then
38
+ echo "只检测到一个网卡,将自动选择:${INTERFACES[0]}"
39
+ INTERFACE="${INTERFACES[0]}"
40
+ else
41
+ while true; do
42
+ echo -n "请输入要配置的网卡编号(1-${#INTERFACES[@]}):"
43
+ read choice
44
+ if [[ "$choice" =~ ^[0-9]+$ ]] && [ "$choice" -ge 1 ] && [ "$choice" -le ${#INTERFACES[@]} ]; then
45
+ INTERFACE="${INTERFACES[$((choice-1))]}"
46
+ break
47
+ else
48
+ echo "输入无效,请输入有效的编号!"
49
+ fi
50
+ done
51
+ fi
52
+ else
53
+ echo "自动选择网卡:$INTERFACE"
54
+ fi
55
+
56
+ echo "将为网卡 $INTERFACE 配置静态 IP 192.168.121.20/24"
57
+
58
+ CONFIG_FILE="/etc/netplan/30-cotti.yaml"
59
+
60
+ # 使用 cat 和 heredoc 写入 YAML 文件(注意缩进严格要求)
61
+ sudo bash -c "cat > $CONFIG_FILE" << EOF
62
+ network:
63
+ version: 2
64
+ renderer: NetworkManager
65
+ ethernets:
66
+ $INTERFACE:
67
+ dhcp4: false
68
+ addresses:
69
+ - 192.168.121.20/24
70
+ gateway4: 192.168.121.1
71
+ nameservers:
72
+ addresses:
73
+ - 192.168.121.1
74
+ EOF
75
+
76
+ echo "已生成配置文件:$CONFIG_FILE"
77
+ echo "内容如下:"
78
+ sudo cat $CONFIG_FILE
79
+
80
+ # 应用配置
81
+ echo "正在应用配置..."
82
+ sudo netplan apply
83
+
84
+ echo "配置完成!请使用 ip addr show $INTERFACE 检查 IP 是否已生效。"
File without changes
File without changes
File without changes
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.91"};
18510
+ module.exports = {"i8":"1.6.95"};
18511
18511
 
18512
18512
  /***/ })
18513
18513
 
@@ -18630,6 +18630,7 @@ program.command('update-tse').action(updateTse)
18630
18630
  program.command('update-win-tse').action(updateWindowsTse)
18631
18631
  program.command('check-version').action(getBackendVersionOffline)
18632
18632
  program.command('full-update').action(fullUpdate)
18633
+ program.command('cotti-netplan').action(cottiNetplan)
18633
18634
 
18634
18635
  program.command('db').action(enterDatabase)
18635
18636
  program.command('printer-test').action(testPrinter)
@@ -18843,7 +18844,8 @@ async function fullUpdate() {
18843
18844
  'sudo service apache2 restart',
18844
18845
  'aaden-cli fix-cronjob',
18845
18846
  'aaden-cli auto-write-gdpdu',
18846
- 'sudo systemctl daemon-reload'
18847
+ 'sudo systemctl daemon-reload',
18848
+ 'aaden-cli ensure-print-log-rotate',
18847
18849
  ]
18848
18850
  const {code} = await cli.executeInShell(command, program.debug)
18849
18851
  await logAction("进行了full-update", code)
@@ -19335,6 +19337,11 @@ function ensurePrintLogRotate() {
19335
19337
  }
19336
19338
  }
19337
19339
 
19340
+ async function cottiNetplan() {
19341
+ await run('AadenDeploy/Utils/cottiNetplan.sh')
19342
+ logAction("手动设置cotti netplan")
19343
+ }
19344
+
19338
19345
  })();
19339
19346
 
19340
19347
  module.exports = __webpack_exports__;
package/index.js CHANGED
@@ -49,6 +49,7 @@ program.command('update-tse').action(updateTse)
49
49
  program.command('update-win-tse').action(updateWindowsTse)
50
50
  program.command('check-version').action(getBackendVersionOffline)
51
51
  program.command('full-update').action(fullUpdate)
52
+ program.command('cotti-netplan').action(cottiNetplan)
52
53
 
53
54
  program.command('db').action(enterDatabase)
54
55
  program.command('printer-test').action(testPrinter)
@@ -262,7 +263,8 @@ async function fullUpdate() {
262
263
  'sudo service apache2 restart',
263
264
  'aaden-cli fix-cronjob',
264
265
  'aaden-cli auto-write-gdpdu',
265
- 'sudo systemctl daemon-reload'
266
+ 'sudo systemctl daemon-reload',
267
+ 'aaden-cli ensure-print-log-rotate',
266
268
  ]
267
269
  const {code} = await cli.executeInShell(command, program.debug)
268
270
  await logAction("进行了full-update", code)
@@ -753,3 +755,8 @@ function ensurePrintLogRotate() {
753
755
  cli.executeInShell(command, program.debug)
754
756
  }
755
757
  }
758
+
759
+ async function cottiNetplan() {
760
+ await run('AadenDeploy/Utils/cottiNetplan.sh')
761
+ logAction("手动设置cotti netplan")
762
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aaden-cli",
3
- "version": "1.6.91",
3
+ "version": "1.6.95",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -8,11 +8,11 @@
8
8
  "update": "git add . && release-it --ci"
9
9
  },
10
10
  "bin": {
11
- "aaden-cli": "./dist/index.js"
11
+ "aaden-cli": "dist/index.js"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/innerken-gmbh/aaden-cli.git"
15
+ "url": "git+https://github.com/innerken-gmbh/aaden-cli.git"
16
16
  },
17
17
  "keywords": [],
18
18
  "author": "JuHaodong@innerken",