Skip to content

Commit 17fcb2e

Browse files
committed
fix(install): improve force install
1 parent 0d2d7c7 commit 17fcb2e

3 files changed

Lines changed: 21 additions & 12 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ Soar comes as a single-file, statically-linked executable with no dependencies t
5858
Soar comes with [sane defaults](https://soar.qaidvoid.dev/configuration.html) & [all repositories](https://docs.pkgforge.dev/repositories/) preconfigured at `~/.config/soar/config.toml`<br>
5959
For additional configuration guide, click [here](https://soar.qaidvoid.dev/configuration.html)
6060
> [!NOTE]
61-
> [External repositories](https://docs.pkgforge.dev/repositories/external) aren't enabled enabled by default.
62-
> Enable them with `soar defconfig --external`
61+
> Soar provides [External repositories](https://docs.pkgforge.dev/repositories/external), which aren't enabled by default.
62+
> Enable them with `soar defconfig --external` if you haven't created configuration file yet. Or, add them manually using metadata from [here](https://meta.pkgforge.dev/external/).
6363
6464
## 🎯 Usage
6565

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ main() {
9090
echo "Downloading Soar..."
9191
case "$SOAR_VERSION" in
9292
*nightly*)
93-
RELEASE_URL="https://github.com/pkgforge/soar/releases/download/nightly/soar-nightly-$ARCH-linux"
93+
RELEASE_URL="https://github.com/pkgforge/soar/releases/download/nightly/soar-$ARCH-linux"
9494
;;
9595
*latest*)
9696
RELEASE_URL="https://github.com/pkgforge/soar/releases/latest/download/soar-$ARCH-linux"

soar-core/src/package/install.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ impl PackageInstaller {
6868
let mut stmt = prepare_and_bind!(
6969
conn,
7070
"INSERT INTO packages (
71-
repo_name, pkg, pkg_id, pkg_name, pkg_type, version, size,
72-
installed_path, installed_date, with_pkg_id, profile
73-
)
74-
VALUES
75-
(
76-
$repo_name, $pkg, $pkg_id, $pkg_name, $pkg_type, $version, $size,
77-
$installed_path, datetime(), $with_pkg_id, $profile
78-
)"
71+
repo_name, pkg, pkg_id, pkg_name, pkg_type, version, size,
72+
installed_path, installed_date, with_pkg_id, profile
73+
)
74+
VALUES
75+
(
76+
$repo_name, $pkg, $pkg_id, $pkg_name, $pkg_type, $version, $size,
77+
$installed_path, datetime(), $with_pkg_id, $profile
78+
)"
7979
);
8080
stmt.raw_execute()?;
8181
}
@@ -183,9 +183,12 @@ impl PackageInstaller {
183183
pkg_name,
184184
pkg_id,
185185
version,
186+
ghcr_size,
187+
size,
186188
..
187189
} = package;
188190
let provides = serde_json::to_string(&package.provides).unwrap();
191+
let size = ghcr_size.unwrap_or(size.unwrap_or(0));
189192

190193
let with_pkg_id = self.with_pkg_id;
191194
let tx = conn.transaction()?;
@@ -195,6 +198,8 @@ impl PackageInstaller {
195198
tx,
196199
"UPDATE packages
197200
SET
201+
version = $version,
202+
size = $size,
198203
bin_path = $bin_path,
199204
icon_path = $icon_path,
200205
desktop_path = $desktop_path,
@@ -207,7 +212,11 @@ impl PackageInstaller {
207212
repo_name = $repo_name
208213
AND pkg_name = $pkg_name
209214
AND pkg_id = $pkg_id
210-
AND version = $version
215+
AND (
216+
pinned = false
217+
OR
218+
version = $version
219+
)
211220
"
212221
);
213222
stmt.raw_execute()?;

0 commit comments

Comments
 (0)