Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MSI support and add minimal UI #142

Merged
merged 5 commits into from
May 28, 2023
Merged

Conversation

aerkiaga
Copy link
Contributor

@aerkiaga aerkiaga commented May 26, 2023

This pull request gets MSI support to a state where it can install and uninstall a simple program (under Wine). It also adds a simple setup UI with support for both install and remove actions. It cannot yet upgrade an installation in-place or perform other tasks like setting up shortcuts, modifying environment variables or writing registry values.

Depends on mdsteele/rust-msi#16.

The UI layout is inspired on that of an existing installer, with less dialogs/controls and some modifications: the text has been made larger (size 10, up from 8), and all sentences have been reworded, notably some buttons for clarity ("Next" -> "Install"/"Remove", "Yes" -> "Abort", "No" -> "Continue"). Also, no icons or banners are present; unnecessary though they are, I could draw up some (following any indications) to make the installer more closely follow conventional UIs (edit: done here, I'll PR if desired).

Edit: I've commented on the fixes. Everything else is not strictly necessary for the installer to work.

@@ -158,6 +171,7 @@ fn set_summary_info(package: &mut Package, package_guid: Uuid, settings: &Settin
}
let creating_app = format!("cargo-bundle v{}", crate_version!());
summary_info.set_creating_application(creating_app);
summary_info.set_word_count(2);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fix requires the rust-msi patch. Without this line, the installer will attempt to copy files from outside the package.

@@ -429,9 +464,9 @@ fn create_feature_table(package: &mut Package, settings: &Settings) -> crate::Re
msi::Value::from(settings.bundle_name()),
msi::Value::Null,
msi::Value::Int(1),
msi::Value::Int(3),
msi::Value::Int(1),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With Feature Level 3 and INSTALLLEVEL 1, this feature will never be installed.

@@ -591,7 +626,7 @@ fn create_file_table(package: &mut Package, cabinets: &[CabinetInfo]) -> crate::
for cabinet in cabinets.iter() {
for resource in cabinet.resources.iter() {
rows.push(vec![
msi::Value::Str(format!("r{sequence:04}")),
msi::Value::Str(resource.filename.clone()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes the File entry accessible to the Components table.

},
None => "",
};
binary_name += binary_extension;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes extension handling

@mdsteele
Copy link
Collaborator

This looks reasonable to me. I've just published a v0.6.0 of the msi crate with the new set_word_count method, so you should be set to update Cargo.toml.

@mdsteele
Copy link
Collaborator

Looks like just need to fix some clippy errors.

@mdsteele mdsteele merged commit 2397790 into burtonageo:master May 28, 2023
@mdsteele
Copy link
Collaborator

Thanks!

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.

2 participants