diff --git a/.github/workflows/announce.yml b/.github/workflows/announce.yml index 2fd1c65e..a38e7001 100644 --- a/.github/workflows/announce.yml +++ b/.github/workflows/announce.yml @@ -25,10 +25,10 @@ jobs: "fields": [ { "name": "Release Notes", "value": "[Click Me](https://github.com/mattpannella/pocket-updater-utility/releases/tag/${{ github.event.release.tag_name }})", "inline": true }, { "name": "Version", "value": "${{ github.event.release.tag_name }}", "inline": true }, - { "name": "macOS Build", "value": "[Download Me](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pocket_updater_mac.zip)" }, - { "name": "Linux Build", "value": "[Or Me](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pocket_updater_linux.zip)" }, - { "name": "Linux ARM64 Build", "value": "[This is for creeps](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pocket_updater_linux_arm.zip)" }, - { "name": "Windows Build", "value": "[This is a virus](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pocket_updater_win.zip)" } + { "name": "macOS Build", "value": "[Download Me](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pupdate_mac.zip)" }, + { "name": "Linux Build", "value": "[Or Me](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pupdate_linux.zip)" }, + { "name": "Linux ARM64 Build", "value": "[This is for creeps](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pupdate_linux_arm.zip)" }, + { "name": "Windows Build", "value": "[This is a virus](https://github.com/mattpannella/pocket-updater-utility/releases/download/${{ github.event.release.tag_name }}/pupdate_win.zip)" } ] }] }' \ diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7e108c5f..dac0c65f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -40,33 +40,33 @@ jobs: release_name="App-$tag-${{ matrix.target }}" # Build everything - dotnet publish pocket_updater.csproj -r ${{ matrix.target }}-x64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly + dotnet publish pupdate.csproj -r ${{ matrix.target }}-x64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly if ${{ matrix.arm }}; then - mv ${release_name}/pocket_updater ${release_name}/pocket_updater_x64 - dotnet publish pocket_updater.csproj -r ${{ matrix.target }}-arm64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly - mv ${release_name}/pocket_updater ${release_name}/pocket_updater_arm64 + mv ${release_name}/pupdate ${release_name}/pupdate_x64 + dotnet publish pupdate.csproj -r ${{ matrix.target }}-arm64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly + mv ${release_name}/pupdate ${release_name}/pupdate_arm64 if [ "${{ matrix.target }}" == "linux" ]; then - dotnet publish pocket_updater.csproj -r ${{ matrix.target }}-arm --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly - mv ${release_name}/pocket_updater ${release_name}/pocket_updater_arm32 + dotnet publish pupdate.csproj -r ${{ matrix.target }}-arm --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly + mv ${release_name}/pupdate ${release_name}/pupdate_arm32 fi fi # Pack files if [ "${{ matrix.target }}" == "win" ]; then # Pack to zip for Windows - 7z a -tzip "pocket_updater_win.zip" "./${release_name}/pocket_updater.exe" + 7z a -tzip "pupdate_win.zip" "./${release_name}/pupdate.exe" elif [ "${{ matrix.target }}" == "osx" ]; then cd $release_name - lipo -create -output pocket_updater pocket_updater_arm64 pocket_updater_x64 - rm pocket_updater_arm64 - rm pocket_updater_x64 - zip "../pocket_updater_mac.zip" "pocket_updater"; cd ..; + lipo -create -output pupdate pupdate_arm64 pupdate_x64 + rm pupdate_arm64 + rm pupdate_x64 + zip "../pupdate_mac.zip" "pupdate"; cd ..; else cd $release_name - mv pocket_updater_x64 pocket_updater - zip "../pocket_updater_linux.zip" "pocket_updater" - zip "../pocket_updater_linux_arm64.zip" "pocket_updater_arm64" - zip "../pocket_updater_linux_arm32.zip" "pocket_updater_arm32" + mv pupdate_x64 pupdate + zip "../pupdate_linux.zip" "pupdate" + zip "../pupdate_linux_arm64.zip" "pupdate_arm64" + zip "../pupdate_linux_arm32.zip" "pupdate_arm32" cd .. fi @@ -76,6 +76,6 @@ jobs: - name: Publish uses: softprops/action-gh-release@v1 with: - files: "pocket_updater*.zip" + files: "pupdate*.zip" env: GITHUB_TOKEN: ${{ secrets.API_TOKEN }} diff --git a/.vscode/launch.json b/.vscode/launch.json index 6948300c..e29b25a7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/bin/Debug/net6.0/pocket_updater.dll", + "program": "${workspaceFolder}/bin/Debug/net6.0/pupdate.dll", "args": ["-p", "/Users/mattpannella/pocket-test"], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6af1c5a8..524159b8 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,7 +7,7 @@ "type": "process", "args": [ "build", - "${workspaceFolder}/pocket_updater.csproj", + "${workspaceFolder}/pupdate.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], @@ -19,7 +19,7 @@ "type": "process", "args": [ "publish", - "${workspaceFolder}/pocket_updater.csproj", + "${workspaceFolder}/pupdate.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], @@ -33,7 +33,7 @@ "watch", "run", "--project", - "${workspaceFolder}/pocket_updater.csproj" + "${workspaceFolder}/pupdate.csproj" ], "problemMatcher": "$msCompile" } diff --git a/README.md b/README.md index 11ddba61..69a6f424 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ Checks for missing required assets for each core you have selected (mainly arcad menu (Default Verb) Interactive Main Menu -p, --path Absolute path to install location + -s, --skip-update Go straight to the menu, without looking for an update fund List sponsor links. Lists all if no core is provided -c, --core The core to check funding links for @@ -124,19 +125,19 @@ examples: -`/path/to/pocket_updater -p /path/to/sdcard/` +`/path/to/pupdate -p /path/to/sdcard/` -`/path/to/pocket_updater update -c boogermann.bankpanic` +`/path/to/pupdate update -c boogermann.bankpanic` -`/path/to/pocket_updater assets -c jotego.jtcontra` +`/path/to/pupdate assets -c jotego.jtcontra` -`/path/to/pocket_updater images -i pocket-platform-images -o dyreschlock -v home` +`/path/to/pupdate images -i pocket-platform-images -o dyreschlock -v home` ### Core Selector diff --git a/_config.yml b/_config.yml index 72d30eb8..628f698b 100644 --- a/_config.yml +++ b/_config.yml @@ -1,4 +1,4 @@ -title: Pocket Updater Utility +title: Pupdate author: name: Matt Pannella email: mattpannella@gmail.com diff --git a/pocket_updater.csproj b/pupdate.csproj similarity index 95% rename from pocket_updater.csproj rename to pupdate.csproj index 8a08bb9e..3a390975 100644 --- a/pocket_updater.csproj +++ b/pupdate.csproj @@ -10,7 +10,7 @@ Keep your Analogue Pocket up to date 2023 Matt Pannella Matt Pannella - Analogue Pocket Updater Utility + Pupdate https://github.com/mattpannella/pocket-updater-utility diff --git a/pocket_updater.sln b/pupdate.sln similarity index 87% rename from pocket_updater.sln rename to pupdate.sln index bc592a0f..ca83232d 100644 --- a/pocket_updater.sln +++ b/pupdate.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31912.275 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pocket_updater", "pocket_updater.csproj", "{88615FF5-4649-4DD0-B721-449269388A88}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pupdate", "pupdate.csproj", "{88615FF5-4649-4DD0-B721-449269388A88}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Program.cs b/src/Program.cs index cd210c05..533808a7 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -12,14 +12,12 @@ internal class Program private static string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(3); private const string USER = "mattpannella"; private const string REPOSITORY = "pocket-updater-utility"; - private const string RELEASE_URL = "https://github.com/mattpannella/pocket-updater-utility/releases/download/{0}/pocket_updater_{1}.zip"; - private const string NEW_RELEASE_URL = "https://github.com/mattpannella/pocket-updater-utility/releases/download/{0}/pupdate_{1}.zip"; + private const string RELEASE_URL = "https://github.com/mattpannella/pocket-updater-utility/releases/download/{0}/pupdate_{1}.zip"; private static SettingsManager settings; private static PocketCoreUpdater updater; private static bool cliMode = false; - private static bool migrate = false; private static async Task Main(string[] args) { try { @@ -122,6 +120,9 @@ private static async Task Main(string[] args) if(o.InstallPath != null && o.InstallPath != "") { path = o.InstallPath; } + if(o.SkipUpdate) { + cliMode = true; + } } ) .WithNotParsed(o => @@ -136,7 +137,7 @@ private static async Task Main(string[] args) ); if (!cliMode) { - Console.WriteLine("Pocket Updater Utility v" + version); + Console.WriteLine("Pupdate v" + version); Console.WriteLine("Checking for updates..."); if(await CheckVersion(path) && !selfUpdate) { @@ -315,37 +316,16 @@ private static async Task Main(string[] args) } } - static void DisplayHelp(ParserResult result) - { - var helpText = CommandLine.Text.HelpText.AutoBuild(result, h => - { - h.AdditionalNewLineAfterOption = false; - h.Heading = "Myapp 2.0.0-beta"; //change header - h.Copyright = "Copyright (c) 2019 Global.com"; //change copyright text - return CommandLine.Text.HelpText.DefaultParsingErrorsHandler(result, h); - }, e => e); - Console.WriteLine(helpText); - } - private static int UpdateSelfAndRun(string directory, string[] updaterArgs) { - string execName = "pocket_updater"; - string newExecName = "pocket_updater"; - if(migrate) { - newExecName = "pupdate"; - } + string execName = "pupdate"; if(GetPlatform() == "win") { execName += ".exe"; - newExecName += ".exe"; } string execLocation = Path.Combine(directory, execName); - string newExecLocation = Path.Combine(directory, newExecName); string backupName = $"{execName}.backup"; string backupLocation = Path.Combine(directory, backupName); - string updateName = "pocket_updater.zip"; - if(migrate) { - updateName = "pupdate.zip"; - } + string updateName = "pupdate.zip"; string updateLocation = Path.Combine(directory, updateName); int exitcode = int.MinValue; @@ -366,8 +346,8 @@ private static int UpdateSelfAndRun(string directory, string[] updaterArgs) ZipFile.ExtractToDirectory(updateLocation, directory, true); // Execute - Console.WriteLine($"Executing {newExecLocation}"); - ProcessStartInfo pInfo = new ProcessStartInfo(newExecLocation) { + Console.WriteLine($"Executing {execLocation}"); + ProcessStartInfo pInfo = new ProcessStartInfo(execLocation) { Arguments = string.Join(' ', updaterArgs), UseShellExecute = false }; @@ -694,21 +674,14 @@ async static Task CheckVersion(string path) List releases = await GithubApi.GetReleases(USER, REPOSITORY); string tag_name = releases[0].tag_name; - string releaseUrl = RELEASE_URL; - string fileName = "pocket_updater"; - if(tag_name == "3.0.0") { - releaseUrl = NEW_RELEASE_URL; - fileName = "pupdate"; - migrate = true; - } string? v = SemverUtil.FindSemver(tag_name); if(v != null) { bool check = SemverUtil.SemverCompare(v, version); if(check) { Console.WriteLine("A new version is available. Downloading now..."); string platform = GetPlatform(); - string url = String.Format(releaseUrl, tag_name, platform); - string saveLocation = Path.Combine(path, $"{fileName}.zip"); + string url = String.Format(RELEASE_URL, tag_name, platform); + string saveLocation = Path.Combine(path, "pupdate.zip"); await Factory.GetHttpHelper().DownloadFileAsync(url, saveLocation); Console.WriteLine("Download complete."); Console.WriteLine(saveLocation); @@ -725,7 +698,6 @@ async static Task CheckVersion(string path) } } - private static string GetPlatform() { if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { @@ -1008,8 +980,14 @@ __ _ | | | |__| -_| _| |_ -| | | . |_ -| -_| | | |_____|___|_| |___| |_|_|_|___|___|___|_ | |___|", - - +@" _=,_ + o_/6 /#\ + \__ |##/ + ='|--\ + / #'-. + \#|_ _'-. / + |/ \_( # |'' + C/ ,--___/" }; } [Verb("menu", isDefault: true, HelpText = "Interactive Main Menu")] @@ -1017,6 +995,9 @@ public class MenuOptions { [Option('p', "path", HelpText = "Absolute path to install location", Required = false)] public string? InstallPath { get; set; } + + [Option('s', "skip-update", HelpText = "Skip the self update check", Required = false)] + public bool SkipUpdate { get; set; } } [Verb("update", HelpText = "Run update all. (You can configure via the settings menu)")]