Skip to content

Conversation

@0xc1c4da
Copy link

This should fix #738 and #739

$ VPK_LOG=trace ./result/bin/vpk pack --packId com.test.app --packVersion 0.0.1 --packDir ~/experiments/test-velopack/dist/linux-x64/test.AppDir/ --mainExe test --packTitle "Test" 2>&1 | tee vpk.log
[16:52:46 INF] Velopack CLI 0.0.0, for distributing applications.
[16:52:47 WRN] There is a newer version of vpk available (0.0.1298). Run 'dotnet tool update -g vpk'
[16:52:47 INF] Beginning to package Velopack release 0.0.1.
[16:52:47 INF] Releases Directory: /home/j/experiments/test-velopack/Releases
[16:52:47 INF] Starting: Pre-process steps
[16:52:47 INF] Pack directory ends with .AppDir, will skip building new one.
[16:52:47 INF] Complete: Pre-process steps
[16:52:47 INF] Starting: Building portable package
[16:52:47 INF] Compressing AppDir into squashfs filesystem
[16:52:48 INF] Creating AppImage with appimagekit-runtime-x86_64 runtime
[16:52:48 INF] Complete: Building portable package
[16:52:48 INF] Starting: Building release 0.0.1
[16:52:49 INF] Complete: Building release 0.0.1
[16:52:49 INF] Starting: Post-process steps
[16:52:49 INF] Complete: Post-process steps
[16:52:49 INF] Finished in 00:00:01.6071353.
[16:52:49 WRN] There is a newer version of vpk available (0.0.1298). Run 'dotnet tool update -g vpk'

$ ls Releases/
assets.linux.json                com.test.app.AppImage  releases.linux.json
com.test.app-0.0.1-linux-full.nupkg  RELEASES-linux

Copy link
Member

@caesay caesay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting this PR! There are a few things that can be simplified, if you don't get around to it I can fix and merge later.

// Ensure the copied runtime is writable before appending squashfs.
try {
if (VelopackRuntimeInfo.IsLinux) {
#if NET8_0_OR_GREATER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any of this code that calls SetUnixFileMode is necessary. ChmodFileAsExecutable already sets 755, is that not sufficient?

tempDir = "/tmp/velopack";
} else if (VelopackRuntimeInfo.IsWindows) {
tempDir = Path.Combine(Path.GetTempPath(), "Velopack");
var velopackTemp = Environment.GetEnvironmentVariable("VELOPACK_TEMP");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why VELOPACK_TEMP isn't treated the same as the other environment variables? We could simplify this code significantly:

var envTempDir = new[] { "VELOPACK_TEMP", "TMPDIR", "TEMP", "TMP" }
    .Select(Environment.GetEnvironmentVariable)
    .FirstOrDefault(x => x != null);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed


if (Options.PackDirectory.EndsWith(".AppDir", StringComparison.OrdinalIgnoreCase)) {
var packDirName = Options.PackDirectory?.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
var packDirBase = string.IsNullOrWhiteSpace(packDirName) ? Options.PackDirectory : packDirName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand this line of code. If the goal is to allow trailing slashes then the TrimEnd would've been the only thing we needed to add and I think we have a guarantee here already that Options.PackDirectory is not null.

Copy link
Author

@0xc1c4da 0xc1c4da Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--packDir is sensitive to path-to/foo.AppDir/ and vpk will only operate if the parameter is path-to/foo.AppDir, however using tab autocomplete the trailing / is added, requiring to manually edit the command.

Will use TrimEnd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.UnauthorizedAccessException: Access to the path is denied

2 participants