Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
40b9267bbf
|
|||
|
d771e6fc48
|
|||
|
c4b3f1fe3f
|
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "shy-launcher"
|
name = "shy-launcher"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
@@ -1,2 +1,30 @@
|
|||||||
# shy-launcher
|
# shy-launcher
|
||||||
Utility for launching apps for Linux.
|
|
||||||
|
**shy-launcher** is an utility for downloading assets and launching applications on Linux.
|
||||||
|
|
||||||
|
## What can it do?
|
||||||
|
It can:
|
||||||
|
- Download assets over HTTP/S before the program starts
|
||||||
|
- Verify that you have the latest version of your files/program/plugins
|
||||||
|
- Change permissions for executable downloads
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Below is an example `config.json`; adapt it to your needs:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "My Java server",
|
||||||
|
"run": "java",
|
||||||
|
"args": ["-jar", "server.jar"],
|
||||||
|
"downloads": [{
|
||||||
|
"method": "GET",
|
||||||
|
"url": "https://some.asset.server.shiewk.de/coolserver/latest/server.jar",
|
||||||
|
"headers": {
|
||||||
|
"Authorization": "Bearer tOk3n"
|
||||||
|
},
|
||||||
|
"filename": "server.jar",
|
||||||
|
"permissions": 700
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
```
|
||||||
+10
-1
@@ -1,4 +1,4 @@
|
|||||||
use std::{error::Error, process::Command};
|
use std::{error::Error, fs, process::Command};
|
||||||
|
|
||||||
use shy_launcher::{config::Config, downloader};
|
use shy_launcher::{config::Config, downloader};
|
||||||
|
|
||||||
@@ -10,6 +10,15 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
println!("Starting download...");
|
println!("Starting download...");
|
||||||
downloader::download(config.downloads()).await;
|
downloader::download(config.downloads()).await;
|
||||||
|
|
||||||
|
println!("Verifying file presence...");
|
||||||
|
for download in config.downloads() {
|
||||||
|
let filename = download.filename();
|
||||||
|
if !fs::exists(filename)? {
|
||||||
|
panic!("Required file {} not present", filename);
|
||||||
|
}
|
||||||
|
println!("[ok] {}", filename);
|
||||||
|
}
|
||||||
|
|
||||||
println!("Freeing memory...");
|
println!("Freeing memory...");
|
||||||
if unsafe { libc::malloc_trim(0) } == 1 {
|
if unsafe { libc::malloc_trim(0) } == 1 {
|
||||||
println!("Freed up some memory.");
|
println!("Freed up some memory.");
|
||||||
|
|||||||
Reference in New Issue
Block a user