summaryrefslogtreecommitdiff
path: root/xmake/scripts
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-06-05 14:18:10 +0800
committerOpportunityLiu <[email protected]>2019-06-06 14:37:22 +0800
commite9b11611ea2c2c2c892938deee37797a5d10d296 (patch)
tree1fd47b9747bf6db535ed817636ba6bf1481037d1 /xmake/scripts
parent12671e1c0af4e86d1ee73ccd13ff35defde7dc4b (diff)
install script
Diffstat (limited to 'xmake/scripts')
-rw-r--r--xmake/scripts/run.vbs67
-rw-r--r--xmake/scripts/sudo.vbs15
-rw-r--r--xmake/scripts/update-script.bat7
-rw-r--r--xmake/scripts/update-script.sh5
4 files changed, 79 insertions, 15 deletions
diff --git a/xmake/scripts/run.vbs b/xmake/scripts/run.vbs
new file mode 100644
index 000000000..24fa86c4a
--- /dev/null
+++ b/xmake/scripts/run.vbs
@@ -0,0 +1,67 @@
+Set UAC = CreateObject("Shell.Application")
+
+Const PROCESS = "xmake.exe"
+
+If WScript.Arguments.count < 2 Then
+ WScript.echo "Help: run <flag> <command> [args]"
+ WScript.echo " flags:"
+ WScript.echo " N - normal"
+ WScript.echo " A - run as admin"
+ WScript.echo " W - wait xmake to exit"
+ WScript.echo " You should use 'N' if no speical flags needed"
+ WScript.echo " e.g.: run WA xmake-install.exe /Q"
+Else
+ Dim flags
+ Dim program
+ flags = UCase(WScript.arguments(0))
+ program = WScript.arguments(1)
+
+ Dim verb
+ Dim wait
+ If InStr(flags, "A") <> 0 Then
+ verb = "runas"
+ Else
+ verb = "open"
+ End If
+
+ If InStr(flags, "W") <> 0 Then
+ Dim counter
+ counter = 0
+ Dim sQuery
+ sQuery = "select * from win32_process where name='" & PROCESS & "'"
+ Do
+ Set SVC = getobject("winmgmts:root\cimv2")
+ Set cproc = SVC.execquery(sQuery)
+ iniproc = cproc.count
+ counter = counter + 1
+ If counter >= 20 Then
+ WScript.echo "xmake still hasn't exited after 10 seconds, aborting..."
+ WScript.quit 1
+ End If
+ If iniproc <> 0 Then
+ WScript.echo "Waiting for xmake to exit..."
+ wscript.sleep 500
+ End If
+ Loop Until iniproc = 0
+
+ Set cproc = Nothing
+ Set SVC = Nothing
+ End If
+
+ Dim ucCount
+ Dim args
+ args = ""
+ For ucCount = 2 To (WScript.Arguments.count - 1) Step 1
+ Dim carg
+ if InStr(WScript.Arguments(ucCount), " ") <> 0 Then
+ carg = """" & Replace(WScript.Arguments(ucCount), """", """""") & """"
+ ElseIf Len(WScript.Arguments(ucCount)) = 0 Then
+ carg = """"""
+ Else
+ carg = WScript.Arguments(ucCount)
+ End If
+ args = args & " " & carg
+ Next
+
+ UAC.ShellExecute program, args, "", verb, 1
+End If
diff --git a/xmake/scripts/sudo.vbs b/xmake/scripts/sudo.vbs
deleted file mode 100644
index 9bc71637c..000000000
--- a/xmake/scripts/sudo.vbs
+++ /dev/null
@@ -1,15 +0,0 @@
-Set UAC = CreateObject("Shell.Application")
-Set Shell = CreateObject("WScript.Shell")
-If WScript.Arguments.count < 1 Then
- WScript.echo "Help: sudo <command> [args]"
-ElseIf WScript.Arguments.count = 1 Then
- UAC.ShellExecute WScript.arguments(0), "", "", "runas", 1
-Else
- Dim ucCount
- Dim args
- args = NULL
- For ucCount = 1 To (WScript.Arguments.count - 1) Step 1
- args = args & " " & WScript.Arguments(ucCount)
- Next
- UAC.ShellExecute WScript.arguments(0), args, "", "runas", 5
-End If
diff --git a/xmake/scripts/update-script.bat b/xmake/scripts/update-script.bat
new file mode 100644
index 000000000..f0df7c1bd
--- /dev/null
+++ b/xmake/scripts/update-script.bat
@@ -0,0 +1,7 @@
+@echo off
+
+echo Removing old files
+cd "%~1"
+del actions core includes languages modules platforms plugins repository rules scripts templates themes /S /Q /F >nul
+echo Copying from temp directory to "%~1"
+xcopy "%~2" "%~1" /S /Y /Q >nul \ No newline at end of file
diff --git a/xmake/scripts/update-script.sh b/xmake/scripts/update-script.sh
new file mode 100644
index 000000000..9e79ec71a
--- /dev/null
+++ b/xmake/scripts/update-script.sh
@@ -0,0 +1,5 @@
+
+
+cd "$1"
+rm actions core includes languages modules platforms plugins repository rules scripts templates themes -rf
+cp "$2" "$1/.." -rf \ No newline at end of file