File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed
src/c#/GeneralUpdate.Bowl Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ # 获取脚本的实际名称
4+ SCRIPT_NAME=$( basename " \$ 0" )
5+
36# 检查是否提供了参数
47if [ " $# " -ne 1 ]; then
5- echo " Usage: install_package.sh <package-file>"
8+ echo " Usage: $SCRIPT_NAME <package-file>"
69 exit 1
710fi
811
@@ -11,19 +14,19 @@ PACKAGE_FILE=\$1
1114# 检查文件类型并安装
1215if [[ " $PACKAGE_FILE " == * .rpm ]]; then
1316 if command -v rpm & > /dev/null; then
14- sudo rpm -ivh " $PACKAGE_FILE "
17+ sudo rpm -ivh " $PACKAGE_FILE " || { echo " Failed to install $PACKAGE_FILE using rpm " ; exit 1 ; }
1518 elif command -v dnf & > /dev/null; then
16- sudo dnf install -y " $PACKAGE_FILE "
19+ sudo dnf install -y " $PACKAGE_FILE " || { echo " Failed to install $PACKAGE_FILE using dnf " ; exit 1 ; }
1720 elif command -v yum & > /dev/null; then
18- sudo yum install -y " $PACKAGE_FILE "
21+ sudo yum install -y " $PACKAGE_FILE " || { echo " Failed to install $PACKAGE_FILE using yum " ; exit 1 ; }
1922 else
2023 echo " RPM package manager not found."
2124 exit 1
2225 fi
2326elif [[ " $PACKAGE_FILE " == * .deb ]]; then
2427 if command -v dpkg & > /dev/null; then
25- sudo dpkg -i " $PACKAGE_FILE "
26- sudo apt-get install -f -y # 修复依赖问题
28+ sudo dpkg -i " $PACKAGE_FILE " || { echo " Failed to install $PACKAGE_FILE using dpkg " ; exit 1 ; }
29+ sudo apt-get install -f -y || { echo " Failed to fix dependencies " ; exit 1 ; }
2730 else
2831 echo " DEB package manager not found."
2932 exit 1
Original file line number Diff line number Diff line change @@ -27,11 +27,13 @@ public override void Launch()
2727
2828 private void Install ( )
2929 {
30- //TODO: 安装路径需要调整
30+ string scriptPath = "./install.sh" ;
31+ string packageFile = GetPacketName ( ) ;
32+
3133 ProcessStartInfo processStartInfo = new ProcessStartInfo ( )
3234 {
3335 FileName = "/bin/bash" ,
34- Arguments = $ "install.sh { GetPacketName ( ) } ",
36+ Arguments = $ "{ scriptPath } { packageFile } ",
3537 RedirectStandardOutput = true ,
3638 RedirectStandardError = true ,
3739 UseShellExecute = false ,
Original file line number Diff line number Diff line change 1- using System . IO ;
2- using System . Runtime . InteropServices ;
1+ using System . Runtime . InteropServices ;
32
43namespace GeneralUpdate . Bowl . Strategys ;
54
You can’t perform that action at this time.
0 commit comments