Skip to content

Commit a951118

Browse files
committed
calibre: Switch to MSI Installer
1 parent cfd6203 commit a951118

File tree

5 files changed

+468
-27
lines changed

5 files changed

+468
-27
lines changed

bucket/calibre-normal.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
{
2+
"##": "Deprecate this manifest after 2026-12-01",
23
"version": "8.16.2",
3-
"description": "Powerful and easy to use e-book manager",
4+
"description": "Powerful and easy to use e-book manager.",
45
"homepage": "https://calibre-ebook.com",
5-
"license": "GPL-3.0-only",
6-
"notes": "Calibre drops support for 32-bit CPUs after v6.0.0, if you are running a 32-bit system, please install calibre-normal5 from Versions bucket.",
6+
"license": {
7+
"identifier": "GPL-3.0-or-later",
8+
"url": "https://github.com/kovidgoyal/calibre/blob/HEAD/LICENSE"
9+
},
10+
"notes": [
11+
"`calibre` has been switched to the MSI installer, providing portable-like functionality through the use of environment variables.",
12+
"User data will be migrated automatically during the installation process of `calibre`, so there is no need to worry about data loss.",
13+
"`calibre` also resolves issues related to unregistered URL protocol handlers and residual file associations after uninstallation.",
14+
"This manifest will be deprecated on 2026-12-01. Please install `extras/calibre` instead."
15+
],
716
"architecture": {
817
"64bit": {
918
"url": "https://download.calibre-ebook.com/8.16.2/calibre-64bit-8.16.2.msi",

bucket/calibre.json

Lines changed: 79 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,85 @@
11
{
22
"version": "8.16.2",
3-
"description": "Powerful and easy to use e-book manager",
3+
"description": "Powerful and easy to use e-book manager.",
44
"homepage": "https://calibre-ebook.com",
55
"license": {
6-
"identifier": "GPL-3.0-only",
7-
"url": "https://github.com/kovidgoyal/calibre/blob/master/LICENSE"
6+
"identifier": "GPL-3.0-or-later",
7+
"url": "https://github.com/kovidgoyal/calibre/blob/HEAD/LICENSE"
88
},
9+
"notes": [
10+
"To register the URL protocol handler, please execute the following command:",
11+
"- `reg import \"$dir\\register-url-handler.reg\"`"
12+
],
913
"architecture": {
1014
"64bit": {
11-
"url": "https://download.calibre-ebook.com/8.16.2/calibre-portable-installer-8.16.2.exe",
12-
"hash": "sha512:010ee58b53ecb9c208f7229b73e86c1b98a67e3b3ee7691a1e19c277fd34c0d434acbe367aab9389ad916b4d373adf34eb07a9ec35f14b1b3e69fa982de83073"
15+
"url": "https://download.calibre-ebook.com/8.16.2/calibre-64bit-8.16.2.msi#/dl.msi_",
16+
"hash": "sha512:e028a251b382dc91f34f7979cece2c48e65fb03c7d75a51d83afa37ce416d87c724f83d68e709cbe71c632dd5323925ddd553dba482282e200ce5c1b9327ad93"
1317
}
1418
},
19+
"pre_install": [
20+
"@('.tmp', '.cache', 'Calibre Settings').ForEach({ ensure \"$persist_dir\\$_\" | Out-Null })",
21+
"if ((Test-Path \"$persist_dir\\Calibre Settings\\*\") `",
22+
" -or ($env:CALIBRE_CONFIG_DIRECTORY -eq \"$persist_dir\\Calibre Settings\")) { return }",
23+
"if ($null -ne $env:CALIBRE_CONFIG_DIRECTORY -and (Test-Path \"$env:CALIBRE_CONFIG_DIRECTORY\\*\")) {",
24+
" Write-Host \"`nINFO Migrating Calibre Configurations to \"$persist_dir\\Calibre Settings\"...\" -ForegroundColor darkgray",
25+
" Copy-Item -Path \"$env:CALIBRE_CONFIG_DIRECTORY\\*\" -Destination \"$persist_dir\\Calibre Settings\" -Force -Recurse",
26+
" return",
27+
"}",
28+
"if (Test-Path \"$env:APPDATA\\calibre\\*\") {",
29+
" Write-Host \"`nINFO Migrating Calibre Configurations to \"$persist_dir\\Calibre Settings\"...\" -ForegroundColor darkgray",
30+
" Copy-Item -Path \"$env:APPDATA\\calibre\\*\" -Destination \"$persist_dir\\Calibre Settings\" -Force -Recurse",
31+
"}"
32+
],
1533
"installer": {
1634
"script": [
17-
"Start-Process -FilePath \"$dir\\$fname\" -ArgumentList @($env:PUBLIC) -Wait",
18-
"Move-Item -Path \"$env:PUBLIC\\Calibre Portable\\*\" -Destination $dir -Force",
19-
"Remove-Item -Path \"$dir\\$fname\", \"$env:PUBLIC\\Calibre Portable\" -Recurse -Force -ErrorAction SilentlyContinue",
20-
"Icacls $dir /t /c /reset | Out-Null"
35+
"$default_dir = \"$env:APPDATA\\calibre\"",
36+
"$ErrorActionPreference = 'SilentlyContinue'",
37+
"$configuration_dir = \"$persist_dir\\Calibre Settings\"",
38+
"$config_link_target_dir = (Get-Item -Path $default_dir).Target",
39+
"$is_different = $config_link_target_dir -ne $configuration_dir",
40+
"$link_target_dir = @($config_link_target_dir) * $is_different",
41+
"$is_different = $env:CALIBRE_CONFIG_DIRECTORY -ne $configuration_dir",
42+
"$extra_config_dir = @($env:CALIBRE_CONFIG_DIRECTORY) * $is_different",
43+
"@($default_dir) + $link_target_dir + $extra_config_dir | Remove-Item -Force -Recurse",
44+
"Expand-MsiArchive -Path \"$dir\\$fname\" -DestinationPath \"$dir\\Calibre\" -ExtractDir 'PFiles64\\Calibre2' -Removal"
2145
]
2246
},
47+
"post_install": [
48+
"$calibre_path = (Join-Path -Path $dir -ChildPath 'Calibre') -replace '\\\\', '\\\\'",
49+
"Get-ChildItem -Path \"$bucketsdir\\extras\\scripts\\$app\" -Filter '*.reg' -File | ForEach-Object {",
50+
" $content = Get-Content -Path $_.FullName -Encoding utf8",
51+
" if ($_.Name -ne 'unregister-file-associations.reg' `",
52+
" -and $global) { $content = $content -replace 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE' }",
53+
" $content -replace '{{calibre_dir}}', $calibre_path | Set-Content -Path \"$dir\\$($_.Name)\" -Encoding utf8",
54+
"}",
55+
"if (-not (Test-Path \"$persist_dir\\Calibre Settings\\global.py.json\")) {",
56+
" New-Item -Path \"$persist_dir\\Calibre Settings\\global.py.json\" -ItemType File -Force | Out-Null",
57+
" $cfg = @{ 'library_path'= \"$persist_dir\\Calibre Library\" } | ConvertTo-Json",
58+
" Set-Content -Path \"$persist_dir\\Calibre Settings\\global.py.json\" -Value $cfg -Encoding utf8",
59+
"} else {",
60+
" $cfg = Get-Content -Path \"$persist_dir\\Calibre Settings\\global.py.json\" -Encoding utf8 | ConvertFrom-Json",
61+
" if ($cfg.library_path -eq \"$persist_dir\\Calibre Library\") { return }",
62+
" if (-not (Test-Path \"$persist_dir\\Calibre Library\\*\") -and (Test-Path \"$($cfg.library_path)\\*\")) {",
63+
" Write-Host \"`nINFO Migrating Calibre Library to \"$persist_dir\\Calibre Library\"...\" -ForegroundColor darkgray",
64+
" Copy-Item -Path \"$($cfg.library_path)\\*\" -Destination \"$persist_dir\\Calibre Library\" -Force -Recurse",
65+
" }",
66+
" Remove-Item -Path $cfg.library_path -Force -Recurse -ErrorAction SilentlyContinue",
67+
" $cfg.library_path = \"$persist_dir\\Calibre Library\"",
68+
" $cfg | ConvertTo-Json | Set-Content -Path \"$persist_dir\\Calibre Settings\\global.py.json\" -Encoding utf8",
69+
"}"
70+
],
71+
"env_set": {
72+
"CALIBRE_TEMP_DIR": "$persist_dir\\.tmp",
73+
"CALIBRE_CACHE_DIRECTORY": "$persist_dir\\.cache",
74+
"CALIBRE_CONFIG_DIRECTORY": "$persist_dir\\Calibre Settings"
75+
},
2376
"bin": [
24-
[
25-
"calibre-portable.exe",
26-
"calibre"
27-
],
28-
"calibre-portable.exe",
29-
"Calibre\\calibre-complete.exe",
77+
"Calibre\\calibre.exe",
3078
"Calibre\\calibre-customize.exe",
31-
"Calibre\\calibredb.exe",
3279
"Calibre\\calibre-debug.exe",
33-
"Calibre\\calibre-parallel.exe",
3480
"Calibre\\calibre-server.exe",
3581
"Calibre\\calibre-smtp.exe",
82+
"Calibre\\calibredb.exe",
3683
"Calibre\\ebook-convert.exe",
3784
"Calibre\\ebook-device.exe",
3885
"Calibre\\ebook-edit.exe",
@@ -41,40 +88,48 @@
4188
"Calibre\\ebook-viewer.exe",
4289
"Calibre\\fetch-ebook-metadata.exe",
4390
"Calibre\\lrf2lrs.exe",
44-
"Calibre\\lrs2lrf.exe",
4591
"Calibre\\lrfviewer.exe",
92+
"Calibre\\lrs2lrf.exe",
4693
"Calibre\\markdown-calibre.exe",
4794
"Calibre\\web2disk.exe"
4895
],
4996
"shortcuts": [
5097
[
51-
"calibre-portable.exe",
52-
"Calibre"
98+
"Calibre\\calibre.exe",
99+
"Calibre - E-book Management\\Calibre - E-book Management"
53100
],
54101
[
55102
"Calibre\\ebook-edit.exe",
56-
"Calibre E-Book Editor"
103+
"Calibre - E-book Management\\E-Book Editor"
57104
],
58105
[
59106
"Calibre\\ebook-viewer.exe",
60-
"Calibre E-Book Viewer"
107+
"Calibre - E-book Management\\E-Book Viewer"
61108
],
62109
[
63110
"Calibre\\lrfviewer.exe",
64-
"Calibre LRF Viewer"
111+
"Calibre - E-book Management\\LRF Viewer"
65112
]
66113
],
67114
"persist": [
68115
"Calibre Library",
69116
"Calibre Settings"
70117
],
118+
"uninstaller": {
119+
"script": [
120+
"if ($cmd -eq 'uninstall') {",
121+
" reg import \"$dir\\unregister-url-handler.reg\"",
122+
" reg import \"$dir\\unregister-file-associations.reg\"",
123+
"}"
124+
]
125+
},
71126
"checkver": {
72127
"github": "https://github.com/kovidgoyal/calibre"
73128
},
74129
"autoupdate": {
75130
"architecture": {
76131
"64bit": {
77-
"url": "https://download.calibre-ebook.com/$version/calibre-portable-installer-$version.exe",
132+
"url": "https://download.calibre-ebook.com/$version/calibre-64bit-$version.msi#/dl.msi_",
78133
"hash": {
79134
"url": "https://calibre-ebook.com/signatures/$basename.sha512"
80135
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Windows Registry Editor Version 5.00
2+
3+
[HKEY_CURRENT_USER\SOFTWARE\Classes\calibre]
4+
@="URL:calibre Protocol"
5+
"URL Protocol"=""
6+
7+
[HKEY_CURRENT_USER\SOFTWARE\Classes\calibre\DefaultIcon]
8+
@="{{calibre_dir}}\\calibre.exe"
9+
10+
[HKEY_CURRENT_USER\SOFTWARE\Classes\calibre\shell]
11+
12+
[HKEY_CURRENT_USER\SOFTWARE\Classes\calibre\shell\open]
13+
14+
[HKEY_CURRENT_USER\SOFTWARE\Classes\calibre\shell\open\command]
15+
@="\"{{calibre_dir}}\\calibre.exe\" \"%1\""

0 commit comments

Comments
 (0)