Skip to content

Commit 10a60b2

Browse files
committed
After the Linux version updates the core, set chmod+x
1 parent b3c2084 commit 10a60b2

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

v2rayN/ServiceLib/Common/Utils.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,13 @@ public static bool IsAdministrator()
806806
return await GetCliWrapOutput("/bin/bash", arg);
807807
}
808808

809+
public static async Task<string?> SetLinuxChmod(string? fileName)
810+
{
811+
if (fileName.IsNullOrEmpty()) return null;
812+
var arg = new List<string>() { "-c", $"chmod +x {fileName}" };
813+
return await GetCliWrapOutput("/bin/bash", arg);
814+
}
815+
809816
#endregion Platform
810817
}
811818
}

v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private async Task UpdateFinished()
182182
{
183183
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, false);
184184
await Task.Delay(2000);
185-
UpgradeCore();
185+
await UpgradeCore();
186186

187187
if (_lstUpdated.Any(x => x.CoreType == _v2rayN && x.IsFinished == true))
188188
{
@@ -228,7 +228,7 @@ private void UpgradeN()
228228
}
229229
}
230230

231-
private void UpgradeCore()
231+
private async Task UpgradeCore()
232232
{
233233
foreach (var item in _lstUpdated)
234234
{
@@ -266,6 +266,15 @@ private void UpgradeCore()
266266
FileManager.ZipExtractToFile(fileName, toPath, _config.guiItem.ignoreGeoUpdateCore ? "geo" : "");
267267
}
268268

269+
if (Utils.IsLinux())
270+
{
271+
var filesList = (new DirectoryInfo(toPath)).GetFiles().Select(u => u.FullName).ToList();
272+
foreach (var file in filesList)
273+
{
274+
await Utils.SetLinuxChmod(Path.Combine(toPath, item.CoreType));
275+
}
276+
}
277+
269278
UpdateView(item.CoreType, ResUI.MsgUpdateV2rayCoreSuccessfully);
270279

271280
if (File.Exists(fileName))

0 commit comments

Comments
 (0)