diff options
| author | David Lönnhager <david.l@mullvad.net> | 2025-03-12 15:39:24 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2025-03-14 11:05:41 +0100 |
| commit | bdf68deec3ad1d3b6de87e0cfc8757053d70fdb5 (patch) | |
| tree | 81584e81ff7700dd925dfaa35770e798fc7a4bf8 | |
| parent | df2730b9046b962473e533ef1199651eb3467357 (diff) | |
| download | mullvadvpn-bdf68deec3ad1d3b6de87e0cfc8757053d70fdb5.tar.xz mullvadvpn-bdf68deec3ad1d3b6de87e0cfc8757053d70fdb5.zip | |
Add version to installer-downloader
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | installer-downloader/Cargo.toml | 1 | ||||
| -rw-r--r-- | installer-downloader/assets/Info.plist | 12 | ||||
| -rw-r--r-- | installer-downloader/build.rs | 10 | ||||
| -rwxr-xr-x | installer-downloader/build.sh | 14 | ||||
| -rw-r--r-- | installer-downloader/src/main.rs | 2 | ||||
| -rw-r--r-- | installer-downloader/src/resource.rs | 3 |
7 files changed, 27 insertions, 17 deletions
diff --git a/Cargo.lock b/Cargo.lock index 8c6137b930..f6b3c2c335 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2022,7 +2022,7 @@ dependencies = [ [[package]] name = "installer-downloader" -version = "0.0.0" +version = "1.0.0" dependencies = [ "anyhow", "async-trait", diff --git a/installer-downloader/Cargo.toml b/installer-downloader/Cargo.toml index e71fa3e71e..b88ed18a0c 100644 --- a/installer-downloader/Cargo.toml +++ b/installer-downloader/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "installer-downloader" description = "A secure minimal web installer for the Mullvad app" +version = "1.0.0" authors.workspace = true repository.workspace = true license.workspace = true diff --git a/installer-downloader/assets/Info.plist b/installer-downloader/assets/Info.plist index e99e3277c4..0f91fd599f 100644 --- a/installer-downloader/assets/Info.plist +++ b/installer-downloader/assets/Info.plist @@ -6,24 +6,18 @@ <string>English</string> <key>CFBundleExecutable</key> <string>installer-downloader</string> - <key>CFBundleGetInfoString</key> - <string></string> <key>CFBundleIconFile</key> <string>icon.icns</string> <key>CFBundleIdentifier</key> - <string>net.mullvad.MullvadVPNInstaller</string> + <string>%BUNDLE_ID%</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> - <key>CFBundleLongVersionString</key> - <string></string> <key>CFBundleName</key> - <string>net.mullvad.MullvadVPNInstaller</string> + <string>%BUNDLE_NAME%</string> <key>CFBundlePackageType</key> <string>APPL</string> - <key>CFBundleShortVersionString</key> - <string>0.1</string> <key>CFBundleVersion</key> - <string></string> + <string>%BUNDLE_VERSION%</string> <key>CSResourcesFileMapped</key> <true/> <key>LSRequiresCarbon</key> diff --git a/installer-downloader/build.rs b/installer-downloader/build.rs index 64b0d66d00..781046c9c0 100644 --- a/installer-downloader/build.rs +++ b/installer-downloader/build.rs @@ -2,10 +2,6 @@ use anyhow::Context; use std::env; fn main() -> anyhow::Result<()> { - if cfg!(debug_assertions) { - return Ok(()); - } - let target_os = env::var("CARGO_CFG_TARGET_OS").context("Missing 'CARGO_CFG_TARGET_OS")?; match target_os.as_str() { "windows" => win_main(), @@ -23,8 +19,10 @@ fn win_main() -> anyhow::Result<()> { windows_sys::Win32::System::SystemServices::SUBLANG_ENGLISH_US as u16, )); - println!("cargo:rerun-if-changed=loader.manifest"); - res.set_manifest_file("loader.manifest"); + if !cfg!(debug_assertions) { + println!("cargo:rerun-if-changed=loader.manifest"); + res.set_manifest_file("loader.manifest"); + } res.set_icon("../dist-assets/icon.ico"); res.compile().context("Failed to compile resources") diff --git a/installer-downloader/build.sh b/installer-downloader/build.sh index 5e69a1eb81..efa060ae22 100755 --- a/installer-downloader/build.sh +++ b/installer-downloader/build.sh @@ -87,6 +87,12 @@ function assert_can_sign { fi } +# Get the project version (specified in Cargo.toml). +# This outputs string such as 1.0.0. +function product_version { + sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml +} + # Run cargo with all appropriate flags and options # Arguments: # - (optional) target @@ -212,7 +218,13 @@ function dist_macos_app { mkdir -p "$app_path/Contents/MacOS" - cp ./assets/Info.plist "$app_path/Contents/Info.plist" + # Generate info plist, using the version specified in Cargo.toml + sed -e "s/%BUNDLE_VERSION%/$(product_version)/g" \ + -e "s/%BUNDLE_NAME%/$BUNDLE_NAME/g" \ + -e "s/%BUNDLE_ID%/$BUNDLE_ID/g" \ + ./assets/Info.plist > "$app_path/Contents/Info.plist" + + # Copy executable cp "$BUILD_DIR/installer-downloader" "$app_path/Contents/MacOS/installer-downloader" # Sign app bundle diff --git a/installer-downloader/src/main.rs b/installer-downloader/src/main.rs index 7be9b76b2c..26b1442569 100644 --- a/installer-downloader/src/main.rs +++ b/installer-downloader/src/main.rs @@ -16,6 +16,8 @@ mod inner { pub fn run() { log::init().expect("failed to set up logger"); + ::log::debug!("Installer downloader version: {}", resource::VERSION); + let rt = tokio::runtime::Builder::new_multi_thread() .enable_all() .build() diff --git a/installer-downloader/src/resource.rs b/installer-downloader/src/resource.rs index 24c59995c3..69c1e95e0f 100644 --- a/installer-downloader/src/resource.rs +++ b/installer-downloader/src/resource.rs @@ -1,5 +1,8 @@ //! Shared text and other resources +/// Installer downloader version +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); + /// Window title pub const WINDOW_TITLE: &str = "Mullvad VPN installer"; /// Window width |
