summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-06-06 11:18:30 +0800
committerOpportunityLiu <[email protected]>2019-06-06 14:37:23 +0800
commitf243d16eddf71ad45d3b0c662408517d081edd7d (patch)
tree1fd47b9747bf6db535ed817636ba6bf1481037d1
parentb8d8a153ad39596df5580caf635f4363ccdfda45 (diff)
revert
-rw-r--r--xmake/actions/update/main.lua17
-rw-r--r--xmake/scripts/update-script.sh5
2 files changed, 17 insertions, 5 deletions
diff --git a/xmake/actions/update/main.lua b/xmake/actions/update/main.lua
index 6d3e6ce0d..701c56b5c 100644
--- a/xmake/actions/update/main.lua
+++ b/xmake/actions/update/main.lua
@@ -200,6 +200,14 @@ end
function _install_script(sourcedir)
cprintf("\r${yellow} => ${clear}install script to %s .. ", os.programdir())
+ local source = path.join(sourcedir, "xmake")
+ local dirname = path.filename(os.programdir())
+ if dirname ~= "xmake" then
+ local target = path.join(sourcedir, dirname)
+ os.mv(source, target)
+ source = target
+ end
+
local ok = try
{
function ()
@@ -207,14 +215,13 @@ function _install_script(sourcedir)
local script_original = path.join(os.programdir(), "scripts", "update-script.bat")
local script = os.tmpfile() .. ".bat"
os.cp(script_original, script)
- local params = { "/c", script, os.programdir(), path.join(sourcedir, "xmake") }
+ local params = { "/c", script, os.programdir(), source }
os.tryrm(script_original .. ".bak")
- local access = os.trycp(script_original, script_original .. ".bak")
+ local access = os.trymv(script_original, script_original .. ".bak")
return _run_win_v("cmd", params, not access)
else
- os.cd(sourcedir)
- os.vrun("./scripts/get.sh __local__ __install_only__")
- return true
+ local script = path.join(os.programdir(), "scripts", "update-script.sh")
+ return _sudo_v("sh", { script, os.programdir(), source })
end
end,
catch
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