Skip to content

Commit

Permalink
Merge branch 'main' into CanResize
Browse files Browse the repository at this point in the history
  • Loading branch information
mujianwu committed Oct 1, 2024
2 parents eb99228 + 0c5d8a9 commit 55d1e19
Show file tree
Hide file tree
Showing 16 changed files with 322 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET
name: .NET Test

on:
push:
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Build Linux

on:
workflow_dispatch:
inputs:
VERSION:
description: 'Version'
required: true
BINARY_BRANCH:
description: 'Binary branch'
required: true
NEED_NUPKG:
description: 'Use self nupkg'
type: boolean
required: true
default: false

jobs:
linux-deb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Download NuGet package
if: ${{ inputs.NEED_NUPKG }}
run: |
wget https://github.com/Uotan-Dev/SukiUI-Uotan/releases/download/v6.0.0/SukiUI.6.0.0.nupkg
dotnet nuget add source "/home/runner/work/UotanToolboxNT"
nuget add SukiUI.6.0.0.nupkg -Source /home/runner/work/UotanToolboxNT
- name: Clone Binary
run: git clone https://github.com/Uotan-Dev/UotanToolboxNT.Binary.git -b ${{ inputs.BINARY_BRANCH }}

- name: Build
run: |
dotnet publish -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-x64
dotnet publish -r linux-arm64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-arm64
- name: Make deb-x64
run: |
mkdir staging_folder
mkdir ./staging_folder/DEBIAN
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Linux/control-x64 ./staging_folder/DEBIAN/control
mkdir ./staging_folder/usr
mkdir ./staging_folder/usr/bin
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Linux/UotanToolbox ./staging_folder/usr/bin/UotanToolbox
chmod +x ./staging_folder/usr/bin/UotanToolbox
mkdir ./staging_folder/usr/lib
mkdir ./staging_folder/usr/lib/UotanToolbox
cp -r ./UotanToolboxNT.Binary/Linux_AMD64/* ./staging_folder/usr/lib/UotanToolbox/
cp -r ./publish-x64/* ./staging_folder/usr/lib/UotanToolbox/
chmod -R a+rX ./staging_folder/usr/lib/UotanToolbox/
chmod +x ./staging_folder/usr/lib/UotanToolbox/UotanToolbox
mkdir ./staging_folder/usr/share
mkdir ./staging_folder/usr/share/applications
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Linux/UotanToolbox.desktop ./staging_folder/usr/share/applications/UotanToolbox.desktop
mkdir ./staging_folder/usr/share/pixmaps
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Linux/UotanToolbox.png ./staging_folder/usr/share/pixmaps/UotanToolbox.png
dpkg-deb --root-owner-group --build ./staging_folder/ ./UotanToolbox_Linux_x64_${{ inputs.VERSION }}.deb
rm -rf ./staging_folder/*
- name: Make deb-arm64
run: |
mkdir ./staging_folder/DEBIAN
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Linux/control-arm64 ./staging_folder/DEBIAN/control
mkdir ./staging_folder/usr
mkdir ./staging_folder/usr/bin
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Linux/UotanToolbox ./staging_folder/usr/bin/UotanToolbox
chmod +x ./staging_folder/usr/bin/UotanToolbox
mkdir ./staging_folder/usr/lib
mkdir ./staging_folder/usr/lib/UotanToolbox
cp -r ./UotanToolboxNT.Binary/Linux_AArch64/* ./staging_folder/usr/lib/UotanToolbox/
cp -r ./publish-arm64/* ./staging_folder/usr/lib/UotanToolbox/
chmod -R a+rX ./staging_folder/usr/lib/UotanToolbox/
chmod +x ./staging_folder/usr/lib/UotanToolbox/UotanToolbox
mkdir ./staging_folder/usr/share
mkdir ./staging_folder/usr/share/applications
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Linux/UotanToolbox.desktop ./staging_folder/usr/share/applications/UotanToolbox.desktop
mkdir ./staging_folder/usr/share/pixmaps
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Linux/UotanToolbox.png ./staging_folder/usr/share/pixmaps/UotanToolbox.png
dpkg-deb --root-owner-group --build ./staging_folder/ ./UotanToolbox_Linux_arm64_${{ inputs.VERSION }}.deb
rm -rf ./staging_folder/*
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Linux-Package
path: ./UotanToolbox_Linux*
72 changes: 72 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Build macOS

on:
workflow_dispatch:
inputs:
VERSION:
description: 'Version'
required: true
BINARY_BRANCH:
description: 'Binary branch'
required: true
NEED_NUPKG:
description: 'Use self nupkg'
type: boolean
required: true
default: false

jobs:
macos-app:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Download NuGet package
if: ${{ inputs.NEED_NUPKG }}
run: |
wget https://github.com/Uotan-Dev/SukiUI-Uotan/releases/download/v6.0.0/SukiUI.6.0.0.nupkg
dotnet nuget add source "/Users/runner/work/UotanToolboxNT/UotanToolboxNT"
nuget add SukiUI.6.0.0.nupkg -Source /Users/runner/work/UotanToolboxNT/UotanToolboxNT
- name: Clone Binary
run: git clone https://github.com/Uotan-Dev/UotanToolboxNT.Binary.git -b ${{ inputs.BINARY_BRANCH }}

- name: Build
run: |
dotnet publish -r osx-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-x64
dotnet publish -r osx-arm64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-arm64
- name: Make app-x64
run: |
mkdir UotanToolbox.app
mkdir UotanToolbox.app/Contents
mkdir UotanToolbox.app/Contents/MacOS
mkdir UotanToolbox.app/Contents/Resources
cp /Users/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/macOS/Info.plist ./UotanToolbox.app/Contents/Info.plist
cp /Users/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/macOS/PkgInfo ./UotanToolbox.app/Contents/PkgInfo
cp /Users/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/macOS/Icon.icns ./UotanToolbox.app/Contents/Resources/Icon.icns
cp -r ./UotanToolboxNT.Binary/macOS/* ./UotanToolbox.app/Contents/MacOS/
cp -r ./publish-x64/* ./UotanToolbox.app/Contents/MacOS/
zip -rq ./UotanToolbox_macOS_x64_${{ inputs.VERSION }}.zip ./UotanToolbox.app
rm -rf ./UotanToolbox.app/Contents/MacOS/*
- name: Make app-arm64
run: |
cp -r ./UotanToolboxNT.Binary/macOS/* ./UotanToolbox.app/Contents/MacOS/
cp -r ./publish-arm64/* ./UotanToolbox.app/Contents/MacOS/
zip -rq ./UotanToolbox_macOS_arm64_${{ inputs.VERSION }}.zip ./UotanToolbox.app
rm -rf ./UotanToolbox.app/Contents/MacOS/*
- name: Upload
uses: actions/upload-artifact@v3
with:
name: macOS-Package
path: ./UotanToolbox_macOS*
61 changes: 61 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Build Windows

on:
workflow_dispatch:
inputs:
VERSION:
description: 'Version'
required: true
BINARY_BRANCH:
description: 'Binary branch'
required: true
NEED_NUPKG:
description: 'Use self nupkg'
type: boolean
required: true
default: false

jobs:
windows-zip:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Download NuGet package
if: ${{ inputs.NEED_NUPKG }}
run: |
Invoke-WebRequest -Uri https://github.com/Uotan-Dev/SukiUI-Uotan/releases/download/v6.0.0/SukiUI.6.0.0.nupkg -OutFile SukiUI.6.0.0.nupkg
dotnet nuget add source "D:\a\UotanToolboxNT\UotanToolboxNT"
nuget add SukiUI.6.0.0.nupkg -Source D:\a\UotanToolboxNT\UotanToolboxNT
- name: Clone Binary
run: git clone https://github.com/Uotan-Dev/UotanToolboxNT.Binary.git -b ${{ inputs.BINARY_BRANCH }}

- name: Build
run: |
dotnet publish -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-x64
dotnet publish -r win-arm64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-arm64
- name: Make zip-x64
run: |
xcopy ./UotanToolboxNT.Binary/Windows\* ./publish-x64 /e
7z a -tzip UotanToolbox_Windows_x64_${{ inputs.VERSION }}.zip -mx=9 -m0=lzma -md=64m -mfb=64 ./publish-x64
- name: Make zip-arm64
run: |
xcopy ./UotanToolboxNT.Binary/Windows\* ./publish-arm64 /e
7z a -tzip UotanToolbox_Windows_arm64_${{ inputs.VERSION }}.zip -mx=9 -m0=lzma -md=64m -mfb=64 ./publish-arm64
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Windows-Package
path: ./UotanToolbox_Windows*
3 changes: 3 additions & 0 deletions UotanToolbox/Assets/Linux/UotanToolbox
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec /usr/lib/UotanToolbox/UotanToolbox
11 changes: 11 additions & 0 deletions UotanToolbox/Assets/Linux/UotanToolbox.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Version=3.0.0
Name=UotanToolbox
GenericName=UotanToolbox
Icon=UotanToolbox
Exec=UotanToolbox %F
StartupWMClass=UotanToolbox
Terminal=false
Categories=Development
Keywords=UotanToolbox; Uotan;
Binary file added UotanToolbox/Assets/Linux/UotanToolbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions UotanToolbox/Assets/Linux/control-arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Maintainer: mujianwu <[email protected]>
Package: UotanToolbox
Version: 3.0.0
Section: devel
Priority: optional
Architecture: arm64
Essential: no
Installed-Size: 268000
Depends: usbutils, android-tools-adb, gnome-terminal
Description: Advanced, Modern Toolbox for Geeks.
Copyright: 2020-2024 UOTAN
11 changes: 11 additions & 0 deletions UotanToolbox/Assets/Linux/control-loong64
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Maintainer: mujianwu <[email protected]>
Package: UotanToolbox
Version: 3.0.0
Section: devel
Priority: optional
Architecture: loong64
Essential: no
Installed-Size: 268000
Depends: usbutils, android-tools-adb, gnome-terminal
Description: Advanced, Modern Toolbox for Geeks.
Copyright: 2020-2024 UOTAN
11 changes: 11 additions & 0 deletions UotanToolbox/Assets/Linux/control-x64
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Maintainer: mujianwu <[email protected]>
Package: UotanToolbox
Version: 3.0.0
Section: devel
Priority: optional
Architecture: amd64
Essential: no
Installed-Size: 268000
Depends: usbutils, android-tools-adb, gnome-terminal
Description: Advanced, Modern Toolbox for Geeks.
Copyright: 2020-2024 UOTAN
File renamed without changes.
30 changes: 30 additions & 0 deletions UotanToolbox/Assets/macOS/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>UotanToolbox</string>
<key>CFBundleIconFile</key>
<string>Icon</string>
<key>CFBundleIdentifier</key>
<string>com.uotan.toolbox</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>UotanToolbox</string>
<key>CFBundleDisplayName</key>
<string>UotanToolbox</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2020-2024 UOTAN All rights reserved.</string>
<key>CFBundleShortVersionString</key>
<string>3.0.0</string>
<key>CFBundleVersion</key>
<string>3.0.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
</dict>
</plist>
1 change: 1 addition & 0 deletions UotanToolbox/Assets/macOS/PkgInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APPL????
7 changes: 4 additions & 3 deletions UotanToolbox/Common/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class Global
public static AvaloniaList<string> deviceslist;
public static string thisdevice = null;
public static ZipInfo Zipinfo = new ZipInfo("", "", "", "", "", false, PatchMode.None, "");
public static BootInfo Bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", "");
public static BootInfo Bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", "", "");
public static int mb_exitcode, cpio_exitcode, load_times;
//分区表储存
public static string sdatable = "";
Expand Down Expand Up @@ -46,7 +46,8 @@ public class BootInfo
public bool HaveDTB { get; set; }
public string DTBName { get; set; }
public string Arch { get; set; }
public BootInfo(string sha1, string path, string tempPath, bool isUseful, bool gki2, string version, string kmi, string osversion, string patchlevel, bool haveramdisk, bool havekernel, bool havedtb, string dtbname, string arch)
public string Compress { get; set; }
public BootInfo(string sha1, string path, string tempPath, bool isUseful, bool gki2, string version, string kmi, string osversion, string patchlevel, bool haveramdisk, bool havekernel, bool havedtb, string dtbname, string arch, string compress)
{
SHA1 = sha1;
Path = path;
Expand All @@ -62,7 +63,7 @@ public BootInfo(string sha1, string path, string tempPath, bool isUseful, bool g
HaveDTB = havedtb;
DTBName = dtbname;
Arch = arch;

Compress = compress;
}
}
public class ZipInfo
Expand Down
4 changes: 3 additions & 1 deletion UotanToolbox/Common/PatchHelper/BootDetect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal class BootDetect
private static string GetTranslation(string key) => FeaturesHelper.GetTranslation(key);
public static async Task<BootInfo> Boot_Detect(string path)
{
BootInfo bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", "");
BootInfo bootinfo = new BootInfo("", "", "", false, false, "", "", "", "", false, false, false, "", "", "");
bootinfo.Path = path;
bootinfo.SHA1 = await FileHelper.SHA1HashAsync(bootinfo.Path);
bootinfo.TempPath = Path.Combine(Global.tmp_path, "Boot-" + StringHelper.RandomString(8));
Expand All @@ -22,13 +22,15 @@ public static async Task<BootInfo> Boot_Detect(string path)
}
string osVersionPattern = @"OS_VERSION\s+\[(.*?)\]";
string osPatchLevelPattern = @"OS_PATCH_LEVEL\s+\[(.*?)\]";
string osKernelFMTPattern = @"KERNEL_FMT\s*\[([^\]]*)\]";
(string mb_output, Global.mb_exitcode) = await CallExternalProgram.MagiskBoot($"unpack \"{path}\"", bootinfo.TempPath);
if (Global.mb_exitcode != 0)
{
throw new Exception(GetTranslation("Basicflash_SelectBoot") + mb_output);
}
bootinfo.OSVersion = Regex.Match(mb_output, osVersionPattern).Groups[1].Value;
bootinfo.PatchLevel = Regex.Match(mb_output, osPatchLevelPattern).Groups[1].Value;
bootinfo.Compress = Regex.Match(mb_output, osKernelFMTPattern).Groups[1].Value;
bootinfo.IsUseful = true;
(bootinfo.HaveDTB, bootinfo.DTBName) = await Task.Run(() => dtb_detect(bootinfo.TempPath));
(bootinfo.Version, bootinfo.KMI, bootinfo.HaveKernel, bootinfo.GKI2, bootinfo.Arch) = await kernel_detect(bootinfo.TempPath);
Expand Down
Loading

0 comments on commit 55d1e19

Please sign in to comment.