log to info as default to prevent too large file size

This commit is contained in:
Cyrix126 2024-05-18 12:17:13 +02:00
commit 154bbad6be
45 changed files with 3697 additions and 9566 deletions

View file

@ -54,12 +54,22 @@ jobs:
cargo bundle --release --target aarch64-apple-darwin cargo bundle --release --target aarch64-apple-darwin
mv target/release/bundle/osx/Gupaxx.app Gupaxx-macos-x64.app mv target/release/bundle/osx/Gupaxx.app Gupaxx-macos-x64.app
mv target/aarch64-apple-darwin/release/bundle/osx/Gupaxx.app Gupaxx-macos-arm64.app mv target/aarch64-apple-darwin/release/bundle/osx/Gupaxx.app Gupaxx-macos-arm64.app
tar -cf macos.tar Gupaxx-macos-arm64.app Gupaxx-macos-x64.app cargo bundle --release --features=bundle
cargo bundle --release --target aarch64-apple-darwin --features=bundle
mv target/release/bundle/osx/Gupaxx.app Gupaxx-macos-x64.app_b
mv target/aarch64-apple-darwin/release/bundle/osx/Gupaxx.app Gupaxx-macos-arm64.app_b
tar -cf macos.tar Gupaxx-macos-arm64.app Gupaxx-macos-x64.app Gupaxx-macos-arm64.app_b Gupaxx-macos-x64.app_b
elif [ "$RUNNER_OS" == "Linux" ]; then elif [ "$RUNNER_OS" == "Linux" ]; then
cargo build --release --target x86_64-unknown-linux-gnu cargo build --release --target x86_64-unknown-linux-gnu
mv target/x86_64-unknown-linux-gnu/release/gupaxx . mv target/x86_64-unknown-linux-gnu/release/gupaxx .
tar -cf linux.tar gupaxx cargo build --release --target x86_64-unknown-linux-gnu --features=bundle
mv target/x86_64-unknown-linux-gnu/release/gupaxx gupaxx_b
tar -cf linux.tar gupaxx gupaxx_b
cargo build --release --target x86_64-pc-windows-gnu cargo build --release --target x86_64-pc-windows-gnu
mv target/x86_64-pc-windows-gnu/release/gupaxx.exe .
cargo build --release --target x86_64-pc-windows-gnu --features=bundle
mv target/x86_64-pc-windows-gnu/release/gupaxx.exe gupaxx_b.exe
tar -cf windows.tar gupaxx.exe gupaxx_b.exe
fi fi
shell: bash shell: bash
@ -68,7 +78,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: windows name: windows
path: target/x86_64-pc-windows-gnu/release/gupaxx.exe path: windows.tar
- name: Archive - name: Archive
if: ${{ runner.os == 'macOS' }} if: ${{ runner.os == 'macOS' }}

View file

@ -29,3 +29,14 @@ Status of process for Xmrig use for some information an image of data when the p
The node of xmrig in upstream can not change without a restart of the process.In this fork, the node used by xmrig needs to be updated without restart (using the config HTTP API of xmrig). The node of xmrig in upstream can not change without a restart of the process.In this fork, the node used by xmrig needs to be updated without restart (using the config HTTP API of xmrig).
So Gupaxx need to refresh the value of status tab submenu process for xmrig where before the values could not change without a restart of the process. So Gupaxx need to refresh the value of status tab submenu process for xmrig where before the values could not change without a restart of the process.
The field node from ImgXmrig needs to be moved to PubXvbApi. This value must be updated by xmrig at start and by XvB process at runtime. The field node from ImgXmrig needs to be moved to PubXvbApi. This value must be updated by xmrig at start and by XvB process at runtime.
## Updates
A new option in Gupaxx tab advanced will enable bundled updates.
The binary included of gupaxx will have default value for bundled updates depending if it is coming from standalone or bundle release.
Updates from Gupaxx will do the following differently from upstream:
- check if using bundled or standalone with state. Update only Gupaxx binary if the latter or xmrig and p2pool from bundle version if the former.
- prevent user to run updates twice without restart.
- ask the user to restart Gupaxx
- do not verify if file p2pool or xmrig exist. (so that the update can create them).

View file

@ -1,3 +1,35 @@
# v1.1.0
Stable release, bugfixes and new features.
## Changes
### UI
- Update xmrig and p2pool only if bundle button is checked.
- Default value for bundle button depends of bundle or standalone version.
- Ask user to restart Gupaxx after updating.
- Prevent user to update twice without restart.
### Internal
- Bump deps
- Update CI to produce different Gupaxx binary for standalone and bundle version.
- Update tools release to include different default value depending of standalone and bundle version.
- Use bundled XMRig and P2Pool of Gupaxx instead of upstream version.
- Update test
### Doc
- Update DIFFERENCES and ARCHITECTURE to reflect updates differences.
## Fixes
- fix temporary directories of updates not deleted introduced in fork
- fix https://github.com/Cyrix126/gupaxx/issues/3
- fix https://github.com/Cyrix126/gupaxx/issues/4
- fix https://github.com/Cyrix126/gupaxx/issues/5
## Notes
### Do not use built in updates to upgrade to this version
This update bump the 1.x.0 number, which would mean breaking changes. However, it is only because updating previously from Gupaxx (in =<1.0.0) without manually downloading from github release would upgrade P2Pool and XMRig from upstream, which is a behaviour that has been modified in this release.
No configuration file change is needed, just update from github for this release.
## Bundled Versions
* [`P2Pool v3.10`](https://github.com/SChernykh/p2pool/releases/tag/v3.10)
* [`XMRig v6.21.1`](https://github.com/xmrig/xmrig/releases/tag/v6.21.1)
# v1.0.0 # v1.0.0
Stable release Stable release

5927
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
# cargo-features = ["profile-rustflags"] # cargo-features = ["profile-rustflags"]
[package] [package]
name = "gupaxx" name = "gupaxx"
version = "1.0.0" version = "1.1.0"
authors = ["cyrix126 <gupaxx@baermail.fr>"] authors = ["cyrix126 <gupaxx@baermail.fr>"]
description = "Fork of Gupax integrating the XMRvsBeast Raffle " description = "Fork of Gupax integrating the XMRvsBeast Raffle "
documentation = "https://github.com/cyrix126/gupaxx" documentation = "https://github.com/cyrix126/gupaxx"
@ -25,10 +25,11 @@ incremental = true
[features] [features]
default = [] default = []
bundle = []
distro = [] distro = []
[dependencies] [dependencies]
anyhow = "1.0.81" anyhow = "1.0.85"
benri = "0.1.12" benri = "0.1.12"
bytes = "1.6.0" bytes = "1.6.0"
dirs = "5.0.1" dirs = "5.0.1"
@ -48,8 +49,8 @@ egui_extras = { version = "0.27.2", features = ["image"] }
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------
flexi_logger = "0.28.0" flexi_logger = "0.28.0"
env_logger = "0.11.3" env_logger = "0.11.3"
figment = { version = "0.10.15", features = ["toml"] } figment = { version = "0.10.19", features = ["toml"] }
reqwest = {version = "0.12.3", default-features=false, features=["json", "rustls-tls"]} reqwest = {version = "0.12.4", default-features=false, features=["json", "rustls-tls"]}
image = { version = "0.25.1", features = ["png"] } image = { version = "0.25.1", features = ["png"] }
log = "0.4.21" log = "0.4.21"
num-format = { version = "0.4.4", default-features = false } num-format = { version = "0.4.4", default-features = false }
@ -58,12 +59,12 @@ portable-pty = "0.8.1"
rand = "0.8.5" rand = "0.8.5"
regex = { version = "1.10.4", default-features = false, features = ["perf"] } regex = { version = "1.10.4", default-features = false, features = ["perf"] }
rfd = "0.14.1" rfd = "0.14.1"
serde = { version = "1.0.197", features = ["rc", "derive"] } serde = { version = "1.0.202", features = ["rc", "derive"] }
serde_json = "1.0.115" serde_json = "1.0.117"
sysinfo = { version = "0.30.8", default-features = false } sysinfo = { version = "0.30.12", default-features = false }
# tls-api = "0.9.0" # tls-api = "0.9.0"
tokio = { version = "1.37.0", features = ["rt", "time", "macros", "process", "rt-multi-thread"] } tokio = { version = "1.37.0", features = ["rt", "time", "macros", "process", "rt-multi-thread"] }
toml = { version = "0.8.12", features = ["preserve_order"] } toml = { version = "0.8.13", features = ["preserve_order"] }
walkdir = "2.5.0" walkdir = "2.5.0"
zeroize = "1.7.0" zeroize = "1.7.0"
strsim = "0.11.1" strsim = "0.11.1"
@ -71,9 +72,10 @@ strip-ansi-escapes = "0.2.0"
derive_more = {version="0.99.17", default-features=false, features=["display"]} derive_more = {version="0.99.17", default-features=false, features=["display"]}
serde-this-or-that = "0.4.2" serde-this-or-that = "0.4.2"
readable = "0.16" readable = "0.16"
chrono = {version="0.4.37", default-features=false, features=["clock", "std"]} chrono = {version="0.4.38", default-features=false, features=["clock", "std"]}
enclose = "1.1.8" enclose = "1.1.8"
bounded-vec-deque = {version="0.1.1", default-features=false} bounded-vec-deque = {version="0.1.1", default-features=false}
cfg-if = "1.0"
# Unix dependencies # Unix dependencies
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
eframe = { version = "0.27.2", features = ["wgpu"] } eframe = { version = "0.27.2", features = ["wgpu"] }
@ -94,7 +96,7 @@ eframe = { version = "0.27.2", features = ["wgpu"] }
# openssl = { version = "0.10", features = ["vendored"] } # openssl = { version = "0.10", features = ["vendored"] }
# We don't even use `xz` in `flate2` but this gets dynamically # We don't even use `xz` in `flate2` but this gets dynamically
# linked as well which causes problems, so statically link it. # linked as well which causes problems, so statically link it.
lzma-sys = { version = "0.1.20", features = ["static"] } lzma-sys = { version = "0.1", features = ["static"] }
[dev-dependencies] [dev-dependencies]
egui = {version = "0.27.2", features=["callstack"]} egui = {version = "0.27.2", features=["callstack"]}
@ -104,8 +106,11 @@ egui = {version = "0.27.2", features=["callstack"]}
# Windows dependencies # Windows dependencies
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
# glow start on windows but not wgpu # glow start on windows but not wgpu
eframe = { version = "0.27.2", features = ["glow"] } eframe = { version = "0.27.2", features = ["wgpu"] }
zip = "0.6.6" # need the same version that eframe is using with egui_wgpu
# feature angle to enable support for old cpu on Windows
wgpu = {version = "0.19.4", features=["angle"]}
zip = "1.3.0"
is_elevated = "0.1.2" is_elevated = "0.1.2"
# For Windows build (icon) # For Windows build (icon)

View file

@ -23,6 +23,10 @@ The rendering of Tabs has been modified so that the minimum stated size of the w
The rendering of the benchmark table and of console outputs were calculating every line at the same time. Now it only renders what you see. It is a significant improvement for your processor, and you can feel the difference if it is not very powerful. The rendering of the benchmark table and of console outputs were calculating every line at the same time. Now it only renders what you see. It is a significant improvement for your processor, and you can feel the difference if it is not very powerful.
Updates from Gupaxx does not retrieve xmrig and p2pool from upstream anymore, but use versions in the bundled version. This modification prevent bad surprise (see #3).
It also allows advanced users to use your their own version of p2pool and xmrig.The standalone version of Gupaxx will not replace them.
## Security ## Security
With the upgrade of dependencies, cargo audit show no warnings instead of 5 vulnerabilities and 4 allowed warnings for Gupax. With the upgrade of dependencies, cargo audit show no warnings instead of 5 vulnerabilities and 4 allowed warnings for Gupax.

68
IDEAS.md Normal file
View file

@ -0,0 +1,68 @@
# IDEAS for the future of Gupaxx
**Theses are only ideas, everything here is still to be decided and only thoughts for now.**
Some ideas could be done in a matter of hours, some could take months.
## More Decentralized
### Integrate a Monero Node
If we want Gupaxx to help user mine in the most decentralized way, we should offer them to run a monero node.
This would be optional and would check if the requirement are fulfilled before enabling the button to do so.
### Synchronize source code repository on p2p network
Github is proprietary. If Gupaxx aims to be free, it should not be only available on this platform and we should explore options to get github free.
We can use [Radicle](https://radicle.xyz/) to get Gupaxx on a p2p collaboration stack.
The code, issues and PR could be synchronized with Github.
## More User friendly
### Website
Build a website like [gupax.io](https://gupax.io) to have a more user frendly presentation and installation method.
Having a website, we can detect the architecture and os of the visitor and give him the right archive to download.
### Generated wallet
If Gupaxx could create a wallet and put the primary address in p2pool tab automaticcly, it would remove a manual step for the user.
It could be an option to ask at first start.
The user could access this wallet on the same computer with the official GUI wallet.
### Auto register to XvB
If Gupaxx could register the user automaticcly to the raffle, it would remove a manual step for the user.
It could be an option to ask at first start.
### Setup Guide
At first start, a guide could ask the user what it intends to do with Gupaxx (create node, create wallet, use xmrig-proxy, participate in raffle...) and do the setup for him and show him what it must do manually. An option to skip this guide would be present for advanced users.
## Supporting more environnements
### Packaging
Add repository/AUR for Gupaxx and a status of packaging distro/version on the README
### Minimum requirement
Add on README a table with minimum hardware/software requirements.
### Add more target
Gupaxx could add support for linux arm64 since p2pool and xmrig can compile on this target.
## More Powerful
### Optimization for xmrig
#### Add automatic options
On linux, we can activate 1GB pages after detecting cpu flags. We can also add cpu affinity option.
#### Manual optimizations
On the XMRig tab, inform users about manual optimizations that Gupaxx can't control. For example, disabling hyper-threading in BIOS is recommended.
### CLI for Algorithm
For advanced users, a CLI could be made to use the algorithm without a GUI
It would allow the user to do automation and installation on headless environment and save a few HR from the Gupaxx process.
This CLI would still offer a way to the user to pass options to xmrig and to start his p2pool server or to use another one already running.
#### Integrate XMRig-Proxy
The algorithm of distribution of HR can't control HR outside of his instance.
It must estimate external HR, which can be approximative.
If a user control multiples miners, it could connect all of them to a xmrig-proxy instance.
Gupaxx could offer this xmrig-instance and control it like it was a normal xmrig instance.
OR
#### Watch Stratum Data instead of estimate.
Right now, the algorithm estimate the eHR with the estimation made by the p2pool instance which is calculating from passed shares.
The algorithm could instead watch the stats from the stratum server, which is exact but would take into account only miners which are pointed to it.
Miners using the cli xmrig could point their miners to the p2pool instance of Gupaxx, or have an indentical option if they are using the CLI of the algorithm.
The algorithm would still check the estimation made by the p2pool instane of Gupaxx and warn the user if it seems there is too much difference between the data of the stratum server and the one of p2pool. It could prevent the user to forget to configure a miner to the stratum p2pool.
## Trust-less
### Reproducible builds
To remove necessary trust, binairies released should have the same checksum if recompiled without code change.
See [this](https://reproducible-builds.org).
### Release changes notes preview
Show the summuray of what will change between releases before updating to newer release.
### Donation transparency
So that user can see how much is given to this project and make their own opinion of if enough donations have been given or not, the history of donation should be made visible with the viewkey available.

View file

@ -8,6 +8,12 @@ This fork has a stable release. It is intended for end users and offers a friend
Gupaxx is a fork of [**Gupax**](https://github.com/hinto-janai/gupax) integrating the [XMRvsBeast Raffle](https://xmrvsbeast.com), it is also a maintained software. It is made to make in the most easy way possible mining on P2Pool while optionally participating (but you will want to :wink:) in the XMRvsBeast raffle. Gupaxx is a fork of [**Gupax**](https://github.com/hinto-janai/gupax) integrating the [XMRvsBeast Raffle](https://xmrvsbeast.com), it is also a maintained software. It is made to make in the most easy way possible mining on P2Pool while optionally participating (but you will want to :wink:) in the XMRvsBeast raffle.
## System requirements
Gupax may not run on machines with:
- a deprecated OS (Windows 7, Ubuntu 18.04, etc)
- CPU whithout support for OpenGL 3.1 (<2010)
[![CI](https://github.com/cyrix126/gupaxx/actions/workflows/ci.yml/badge.svg)](https://github.com/cyrix126/gupaxx/actions/workflows/ci.yml) [![CI](https://github.com/cyrix126/gupaxx/actions/workflows/ci.yml/badge.svg)](https://github.com/cyrix126/gupaxx/actions/workflows/ci.yml)
## Contents ## Contents

View file

@ -54,7 +54,7 @@
- [x] adapt README for XvB - [x] adapt README for XvB
- [x] beta release - [x] beta release
- [x] stable release - [x] stable release
- [ ] video tutorial to set up XvB Tab - [x] video tutorial to set up XvB Tab
- [x] adapt doc for new code - [x] adapt doc for new code
- [x] cargo package metadata - [x] cargo package metadata
- [x] pgp signatures - [x] pgp signatures

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
[toolchain] [toolchain]
channel = "stable" channel = "nightly-2024-04-08"
components = [ "rustfmt", "rustc-dev", "cargo", "clippy", "rust-analyzer"] components = [ "rustfmt", "rustc-dev", "cargo", "clippy", "rustc-codegen-cranelift-preview", "rust-analyzer"]
target = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin","x86_64-pc-windows-gnu"] target = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin","x86_64-pc-windows-gnu"]

View file

@ -60,6 +60,7 @@ pub mod resize;
// The state of the outer main [App]. // The state of the outer main [App].
// See the [State] struct in [state.rs] for the // See the [State] struct in [state.rs] for the
// actual inner state of the tab settings. // actual inner state of the tab settings.
#[allow(dead_code)]
pub struct App { pub struct App {
// Misc state // Misc state
pub tab: Tab, // What tab are we on? pub tab: Tab, // What tab are we on?

View file

@ -49,7 +49,7 @@ impl Gupax {
ui.add_sized([width, button], Button::new("Updates are disabled")) ui.add_sized([width, button], Button::new("Updates are disabled"))
.on_disabled_hover_text(DISTRO_NO_UPDATE); .on_disabled_hover_text(DISTRO_NO_UPDATE);
#[cfg(not(feature = "distro"))] #[cfg(not(feature = "distro"))]
ui.set_enabled(!updating); ui.set_enabled(!updating && *lock!(restart) == Restart::No);
#[cfg(not(feature = "distro"))] #[cfg(not(feature = "distro"))]
if ui if ui
.add_sized([width, button], Button::new("Check for updates")) .add_sized([width, button], Button::new("Check for updates"))
@ -78,7 +78,7 @@ impl Gupax {
debug!("Gupaxx Tab | Rendering bool buttons"); debug!("Gupaxx Tab | Rendering bool buttons");
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.group(|ui| { ui.group(|ui| {
let width = (size.x - SPACE * 12.0) / 6.0; let width = (size.x - SPACE * 15.0) / 7.0;
let height = if self.simple { let height = if self.simple {
size.y / 10.0 size.y / 10.0
} else { } else {
@ -89,6 +89,9 @@ impl Gupax {
ui.add_sized(size, Checkbox::new(&mut self.auto_update, "Auto-Update")) ui.add_sized(size, Checkbox::new(&mut self.auto_update, "Auto-Update"))
.on_hover_text(GUPAX_AUTO_UPDATE); .on_hover_text(GUPAX_AUTO_UPDATE);
ui.separator(); ui.separator();
ui.add_sized(size, Checkbox::new(&mut self.bundled, "Bundle"))
.on_hover_text(GUPAX_BUNDLED_UPDATE);
ui.separator();
ui.add_sized(size, Checkbox::new(&mut self.auto_p2pool, "Auto-P2Pool")) ui.add_sized(size, Checkbox::new(&mut self.auto_p2pool, "Auto-P2Pool"))
.on_hover_text(GUPAX_AUTO_P2POOL); .on_hover_text(GUPAX_AUTO_P2POOL);
ui.separator(); ui.separator();
@ -100,13 +103,13 @@ impl Gupax {
ui.separator(); ui.separator();
ui.add_sized( ui.add_sized(
size, size,
Checkbox::new(&mut self.ask_before_quit, "Ask before quit"), Checkbox::new(&mut self.ask_before_quit, "Confirm quit"),
) )
.on_hover_text(GUPAX_ASK_BEFORE_QUIT); .on_hover_text(GUPAX_ASK_BEFORE_QUIT);
ui.separator(); ui.separator();
ui.add_sized( ui.add_sized(
size, size,
Checkbox::new(&mut self.save_before_quit, "Save before quit"), Checkbox::new(&mut self.save_before_quit, "Save on quit"),
) )
.on_hover_text(GUPAX_SAVE_BEFORE_QUIT); .on_hover_text(GUPAX_SAVE_BEFORE_QUIT);
}); });

View file

@ -15,13 +15,12 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::components::update::Pkg; use crate::components::update::get_user_agent;
use crate::{constants::*, macros::*}; use crate::{constants::*, macros::*};
use egui::Color32; use egui::Color32;
use log::*; use log::*;
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
use reqwest::{Client, RequestBuilder}; use reqwest::{Client, RequestBuilder};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
@ -68,7 +67,7 @@ const REMOTE_NODE_MAX_CHARS: usize = {
assert!(len != 0); assert!(len != 0);
len len
}; };
#[allow(dead_code)]
pub struct RemoteNode { pub struct RemoteNode {
pub ip: &'static str, pub ip: &'static str,
pub location: &'static str, pub location: &'static str,
@ -279,6 +278,7 @@ impl NodeData {
// //
// This struct leaves out most fields on purpose, // This struct leaves out most fields on purpose,
// we only need a few to verify the node is ok. // we only need a few to verify the node is ok.
#[allow(dead_code)] // allow dead code because Deserialize doesn't use all the fields in this program
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize)]
pub struct GetInfo<'a> { pub struct GetInfo<'a> {
pub id: &'a str, pub id: &'a str,
@ -384,7 +384,7 @@ impl Ping {
let client = Client::new(); let client = Client::new();
// Random User Agent // Random User Agent
let rand_user_agent = Pkg::get_user_agent(); let rand_user_agent = get_user_agent();
// Handle vector // Handle vector
let mut handles = Vec::with_capacity(REMOTE_NODE_LENGTH); let mut handles = Vec::with_capacity(REMOTE_NODE_LENGTH);
let node_vec = arc_mut!(Vec::with_capacity(REMOTE_NODE_LENGTH)); let node_vec = arc_mut!(Vec::with_capacity(REMOTE_NODE_LENGTH));
@ -486,8 +486,7 @@ mod test {
use crate::components::node::{ use crate::components::node::{
format_ip, REMOTE_NODES, REMOTE_NODE_LENGTH, REMOTE_NODE_MAX_CHARS, format_ip, REMOTE_NODES, REMOTE_NODE_LENGTH, REMOTE_NODE_MAX_CHARS,
}; };
use crate::components::update::Pkg; use crate::components::update::get_user_agent;
#[test] #[test]
fn validate_node_ips() { fn validate_node_ips() {
for (ip, location, rpc, zmq) in REMOTE_NODES { for (ip, location, rpc, zmq) in REMOTE_NODES {
@ -524,7 +523,7 @@ mod test {
let client = Client::new(); let client = Client::new();
// Random User Agent // Random User Agent
let rand_user_agent = Pkg::get_user_agent(); let rand_user_agent = get_user_agent();
// Only fail this test if >50% of nodes fail. // Only fail this test if >50% of nodes fail.
const HALF_REMOTE_NODES: usize = REMOTE_NODE_LENGTH / 2; const HALF_REMOTE_NODES: usize = REMOTE_NODE_LENGTH / 2;

View file

@ -24,20 +24,15 @@
// b. auto-update at startup // b. auto-update at startup
//---------------------------------------------------------------------------------------------------- Imports //---------------------------------------------------------------------------------------------------- Imports
use crate::components::update::Name::*;
use crate::{ use crate::{
app::Restart, app::Restart,
constants::GUPAX_VERSION, constants::GUPAX_VERSION,
disk::{ disk::{state::State, *},
state::{State, Version},
*,
},
macros::*, macros::*,
miscs::get_exe_dir, miscs::get_exe_dir,
utils::errors::{ErrorButtons, ErrorFerris, ErrorState}, utils::errors::{ErrorButtons, ErrorFerris, ErrorState},
}; };
use anyhow::{anyhow, Error}; use anyhow::{anyhow, Error};
use bytes::Bytes;
use log::*; use log::*;
use rand::distributions::Alphanumeric; use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
@ -46,20 +41,8 @@ use reqwest::{Client, RequestBuilder};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use tokio::task::JoinHandle;
use walkdir::WalkDir; use walkdir::WalkDir;
// On apple-darwin targets there is an issue with the native and rustls
// tls implementation so this makes it fall back to the openssl variant.
//
// https://gitlab.torproject.org/tpo/core/arti/-/issues/715
// #[cfg(not(target_os = "macos"))]
// use tls_api_native_tls::TlsConnector;
// #[cfg(target_os = "macos")]
// use tls_api_openssl::TlsConnector;
// use tls_api::{TlsConnector as TlsConnectorTrait, TlsConnectorBuilder};
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
use zip::ZipArchive; use zip::ZipArchive;
//#[cfg(target_family = "unix")] //#[cfg(target_family = "unix")]
@ -68,114 +51,41 @@ use zip::ZipArchive;
//---------------------------------------------------------------------------------------------------- Constants //---------------------------------------------------------------------------------------------------- Constants
// Package naming schemes: // Package naming schemes:
// gupax | gupax-vX.X.X-(windows|macos|linux)-(x64|arm64)-(standalone|bundle).(zip|tar.gz) // gupax | gupax-vX.X.X-(windows|macos|linux)-(x64|arm64)-(standalone|bundle).(zip|tar.gz)
// p2pool | p2pool-vX.X.X-(windows|macos|linux)-(x64|aarch64).(zip|tar.gz)
// xmrig | xmrig-X.X.X-(msvc-win64|macos-x64|macos-arm64|linux-static-x64).(zip|tar.gz)
//
// Download link = PREFIX + Version (found at runtime) + SUFFIX + Version + EXT // Download link = PREFIX + Version (found at runtime) + SUFFIX + Version + EXT
// Example: https://github.com/hinto-janai/gupax/releases/download/v0.0.1/gupax-v0.0.1-linux-standalone-x64.tar.gz // Example: https://github.com/hinto-janai/gupax/releases/download/v0.0.1/gupax-v0.0.1-linux-standalone-x64.tar.gz
// //
// Exceptions (there are always exceptions...):
// - XMRig doesn't have a [v], so it is [xmrig-6.18.0-...]
// - XMRig separates the hash and signature
// - P2Pool hashes are in UPPERCASE
const GUPAX_METADATA: &str = "https://api.github.com/repos/Cyrix126/gupaxx/releases/latest"; const GUPAX_METADATA: &str = "https://api.github.com/repos/Cyrix126/gupaxx/releases/latest";
const P2POOL_METADATA: &str = "https://api.github.com/repos/SChernykh/p2pool/releases/latest";
const XMRIG_METADATA: &str = "https://api.github.com/repos/xmrig/xmrig/releases/latest";
const GUPAX_PREFIX: &str = "https://github.com/Cyrix126/gupaxx/releases/download/"; cfg_if::cfg_if! {
const P2POOL_PREFIX: &str = "https://github.com/SChernykh/p2pool/releases/download/"; if #[cfg(target_family = "unix")] {
const XMRIG_PREFIX: &str = "https://github.com/xmrig/xmrig/releases/download/"; pub(super) const GUPAX_BINARY: &str = "gupaxx";
pub(super) const P2POOL_BINARY: &str = "p2pool";
const GUPAX_SUFFIX: &str = "/gupaxx-"; pub(super) const XMRIG_BINARY: &str = "xmrig";
const P2POOL_SUFFIX: &str = "/p2pool-"; }
const XMRIG_SUFFIX: &str = "/xmrig-"; }
cfg_if::cfg_if! {
// const GUPAX_HASH: &str = "SHA256SUMS"; if #[cfg(target_os = "windows")] {
// const P2POOL_HASH: &str = "sha256sums.txt.asc"; pub(super) const OS_TARGET: &str = "windows";
// const XMRIG_HASH: &str = "SHA256SUMS"; pub(super) const ARCHIVE_EXT: &str = "zip";
#[cfg(target_os = "windows")]
mod impl_platform {
pub(super) const GUPAX_EXTENSION: &str = "-windows-x64-standalone.zip";
pub(super) const P2POOL_EXTENSION: &str = "-windows-x64.zip";
pub(super) const XMRIG_EXTENSION: &str = "-msvc-win64.zip";
pub(super) const GUPAX_BINARY: &str = "Gupaxx.exe"; pub(super) const GUPAX_BINARY: &str = "Gupaxx.exe";
pub(super) const P2POOL_BINARY: &str = "p2pool.exe"; pub(super) const P2POOL_BINARY: &str = "p2pool.exe";
pub(super) const XMRIG_BINARY: &str = "xmrig.exe"; pub(super) const XMRIG_BINARY: &str = "xmrig.exe";
pub(super) const VALID_GUPAX_1: &str = "GUPAXX.exe"; } else if #[cfg(target_os = "linux")] {
pub(super) const VALID_GUPAX_2: &str = "Gupaxx.exe"; pub(super) const OS_TARGET: &str = "linux";
pub(super) const VALID_GUPAX_3: &str = "gupaxx.exe"; pub(super) const ARCHIVE_EXT: &str = "tar.gz";
pub(super) const VALID_XMRIG_1: &str = "XMRIG.exe"; } else if #[cfg(target_os = "macos")] {
pub(super) const VALID_XMRIG_2: &str = "XMRig.exe"; pub(super) const OS_TARGET: &str = "macos";
pub(super) const VALID_XMRIG_3: &str = "Xmrig.exe"; pub(super) const ARCHIVE_EXT: &str = "tar.gz";
pub(super) const VALID_XMRIG_4: &str = "xmrig.exe"; }
pub(super) const VALID_P2POOL_1: &str = "P2POOL.exe";
pub(super) const VALID_P2POOL_2: &str = "P2Pool.exe";
pub(super) const VALID_P2POOL_3: &str = "P2pool.exe";
pub(super) const VALID_P2POOL_4: &str = "p2pool.exe";
} }
#[cfg(target_family = "unix")]
mod impl_unix {
pub(super) const GUPAX_BINARY: &str = "gupaxx";
// pub(super) const P2POOL_BINARY: &str = "p2pool";
// pub(super) const XMRIG_BINARY: &str = "xmrig";
pub(super) const VALID_GUPAX_1: &str = "GUPAXX";
pub(super) const VALID_GUPAX_2: &str = "Gupaxx";
pub(super) const VALID_GUPAX_3: &str = "gupaxx";
pub(super) const VALID_XMRIG_1: &str = "XMRIG";
pub(super) const VALID_XMRIG_2: &str = "XMRig";
pub(super) const VALID_XMRIG_3: &str = "Xmrig";
pub(super) const VALID_XMRIG_4: &str = "xmrig";
pub(super) const VALID_P2POOL_1: &str = "P2POOL";
pub(super) const VALID_P2POOL_2: &str = "P2Pool";
pub(super) const VALID_P2POOL_3: &str = "P2pool";
pub(super) const VALID_P2POOL_4: &str = "p2pool";
}
#[cfg(target_os = "macos")]
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
mod impl_platform { pub(super) const ARCH_TARGET: &str = "x64";
pub(super) use super::impl_unix::*;
pub(super) const GUPAX_EXTENSION: &str = "-macos-x64-standalone.tar.gz";
pub(super) const P2POOL_EXTENSION: &str = "-macos-x64.tar.gz";
pub(super) const XMRIG_EXTENSION: &str = "-macos-x64.tar.gz";
}
#[cfg(target_os = "macos")]
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
mod impl_platform { pub(super) const ARCH_TARGET: &str = "arm64";
pub(super) use super::impl_unix::*;
pub(super) const GUPAX_EXTENSION: &str = "-macos-arm64-standalone.tar.gz"; // Some fake Curl/Wget user-agents because GitHub API requires one// user-agent might be fingerprintable without all the associated headers.
pub(super) const P2POOL_EXTENSION: &str = "-macos-aarch64.tar.gz";
pub(super) const XMRIG_EXTENSION: &str = "-macos-arm64.tar.gz";
}
#[cfg(target_os = "linux")]
mod impl_platform {
pub(super) use super::impl_unix::*;
pub(super) const GUPAX_EXTENSION: &str = "-linux-x64-standalone.tar.gz";
pub(super) const P2POOL_EXTENSION: &str = "-linux-x64.tar.gz";
pub(super) const XMRIG_EXTENSION: &str = "-linux-static-x64.tar.gz";
}
use impl_platform::*;
// const VALID_GUPAX: [&str; 3] = [VALID_GUPAX_1, VALID_GUPAX_2, VALID_GUPAX_3];
const VALID_XMRIG: [&str; 4] = [VALID_XMRIG_1, VALID_XMRIG_2, VALID_XMRIG_3, VALID_XMRIG_4];
const VALID_P2POOL: [&str; 4] = [
VALID_P2POOL_1,
VALID_P2POOL_2,
VALID_P2POOL_3,
VALID_P2POOL_4,
];
// Some fake Curl/Wget user-agents because GitHub API requires one and a Tor browser
// user-agent might be fingerprintable without all the associated headers.
const FAKE_USER_AGENT: [&str; 25] = [ const FAKE_USER_AGENT: [&str; 25] = [
"Wget/1.16.3", "Wget/1.16.3",
"Wget/1.17", "Wget/1.17",
@ -207,17 +117,13 @@ const FAKE_USER_AGENT: [&str; 25] = [
const MSG_NONE: &str = "No update in progress"; const MSG_NONE: &str = "No update in progress";
const MSG_START: &str = "Starting update"; const MSG_START: &str = "Starting update";
const MSG_TMP: &str = "Creating temporary directory"; const MSG_TMP: &str = "Creating temporary directory";
// const MSG_TOR: &str = "Creating Tor+HTTPS client";
const MSG_HTTPS: &str = "Creating HTTPS client"; const MSG_HTTPS: &str = "Creating HTTPS client";
const MSG_METADATA: &str = "Fetching package metadata"; const MSG_METADATA: &str = "Fetching package metadata";
const MSG_METADATA_RETRY: &str = "Fetching package metadata failed, attempt";
const MSG_COMPARE: &str = "Compare package versions"; const MSG_COMPARE: &str = "Compare package versions";
const MSG_UP_TO_DATE: &str = "All packages already up-to-date"; const MSG_UP_TO_DATE: &str = "All packages already up-to-date";
const MSG_DOWNLOAD: &str = "Downloading packages"; const MSG_DOWNLOAD: &str = "Downloading packages";
const MSG_DOWNLOAD_RETRY: &str = "Downloading packages failed, attempt";
const MSG_EXTRACT: &str = "Extracting packages"; const MSG_EXTRACT: &str = "Extracting packages";
const MSG_UPGRADE: &str = "Upgrading packages"; const MSG_UPGRADE: &str = "Upgrading packages";
pub const MSG_SUCCESS: &str = "Update successful";
pub const MSG_FAILED: &str = "Update failed"; pub const MSG_FAILED: &str = "Update failed";
pub const MSG_FAILED_HELP: &str = pub const MSG_FAILED_HELP: &str =
"Consider manually replacing your executable from github releases: https://github.com/Cyrix126/gupaxx/releases"; "Consider manually replacing your executable from github releases: https://github.com/Cyrix126/gupaxx/releases";
@ -241,10 +147,8 @@ pub fn check_p2pool_path(path: &str) -> bool {
return false; return false;
} }
}; };
path == VALID_P2POOL[0]
|| path == VALID_P2POOL[1] path == P2POOL_BINARY
|| path == VALID_P2POOL[2]
|| path == VALID_P2POOL[3]
} }
pub fn check_xmrig_path(path: &str) -> bool { pub fn check_xmrig_path(path: &str) -> bool {
@ -259,10 +163,7 @@ pub fn check_xmrig_path(path: &str) -> bool {
return false; return false;
} }
}; };
path == VALID_XMRIG[0] path == XMRIG_BINARY
|| path == VALID_XMRIG[1]
|| path == VALID_XMRIG[2]
|| path == VALID_XMRIG[3]
} }
//---------------------------------------------------------------------------------------------------- Update struct/impl //---------------------------------------------------------------------------------------------------- Update struct/impl
@ -270,7 +171,7 @@ pub fn check_xmrig_path(path: &str) -> bool {
// Progress bar structure: // Progress bar structure:
// 0% | Start // 0% | Start
// 5% | Create tmp directory, pkg list, fake user-agent // 5% | Create tmp directory, pkg list, fake user-agent
// 5% | Create Tor/HTTPS client // 5% | Create HTTPS client
// 30% | Download Metadata (x3) // 30% | Download Metadata (x3)
// 5% | Compare Versions (x3) // 5% | Compare Versions (x3)
// 30% | Download Archive (x3) // 30% | Download Archive (x3)
@ -282,6 +183,7 @@ pub struct Update {
pub path_gupax: String, // Full path to current gupax pub path_gupax: String, // Full path to current gupax
pub path_p2pool: String, // Full path to current p2pool pub path_p2pool: String, // Full path to current p2pool
pub path_xmrig: String, // Full path to current xmrig pub path_xmrig: String, // Full path to current xmrig
#[cfg(target_os = "windows")]
pub tmp_dir: String, // Full path to temporary directory pub tmp_dir: String, // Full path to temporary directory
pub updating: Arc<Mutex<bool>>, // Is an update in progress? pub updating: Arc<Mutex<bool>>, // Is an update in progress?
pub prog: Arc<Mutex<f32>>, // Holds the 0-100% progress bar number pub prog: Arc<Mutex<f32>>, // Holds the 0-100% progress bar number
@ -295,6 +197,7 @@ impl Update {
path_gupax, path_gupax,
path_p2pool: path_p2pool.display().to_string(), path_p2pool: path_p2pool.display().to_string(),
path_xmrig: path_xmrig.display().to_string(), path_xmrig: path_xmrig.display().to_string(),
#[cfg(target_os = "windows")]
tmp_dir: "".to_string(), tmp_dir: "".to_string(),
updating: arc_mut!(false), updating: arc_mut!(false),
prog: arc_mut!(0.0), prog: arc_mut!(0.0),
@ -321,21 +224,6 @@ impl Update {
Ok(tmp_dir) Ok(tmp_dir)
} }
// #[cold]
// #[inline(never)]
// Get an HTTPS client. Uses [Arti] if Tor is enabled.
// The base type looks something like [hyper::Client<...>].
// This is then wrapped with the custom [ClientEnum] type to implement
// dynamically returning either a [Tor+TLS|TLS-only] client at based on user settings.
// tor == true? => return Tor client
// tor == false? => return normal TLS client
//
// Since functions that take generic INPUT are much easier to implement,
// [get_response()] just takes a [hyper::Client<C>], which is passed to
// it via deconstructing this [ClientEnum] with a match, like so:
// ClientEnum::Tor(T) => get_response(... T ...)
// ClientEnum::Https(H) => get_response(... H ...)
//
#[cold] #[cold]
#[inline(never)] #[inline(never)]
// Intermediate function that spawns a new thread // Intermediate function that spawns a new thread
@ -358,9 +246,11 @@ impl Update {
error!("Update | This is the [Linux distro] version of Gupax, updates are disabled"); error!("Update | This is the [Linux distro] version of Gupax, updates are disabled");
#[cfg(feature = "distro")] #[cfg(feature = "distro")]
return; return;
// verify validity of absolute path for p2pool and xmrig only if we want to update them.
if lock!(og).gupax.bundled {
// Check P2Pool path for safety // Check P2Pool path for safety
// Attempt relative to absolute path // Attempt relative to absolute path
// it's ok if file doesn't exist. User could enable bundled version for the first time.
let p2pool_path = match into_absolute_path(gupax.p2pool_path.clone()) { let p2pool_path = match into_absolute_path(gupax.p2pool_path.clone()) {
Ok(p) => p, Ok(p) => p,
Err(e) => { Err(e) => {
@ -375,43 +265,6 @@ impl Update {
return; return;
} }
}; };
// Attempt to get basename
let file = match p2pool_path.file_name() {
Some(p) => {
// Attempt to turn into str
match p.to_str() {
Some(p) => p,
None => {
error_state.set("Provided P2Pool path could not be turned into a UTF-8 string (are you using non-English characters?)", ErrorFerris::Error, ErrorButtons::Okay);
return;
}
}
}
None => {
error_state.set(
"Provided P2Pool path could not be found",
ErrorFerris::Error,
ErrorButtons::Okay,
);
return;
}
};
// If it doesn't look like [P2Pool], its probably a bad move
// to overwrite it with an update, so set an error.
// Doesnt seem like you can [match] on array indexes
// so that explains the ridiculous if/else.
if check_p2pool_path(file) {
info!("Update | Using P2Pool path: [{}]", p2pool_path.display());
} else {
warn!(
"Update | Aborting update, incorrect P2Pool path: [{}]",
file
);
let text = format!("Provided P2Pool path seems incorrect. Not starting update for safety.\nTry one of these: {:?}", VALID_P2POOL);
error_state.set(text, ErrorFerris::Error, ErrorButtons::Okay);
return;
}
// Check XMRig path for safety // Check XMRig path for safety
let xmrig_path = match into_absolute_path(gupax.xmrig_path.clone()) { let xmrig_path = match into_absolute_path(gupax.xmrig_path.clone()) {
Ok(p) => p, Ok(p) => p,
@ -427,37 +280,9 @@ impl Update {
return; return;
} }
}; };
let file = match xmrig_path.file_name() {
Some(p) => {
// Attempt to turn into str
match p.to_str() {
Some(p) => p,
None => {
error_state.set("Provided XMRig path could not be turned into a UTF-8 string (are you using non-English characters?)", ErrorFerris::Error, ErrorButtons::Okay);
return;
}
}
}
None => {
error_state.set(
"Provided XMRig path could not be found",
ErrorFerris::Error,
ErrorButtons::Okay,
);
return;
}
};
if check_xmrig_path(file) {
info!("Update | Using XMRig path: [{}]", xmrig_path.display());
} else {
warn!("Update | Aborting update, incorrect XMRig path: [{}]", file);
let text = format!("Provided XMRig path seems incorrect. Not starting update for safety.\nTry one of these: {:?}", VALID_XMRIG);
error_state.set(text, ErrorFerris::Error, ErrorButtons::Okay);
return;
}
lock!(update).path_p2pool = p2pool_path.display().to_string(); lock!(update).path_p2pool = p2pool_path.display().to_string();
lock!(update).path_xmrig = xmrig_path.display().to_string(); lock!(update).path_xmrig = xmrig_path.display().to_string();
}
// Clone before thread spawn // Clone before thread spawn
let og = Arc::clone(og); let og = Arc::clone(og);
@ -467,7 +292,7 @@ impl Update {
let restart = Arc::clone(restart); let restart = Arc::clone(restart);
info!("Spawning update thread..."); info!("Spawning update thread...");
std::thread::spawn(move || { std::thread::spawn(move || {
match Update::start(update.clone(), og.clone(), state_ver.clone(), restart) { match Update::start(update.clone(), og.clone(), restart) {
Ok(_) => { Ok(_) => {
info!("Update | Saving state..."); info!("Update | Saving state...");
let original_version = lock!(og).version.clone(); let original_version = lock!(og).version.clone();
@ -504,8 +329,7 @@ impl Update {
#[tokio::main] #[tokio::main]
pub async fn start( pub async fn start(
update: Arc<Mutex<Self>>, update: Arc<Mutex<Self>>,
_og: Arc<Mutex<State>>, og: Arc<Mutex<State>>,
state_ver: Arc<Mutex<Version>>,
restart: Arc<Mutex<Restart>>, restart: Arc<Mutex<Restart>>,
) -> Result<(), anyhow::Error> { ) -> Result<(), anyhow::Error> {
#[cfg(feature = "distro")] #[cfg(feature = "distro")]
@ -532,14 +356,11 @@ impl Update {
let tmp_dir = Self::get_tmp_dir()?; let tmp_dir = Self::get_tmp_dir()?;
std::fs::create_dir(&tmp_dir)?; std::fs::create_dir(&tmp_dir)?;
// Make Pkg vector
let mut vec = vec![Pkg::new(Gupax), Pkg::new(P2pool), Pkg::new(Xmrig)];
// Generate fake user-agent // Generate fake user-agent
let user_agent = Pkg::get_user_agent(); let user_agent = get_user_agent();
*lock2!(update, prog) = 5.0; *lock2!(update, prog) = 5.0;
// Create Tor/HTTPS client // Create HTTPS client
let lock = lock!(update); let lock = lock!(update);
let msg = MSG_HTTPS.to_string(); let msg = MSG_HTTPS.to_string();
info!("Update | {}", msg); info!("Update | {}", msg);
@ -552,237 +373,115 @@ impl Update {
//---------------------------------------------------------------------------------------------------- Metadata //---------------------------------------------------------------------------------------------------- Metadata
*lock2!(update, msg) = MSG_METADATA.to_string(); *lock2!(update, msg) = MSG_METADATA.to_string();
info!("Update | {}", METADATA); info!("Update | {}", METADATA);
let mut vec2 = vec![];
// Loop process: // Loop process:
// 1. Start all async metadata fetches // reqwest will retry himself
// 2. Wait for all to finish
// 3. Iterate over all [pkg.new_ver], check if empty
// 4. If not empty, move [pkg] to different vec
// 5. At end, if original vec isn't empty, that means something failed
// 6. Redo loop [3] times (rebuild circuit if using Tor), with the original vec (that now only has the failed pkgs)
//
// This logic was originally in the [Pkg::get_metadata()]
// function itself but for some reason, it was getting skipped over,
// so the [new_ver] check is now here, in the outer scope.
for i in 1..=3 {
if i > 1 {
*lock2!(update, msg) = format!("{} [{}/3]", MSG_METADATA_RETRY, i);
}
let mut handles: Vec<JoinHandle<Result<(), anyhow::Error>>> = vec![];
for pkg in vec.iter() {
// Clone data before sending to async
let new_ver = Arc::clone(&pkg.new_ver);
let client = client.clone();
let link = pkg.link_metadata.to_string();
// Send to async // Send to async
let handle: JoinHandle<Result<(), anyhow::Error>> = tokio::spawn(async move { let new_ver = if let Ok(new_ver) =
Pkg::get_metadata(new_ver, &client, link, user_agent).await get_metadata(&client, GUPAX_METADATA.to_string(), user_agent).await
}); {
handles.push(handle); new_ver
}
// Handle await
for handle in handles {
// Two [??] will send the error.
// We don't actually want to return the error here since we
// prefer looping and retrying over immediately erroring out.
if let Err(e) = handle.await? {
warn!("Update | {}", e)
}
}
// Check for empty version
let mut indexes = vec![];
for (index, pkg) in vec.iter().enumerate() {
if lock!(pkg.new_ver).is_empty() {
warn!("Update | {} failed, attempt [{}/3]...", pkg.name, i + 1);
} else {
indexes.push(index);
vec2.push(pkg.clone());
*lock2!(update, prog) += 10.0;
info!("Update | {} {} ... OK", pkg.name, lock!(pkg.new_ver));
}
}
// Order indexes from biggest to smallest
// This prevents shifting the whole vector and causing panics.
indexes.sort();
indexes.reverse();
for index in indexes {
vec.remove(index);
}
if vec.is_empty() {
break;
}
// Some Tor exit nodes seem to be blocked by GitHub's API,
// so recreate the circuit every loop.
}
if vec.is_empty() {
info!("Update | Metadata ... OK ... {}%", lock2!(update, prog));
} else { } else {
error!("Update | Metadata ... FAIL"); error!("Update | Metadata ... FAIL");
return Err(anyhow!("Metadata fetch failed")); return Err(anyhow!("Metadata fetch failed"));
} };
*lock2!(update, prog) += 10.0;
info!("Update | Gupaxx {} ... OK", new_ver);
//---------------------------------------------------------------------------------------------------- Compare //---------------------------------------------------------------------------------------------------- Compare
*lock2!(update, msg) = MSG_COMPARE.to_string(); *lock2!(update, msg) = MSG_COMPARE.to_string();
info!("Update | {}", COMPARE); info!("Update | {}", COMPARE);
let mut vec3 = vec![]; let diff = GUPAX_VERSION != new_ver;
let mut new_pkgs = vec![];
for pkg in vec2.iter() {
let new_ver = lock!(pkg.new_ver).clone();
let diff;
let old_ver;
let name;
match pkg.name {
Gupax => {
// Compare against the built-in compiled version as well as an in-memory version
// that gets updated during an update. This prevents the updater always thinking
// there's a new Gupax update since the user didnt restart and is still technically
// using the old version (even though the underlying binary was updated).
old_ver = lock!(state_ver).gupax.clone();
diff = old_ver != new_ver && GUPAX_VERSION != new_ver;
name = "Gupaxx";
}
P2pool => {
old_ver = lock!(state_ver).p2pool.clone();
diff = old_ver != new_ver;
name = "P2Pool";
}
Xmrig => {
old_ver = lock!(state_ver).xmrig.clone();
diff = old_ver != new_ver;
name = "XMRig";
}
}
if diff { if diff {
info!( info!(
"Update | {} {} != {} ... ADDING", "Update | Gupaxx {} != {} ... ADDING",
pkg.name, old_ver, new_ver GUPAX_VERSION, new_ver
); );
new_pkgs.push(format!("\n{} {} -> {}", name, old_ver, new_ver));
vec3.push(pkg);
} else { } else {
info!( info!(
"Update | {} {} == {} ... SKIPPING", "Update | Gupaxx {} == {} ... SKIPPING",
pkg.name, old_ver, new_ver GUPAX_VERSION, new_ver
); );
} info!("Update | All packages up-to-date ... RETURNING");
*lock2!(update, prog) = 100.0;
*lock2!(update, msg) = MSG_UP_TO_DATE.to_string();
return Ok(());
} }
*lock2!(update, prog) += 5.0; *lock2!(update, prog) += 5.0;
info!("Update | Compare ... OK ... {}%", lock2!(update, prog)); info!("Update | Compare ... OK ... {}%", lock2!(update, prog));
// Return if 0 (all packages up-to-date) // Return if 0 (all packages up-to-date)
// Get amount of packages to divide up the percentage increases // Get amount of packages to divide up the percentage increases
let pkg_amount = vec3.len() as f32;
if pkg_amount == 0.0 {
info!("Update | All packages up-to-date ... RETURNING");
*lock2!(update, prog) = 100.0;
*lock2!(update, msg) = MSG_UP_TO_DATE.to_string();
return Ok(());
}
let new_pkgs: String = new_pkgs.concat();
//---------------------------------------------------------------------------------------------------- Download //---------------------------------------------------------------------------------------------------- Download
*lock2!(update, msg) = format!("{}{}", MSG_DOWNLOAD, new_pkgs); *lock2!(update, msg) = format!("{} Gupaxx", MSG_DOWNLOAD);
info!("Update | {}", DOWNLOAD); info!("Update | {}", DOWNLOAD);
let mut vec4 = vec![];
for i in 1..=3 {
if i > 1 {
*lock2!(update, msg) = format!("{} [{}/3]{}", MSG_DOWNLOAD_RETRY, i, new_pkgs);
}
let mut handles: Vec<JoinHandle<Result<(), anyhow::Error>>> = vec![];
for pkg in vec3.iter() {
// Clone data before async // Clone data before async
let bytes = Arc::clone(&pkg.bytes); let version = new_ver;
let client = client.clone();
let version = lock!(pkg.new_ver);
// Download link = PREFIX + Version (found at runtime) + SUFFIX + Version + EXT // Download link = PREFIX + Version (found at runtime) + SUFFIX + Version + EXT
// Example: https://github.com/hinto-janai/gupax/releases/download/v0.0.1/gupax-v0.0.1-linux-x64-standalone // Example: https://github.com/Cyrix126/gupaxx/releases/download/v1.0.0/gupaxx-v1.0.0-linux-x64-standalone.tar.gz
// XMRig doesn't have a [v], so slice it out // prefix: https://github.com/Cyrix126/gupaxx/releases/download
let link = match pkg.name { // version: v1.0.0
Name::Xmrig => { // suffix: gupaxx
pkg.link_prefix.to_string() // version: v1.0.0
+ &version // os
+ pkg.link_suffix // arch
+ &version[1..] // standalone or bundled
+ pkg.link_extension // archive extension
} let bundle = if lock!(og).gupax.bundled {
_ => { "bundle"
pkg.link_prefix.to_string()
+ &version
+ pkg.link_suffix
+ &version
+ pkg.link_extension
}
};
info!("Update | {} ... {}", pkg.name, link);
let handle: JoinHandle<Result<(), anyhow::Error>> =
tokio::spawn(
async move { Pkg::get_bytes(bytes, &client, link, user_agent).await },
);
handles.push(handle);
}
// Handle await
for handle in handles {
if let Err(e) = handle.await? {
warn!("Update | {}", e)
}
}
// Check for empty bytes
let mut indexes = vec![];
for (index, pkg) in vec3.iter().enumerate() {
if lock!(pkg.bytes).is_empty() {
warn!("Update | {} failed, attempt [{}/3]...", pkg.name, i);
} else { } else {
indexes.push(index); "standalone"
vec4.push(*pkg); };
*lock2!(update, prog) += (30.0 / pkg_amount).round(); let link = [
info!("Update | {} ... OK", pkg.name); "https://github.com/Cyrix126/gupaxx/releases/download/",
} &version,
} "/gupaxx-",
// Order indexes from biggest to smallest &version,
// This prevents shifting the whole vector and causing panics. "-",
indexes.sort(); OS_TARGET,
indexes.reverse(); "-",
for index in indexes { ARCH_TARGET,
vec3.remove(index); "-",
} bundle,
if vec3.is_empty() { ".",
break; ARCHIVE_EXT,
} ]
} .concat();
if vec3.is_empty() { info!("Update | Gupaxx ... {}", link);
info!("Update | Download ... OK ... {}%", *lock2!(update, prog)); let bytes = if let Ok(bytes) = get_bytes(&client, link, user_agent).await {
bytes
} else { } else {
error!("Update | Download ... FAIL"); error!("Update | Download ... FAIL");
return Err(anyhow!("Download failed")); return Err(anyhow!("Download failed"));
} };
*lock2!(update, prog) += 30.0;
info!("Update | Gupaxx ... OK");
info!("Update | Download ... OK ... {}%", *lock2!(update, prog));
//---------------------------------------------------------------------------------------------------- Extract //---------------------------------------------------------------------------------------------------- Extract
*lock2!(update, msg) = format!("{}{}", MSG_EXTRACT, new_pkgs); *lock2!(update, msg) = format!("{} Gupaxx", MSG_EXTRACT);
info!("Update | {}", EXTRACT); info!("Update | {}", EXTRACT);
for pkg in vec4.iter() { let tmp = tmp_dir.to_owned();
let tmp = match pkg.name {
Name::Gupax => tmp_dir.to_owned() + GUPAX_BINARY,
_ => tmp_dir.to_owned() + &pkg.name.to_string(),
};
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
ZipArchive::extract( ZipArchive::extract(
&mut ZipArchive::new(std::io::Cursor::new(lock!(pkg.bytes).as_ref()))?, &mut ZipArchive::new(std::io::Cursor::new(bytes.as_ref()))?,
tmp, tmp,
)?; )?;
#[cfg(target_family = "unix")] #[cfg(target_family = "unix")]
tar::Archive::new(flate2::read::GzDecoder::new(lock!(pkg.bytes).as_ref())) tar::Archive::new(flate2::read::GzDecoder::new(bytes.as_ref())).unpack(tmp)?;
.unpack(tmp)?; *lock2!(update, prog) += 5.0;
*lock2!(update, prog) += (5.0 / pkg_amount).round(); info!("Update | Gupaxx ... OK");
info!("Update | {} ... OK", pkg.name);
}
info!("Update | Extract ... OK ... {}%", *lock2!(update, prog)); info!("Update | Extract ... OK ... {}%", *lock2!(update, prog));
//---------------------------------------------------------------------------------------------------- Upgrade //---------------------------------------------------------------------------------------------------- Upgrade
// if bundled, directories p2pool and xmrig will exist.
// if not, only gupaxx binary will be present.
// 1. Walk directories // 1. Walk directories
// 2. If basename matches known binary name, start //
// 3. Rename tmp path into current path // 3. Rename tmp path into current path
// 4. Update [State/Version] // 4. Update [State/Version]
*lock2!(update, msg) = format!("{}{}", MSG_UPGRADE, new_pkgs); *lock2!(update, msg) = format!("Gupaxx {}", MSG_UPGRADE);
info!("Update | {}", UPGRADE); info!("Update | {}", UPGRADE);
// If this bool doesn't get set, something has gone wrong because // If this bool doesn't get set, something has gone wrong because
// we _didn't_ find a binary even though we downloaded it. // we _didn't_ find a binary even though we downloaded it.
@ -793,25 +492,17 @@ impl Update {
if !entry.file_type().is_file() { if !entry.file_type().is_file() {
continue; continue;
} }
let basename = entry let name = entry
.file_name() .file_name()
.to_str() .to_str()
.ok_or_else(|| anyhow!("WalkDir basename failed"))?; .ok_or_else(|| anyhow!("WalkDir basename failed"))?;
match basename {
VALID_GUPAX_1 | VALID_GUPAX_2 | VALID_GUPAX_3 | VALID_P2POOL_1 | VALID_P2POOL_2
| VALID_P2POOL_3 | VALID_P2POOL_4 | VALID_XMRIG_1 | VALID_XMRIG_2
| VALID_XMRIG_3 | VALID_XMRIG_4 => {
found = true;
let name = match basename {
VALID_GUPAX_1 | VALID_GUPAX_2 | VALID_GUPAX_3 => Gupax,
VALID_P2POOL_1 | VALID_P2POOL_2 | VALID_P2POOL_3 | VALID_P2POOL_4 => P2pool,
_ => Xmrig,
};
let path = match name { let path = match name {
Gupax => lock!(update).path_gupax.clone(), GUPAX_BINARY => lock!(update).path_gupax.clone(),
P2pool => lock!(update).path_p2pool.clone(), P2POOL_BINARY => lock!(update).path_p2pool.clone(),
Xmrig => lock!(update).path_xmrig.clone(), XMRIG_BINARY => lock!(update).path_xmrig.clone(),
_ => continue,
}; };
found = true;
let path = Path::new(&path); let path = Path::new(&path);
// Unix can replace running binaries no problem (they're loaded into memory) // Unix can replace running binaries no problem (they're loaded into memory)
// Windows locks binaries in place, so we must move (rename) current binary // Windows locks binaries in place, so we must move (rename) current binary
@ -821,9 +512,10 @@ impl Update {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
if path.exists() { if path.exists() {
let tmp_windows = match name { let tmp_windows = match name {
Gupax => tmp_dir.clone() + "gupaxx_old.exe", GUPAX_BINARY => tmp_dir.clone() + "gupaxx_old.exe",
P2pool => tmp_dir.clone() + "p2pool_old.exe", P2POOL_BINARY => tmp_dir.clone() + "p2pool_old.exe",
Xmrig => tmp_dir.clone() + "xmrig_old.exe", XMRIG_BINARY => tmp_dir.clone() + "xmrig_old.exe",
_ => continue,
}; };
info!( info!(
"Update | WINDOWS ONLY ... Moving old [{}] -> [{}]", "Update | WINDOWS ONLY ... Moving old [{}] -> [{}]",
@ -837,8 +529,8 @@ impl Update {
entry.path().display(), entry.path().display(),
path.display() path.display()
); );
// Create folder for [P2Pool/XMRig] // if bundled, create directory for p2pool and xmrig if not present
if name == P2pool || name == Xmrig { if lock!(og).gupax.bundled && (name == P2POOL_BINARY || name == XMRIG_BINARY) {
std::fs::create_dir_all( std::fs::create_dir_all(
path.parent() path.parent()
.ok_or_else(|| anyhow!(format!("{} path failed", name)))?, .ok_or_else(|| anyhow!(format!("{} path failed", name)))?,
@ -846,22 +538,9 @@ impl Update {
} }
// Move downloaded path into old path // Move downloaded path into old path
std::fs::rename(entry.path(), path)?; std::fs::rename(entry.path(), path)?;
// Update [State] version
match name {
Gupax => {
lock!(state_ver).gupax = Pkg::get_new_pkg_version(Gupax, &vec4)?;
// If we're updating Gupax, set the [Restart] state so that the user knows to restart // If we're updating Gupax, set the [Restart] state so that the user knows to restart
*lock!(restart) = Restart::Yes; *lock!(restart) = Restart::Yes;
} *lock2!(update, prog) += 5.0;
P2pool => {
lock!(state_ver).p2pool = Pkg::get_new_pkg_version(P2pool, &vec4)?
}
Xmrig => lock!(state_ver).xmrig = Pkg::get_new_pkg_version(Xmrig, &vec4)?,
};
*lock2!(update, prog) += (5.0 / pkg_amount).round();
}
_ => (),
}
} }
if !found { if !found {
return Err(anyhow!("Fatal error: Package binary could not be found")); return Err(anyhow!("Fatal error: Package binary could not be found"));
@ -875,130 +554,68 @@ impl Update {
let seconds = now.elapsed().as_secs(); let seconds = now.elapsed().as_secs();
info!("Update | Seconds elapsed ... [{}s]", seconds); info!("Update | Seconds elapsed ... [{}s]", seconds);
match seconds { *lock2!(update, msg) = format!(
0 => { "Updated from {} to {}\nYou need to restart Gupaxx.",
*lock2!(update, msg) = GUPAX_VERSION, version
format!("{}! Took 0 seconds... What...?!{}", MSG_SUCCESS, new_pkgs) );
}
1 => {
*lock2!(update, msg) = format!("{}! Took 1 second... Wow!{}", MSG_SUCCESS, new_pkgs)
}
_ => {
*lock2!(update, msg) =
format!("{}! Took {} seconds.{}", MSG_SUCCESS, seconds, new_pkgs)
}
}
*lock2!(update, prog) = 100.0; *lock2!(update, prog) = 100.0;
Ok(()) Ok(())
} }
} }
//---------------------------------------------------------------------------------------------------- Pkg struct/impl //---------------------------------------------------------------------------------------------------- Pkg functions
#[derive(Debug, Clone)] #[cold]
pub struct Pkg { #[inline(never)]
name: Name, // Generate fake [User-Agent] HTTP header
link_metadata: &'static str, pub fn get_user_agent() -> &'static str {
link_prefix: &'static str,
link_suffix: &'static str,
link_extension: &'static str,
bytes: Arc<Mutex<Bytes>>,
new_ver: Arc<Mutex<String>>,
}
impl Pkg {
#[cold]
#[inline(never)]
pub fn new(name: Name) -> Self {
let link_metadata = match name {
Gupax => GUPAX_METADATA,
P2pool => P2POOL_METADATA,
Xmrig => XMRIG_METADATA,
};
let link_prefix = match name {
Gupax => GUPAX_PREFIX,
P2pool => P2POOL_PREFIX,
Xmrig => XMRIG_PREFIX,
};
let link_suffix = match name {
Gupax => GUPAX_SUFFIX,
P2pool => P2POOL_SUFFIX,
Xmrig => XMRIG_SUFFIX,
};
let link_extension = match name {
Gupax => GUPAX_EXTENSION,
P2pool => P2POOL_EXTENSION,
Xmrig => XMRIG_EXTENSION,
};
Self {
name,
link_metadata,
link_prefix,
link_suffix,
link_extension,
bytes: arc_mut!(bytes::Bytes::new()),
new_ver: arc_mut!(String::new()),
}
}
//---------------------------------------------------------------------------------------------------- Pkg functions
#[cold]
#[inline(never)]
// Generate fake [User-Agent] HTTP header
pub fn get_user_agent() -> &'static str {
let index = FAKE_USER_AGENT.len() - 1; let index = FAKE_USER_AGENT.len() - 1;
let rand = thread_rng().gen_range(0..index); let rand = thread_rng().gen_range(0..index);
let user_agent = FAKE_USER_AGENT[rand]; let user_agent = FAKE_USER_AGENT[rand];
info!("Randomly selected User-Agent ({rand}/{index}) ... {user_agent}"); info!("Randomly selected User-Agent ({rand}/{index}) ... {user_agent}");
user_agent user_agent
} }
#[cold] #[cold]
#[inline(never)] #[inline(never)]
// Generate GET request based off input URI + fake user agent // Generate GET request based off input URI + fake user agent
fn get_request( fn get_request(
client: &Client, client: &Client,
link: String, link: String,
user_agent: &'static str, user_agent: &'static str,
) -> Result<RequestBuilder, anyhow::Error> { ) -> Result<RequestBuilder, anyhow::Error> {
Ok(client.get(link).header(USER_AGENT, user_agent)) Ok(client.get(link).header(USER_AGENT, user_agent))
} }
#[cold] #[cold]
#[inline(never)] #[inline(never)]
// Get metadata using [Generic hyper::client<C>] & [Request] // Get metadata using [Generic hyper::client<C>] & [Request]
// and change [version, prog] under an Arc<Mutex> // and change [version, prog] under an Arc<Mutex>
async fn get_metadata( async fn get_metadata(
new_ver: Arc<Mutex<String>>,
client: &Client, client: &Client,
link: String, link: String,
user_agent: &'static str, user_agent: &'static str,
) -> Result<(), Error> { ) -> Result<String, Error> {
let request = Pkg::get_request(client, link, user_agent)?; let request = get_request(client, link, user_agent)?;
let response = request.send().await?; let response = request.send().await?;
dbg!(&response);
let body = response.json::<TagName>().await?; let body = response.json::<TagName>().await?;
*lock!(new_ver) = body.tag_name; Ok(body.tag_name)
Ok(()) }
}
#[cold] #[cold]
#[inline(never)] #[inline(never)]
// Takes a [Request], fills the appropriate [Pkg] async fn get_bytes(
// [bytes] field with the [Archive/Standalone]
async fn get_bytes(
bytes: Arc<Mutex<bytes::Bytes>>,
client: &Client, client: &Client,
link: String, link: String,
user_agent: &'static str, user_agent: &'static str,
) -> Result<(), anyhow::Error> { ) -> Result<bytes::Bytes, anyhow::Error> {
let request = Self::get_request(client, link, user_agent)?; let request = get_request(client, link, user_agent)?;
let mut response = request.send().await?; let mut response = request.send().await?;
// GitHub sends a 302 redirect, so we must follow // GitHub sends a 302 redirect, so we must follow
// the [Location] header... only if Reqwest had custom // the [Location] header... only if Reqwest had custom
// connectors so I didn't have to manually do this... // connectors so I didn't have to manually do this...
if response.headers().contains_key(LOCATION) { if response.headers().contains_key(LOCATION) {
response = Self::get_request( response = get_request(
client, client,
response response
.headers() .headers()
@ -1012,22 +629,7 @@ impl Pkg {
.await?; .await?;
} }
let body = response.bytes().await?; let body = response.bytes().await?;
*lock!(bytes) = body; Ok(body)
Ok(())
}
#[cold]
#[inline(never)]
// Take in a [Name] and [Vec] of [Pkg]s, find
// that [Name]'s corresponding new version.
fn get_new_pkg_version(name: Name, vec: &[&Pkg]) -> Result<String, Error> {
for pkg in vec.iter() {
if pkg.name == name {
return Ok(lock!(pkg.new_ver).to_string());
}
}
Err(anyhow!("Couldn't find new_pkg_version"))
}
} }
// This inherits the value of [tag_name] from GitHub's JSON API // This inherits the value of [tag_name] from GitHub's JSON API
@ -1035,16 +637,3 @@ impl Pkg {
struct TagName { struct TagName {
tag_name: String, tag_name: String,
} }
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum Name {
Gupax,
P2pool,
Xmrig,
}
impl std::fmt::Display for Name {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}

View file

@ -191,6 +191,7 @@ pub struct Gupax {
pub selected_scale: f32, pub selected_scale: f32,
pub tab: Tab, pub tab: Tab,
pub ratio: Ratio, pub ratio: Ratio,
pub bundled: bool,
} }
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize)] #[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize)]
@ -288,6 +289,10 @@ impl Default for Gupax {
selected_scale: APP_DEFAULT_SCALE, selected_scale: APP_DEFAULT_SCALE,
ratio: Ratio::Width, ratio: Ratio::Width,
tab: Tab::Xvb, tab: Tab::Xvb,
#[cfg(feature = "bundle")]
bundled: true,
#[cfg(not(feature = "bundle"))]
bundled: false,
} }
} }
} }

View file

@ -43,6 +43,7 @@ mod test {
selected_scale = 0.0 selected_scale = 0.0
tab = "About" tab = "About"
ratio = "Width" ratio = "Width"
bundled = false
[status] [status]
submenu = "P2pool" submenu = "P2pool"

View file

@ -125,6 +125,7 @@ impl Default for Sys {
//---------------------------------------------------------------------------------------------------- [Process] Struct //---------------------------------------------------------------------------------------------------- [Process] Struct
// This holds all the state of a (child) process. // This holds all the state of a (child) process.
// The main GUI thread will use this to display console text, online state, etc. // The main GUI thread will use this to display console text, online state, etc.
#[allow(dead_code)]
#[derive(Debug)] #[derive(Debug)]
pub struct Process { pub struct Process {
pub name: ProcessName, // P2Pool or XMRig? pub name: ProcessName, // P2Pool or XMRig?

View file

@ -666,6 +666,7 @@ impl ImgXmrig {
} }
//---------------------------------------------------------------------------------------------------- Public XMRig API //---------------------------------------------------------------------------------------------------- Public XMRig API
#[allow(dead_code)]
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct PubXmrigApi { pub struct PubXmrigApi {
pub output: String, pub output: String,

View file

@ -361,10 +361,11 @@ impl Helper {
} }
} }
//---------------------------------------------------------------------------------------------------- Public XvB API //---------------------------------------------------------------------------------------------------- Public XvB API
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
pub struct PubXvbApi { pub struct PubXvbApi {
pub output: String, pub output: String,
pub uptime: u64, pub _uptime: u64,
pub xvb_sent_last_hour_samples: SamplesAverageHour, pub xvb_sent_last_hour_samples: SamplesAverageHour,
pub p2pool_sent_last_hour_samples: SamplesAverageHour, pub p2pool_sent_last_hour_samples: SamplesAverageHour,
pub stats_pub: XvbPubStats, pub stats_pub: XvbPubStats,

View file

@ -17,6 +17,7 @@ use crate::{
use super::{rounds::XvbRound, PubXvbApi}; use super::{rounds::XvbRound, PubXvbApi};
#[allow(dead_code)] // because deserialize doesn't use all the fields
#[derive(Debug, Clone, Default, Deserialize)] #[derive(Debug, Clone, Default, Deserialize)]
pub struct XvbPubStats { pub struct XvbPubStats {
pub time_remain: u32, // remaining time of round in minutes pub time_remain: u32, // remaining time of round in minutes

View file

@ -84,7 +84,7 @@ pub fn init_logger(now: Instant) {
_ => LevelFilter::Info, _ => LevelFilter::Info,
}; };
std::env::set_var("RUST_LOG", format!("off,gupax={}", filter_env)); std::env::set_var("RUST_LOG", format!("off,gupax={}", filter_env));
Logger::try_with_str("debug") Logger::try_with_str("info")
.unwrap() .unwrap()
.log_to_file(FileSpec::default()) .log_to_file(FileSpec::default())
.start() .start()

View file

@ -87,12 +87,13 @@ fn main() {
// Run Gupax. // Run Gupax.
info!("/*************************************/ Init ... OK /*************************************/"); info!("/*************************************/ Init ... OK /*************************************/");
let _ = eframe::run_native( eframe::run_native(
&app.name_version.clone(), &app.name_version.clone(),
options, options,
Box::new(move |cc| { Box::new(move |cc| {
egui_extras::install_image_loaders(&cc.egui_ctx); egui_extras::install_image_loaders(&cc.egui_ctx);
Box::new(App::cc(cc, resolution, app)) Box::new(App::cc(cc, resolution, app))
}), }),
); )
.unwrap();
} }

View file

@ -141,7 +141,7 @@ pub fn get_exe_dir() -> Result<String, std::io::Error> {
#[cold] #[cold]
#[inline(never)] #[inline(never)]
pub fn clean_dir() -> Result<(), anyhow::Error> { pub fn clean_dir() -> Result<(), anyhow::Error> {
let regex = Regex::new("^gupax_update_[A-Za-z0-9]{10}$").unwrap(); let regex = Regex::new("^gupaxx_update_[A-Za-z0-9]{10}$").unwrap();
for entry in std::fs::read_dir(get_exe_dir()?)? { for entry in std::fs::read_dir(get_exe_dir()?)? {
let entry = entry?; let entry = entry?;
if !entry.path().is_dir() { if !entry.path().is_dir() {

View file

@ -264,8 +264,10 @@ pub const STATUS_SUBMENU_OTHER_BENCHMARKS: &str =
// Gupaxx // Gupaxx
pub const GUPAX_UPDATE: &str = pub const GUPAX_UPDATE: &str =
"Check for updates on Gupaxx, P2Pool, and XMRig via GitHub's API and upgrade automatically"; "Check for updates on Gupaxx and bundled versions of P2Pool and XMRig via GitHub's API and upgrade automatically";
pub const GUPAX_AUTO_UPDATE: &str = "Automatically check for updates at startup"; pub const GUPAX_AUTO_UPDATE: &str = "Automatically check for updates at startup";
pub const GUPAX_BUNDLED_UPDATE: &str =
"Update XMRig and P2Pool with bundled versions of latest Gupaxx. It will replace any present xmrig and p2pool binary in their specified path.";
pub const GUPAX_SHOULD_RESTART: &str = pub const GUPAX_SHOULD_RESTART: &str =
"Gupaxx was updated. A restart is recommended but not required"; "Gupaxx was updated. A restart is recommended but not required";
// #[cfg(not(target_os = "macos"))] // #[cfg(not(target_os = "macos"))]

View file

@ -35,6 +35,7 @@ use std::{
}; };
use zeroize::Zeroize; use zeroize::Zeroize;
#[allow(dead_code)] // for dummy value windows
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct SudoState { pub struct SudoState {
pub windows: bool, // If this bool is set, this struct is just a dummy so I don't have to change my type signatures :) pub windows: bool, // If this bool is set, this struct is just a dummy so I don't have to change my type signatures :)

View file

@ -19,25 +19,25 @@ cp CHANGELOG.md /tmp/${FOLDER}/skel/
# download xmrig into directory linux # download xmrig into directory linux
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-linux-static-x64.tar.gz wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-linux-static-x64.tar.gz
tar -xf xmrig-6.21.1-linux-static-x64.tar.gz tar -xf xmrig-6.21.1-linux-static-x64.tar.gz
mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/linux/xmrig/xmrig mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/linux_b/xmrig/xmrig
rm -r xmrig-6.21.1 rm -r xmrig-6.21.1
rm xmrig-6.21.1-linux-static-x64.tar.gz rm xmrig-6.21.1-linux-static-x64.tar.gz
# download xmrig into directory macos-arm64 # download xmrig into directory macos-arm64
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-macos-arm64.tar.gz wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-macos-arm64.tar.gz
tar -xf xmrig-6.21.1-macos-arm64.tar.gz tar -xf xmrig-6.21.1-macos-arm64.tar.gz
mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/macos-arm64/Gupaxx.app/Contents/MacOS/xmrig/xmrig mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/macos-arm64_b/Gupaxx.app/Contents/MacOS/xmrig/xmrig
rm -r xmrig-6.21.1 rm -r xmrig-6.21.1
rm xmrig-6.21.1-macos-arm64.tar.gz rm xmrig-6.21.1-macos-arm64.tar.gz
# download xmrig into directory macos-x64 # download xmrig into directory macos-x64
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-macos-x64.tar.gz wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-macos-x64.tar.gz
tar -xf xmrig-6.21.1-macos-x64.tar.gz tar -xf xmrig-6.21.1-macos-x64.tar.gz
mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/macos-x64/Gupaxx.app/Contents/MacOS/xmrig/xmrig mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/macos-x64_b/Gupaxx.app/Contents/MacOS/xmrig/xmrig
rm -r xmrig-6.21.1 rm -r xmrig-6.21.1
rm xmrig-6.21.1-macos-x64.tar.gz rm xmrig-6.21.1-macos-x64.tar.gz
# download xmrig into directory windows # download xmrig into directory windows
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-msvc-win64.zip wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-msvc-win64.zip
unzip xmrig-6.21.1-msvc-win64.zip unzip xmrig-6.21.1-msvc-win64.zip
mv xmrig-6.21.1/xmrig.exe /tmp/${FOLDER}/skel/windows/XMRig/xmrig.exe mv xmrig-6.21.1/xmrig.exe /tmp/${FOLDER}/skel/windows_b/XMRig/xmrig.exe
rm -r xmrig-6.21.1 rm -r xmrig-6.21.1
rm xmrig-6.21.1-msvc-win64.zip rm xmrig-6.21.1-msvc-win64.zip
@ -45,25 +45,25 @@ rm xmrig-6.21.1-msvc-win64.zip
# download p2pool into directory linux # download p2pool into directory linux
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-linux-x64.tar.gz wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-linux-x64.tar.gz
tar -xf p2pool-v3.10-linux-x64.tar.gz tar -xf p2pool-v3.10-linux-x64.tar.gz
mv p2pool-v3.10-linux-x64/p2pool /tmp/${FOLDER}/skel/linux/p2pool/p2pool mv p2pool-v3.10-linux-x64/p2pool /tmp/${FOLDER}/skel/linux_b/p2pool/p2pool
rm -r p2pool-v3.10-linux-x64 rm -r p2pool-v3.10-linux-x64
rm p2pool-v3.10-linux-x64.tar.gz rm p2pool-v3.10-linux-x64.tar.gz
# download p2pool into directory macos-arm64 # download p2pool into directory macos-arm64
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-macos-aarch64.tar.gz wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-macos-aarch64.tar.gz
tar -xf p2pool-v3.10-macos-aarch64.tar.gz tar -xf p2pool-v3.10-macos-aarch64.tar.gz
mv p2pool-v3.10-macos-aarch64/p2pool /tmp/${FOLDER}/skel/macos-arm64/Gupaxx.app/Contents/MacOS/p2pool/p2pool mv p2pool-v3.10-macos-aarch64/p2pool /tmp/${FOLDER}/skel/macos-arm64_b/Gupaxx.app/Contents/MacOS/p2pool/p2pool
rm -r p2pool-v3.10-macos-aarch64 rm -r p2pool-v3.10-macos-aarch64
rm p2pool-v3.10-macos-aarch64.tar.gz rm p2pool-v3.10-macos-aarch64.tar.gz
# download p2pool into directory macos-x64 # download p2pool into directory macos-x64
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-macos-x64.tar.gz wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-macos-x64.tar.gz
tar -xf p2pool-v3.10-macos-x64.tar.gz tar -xf p2pool-v3.10-macos-x64.tar.gz
mv p2pool-v3.10-macos-x64/p2pool /tmp/${FOLDER}/skel/macos-x64/Gupaxx.app/Contents/MacOS/p2pool/p2pool mv p2pool-v3.10-macos-x64/p2pool /tmp/${FOLDER}/skel/macos-x64_b/Gupaxx.app/Contents/MacOS/p2pool/p2pool
rm -r p2pool-v3.10-macos-x64 rm -r p2pool-v3.10-macos-x64
rm p2pool-v3.10-macos-x64.tar.gz rm p2pool-v3.10-macos-x64.tar.gz
# download p2pool into directory windows # download p2pool into directory windows
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-windows-x64.zip wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-windows-x64.zip
unzip p2pool-v3.10-windows-x64.zip unzip p2pool-v3.10-windows-x64.zip
mv p2pool-v3.10-windows-x64/p2pool.exe /tmp/${FOLDER}/skel/windows/P2Pool/p2pool.exe mv p2pool-v3.10-windows-x64/p2pool.exe /tmp/${FOLDER}/skel/windows_b/P2Pool/p2pool.exe
rm -r p2pool-v3.10-windows-x64 rm -r p2pool-v3.10-windows-x64
rm p2pool-v3.10-windows-x64.zip rm p2pool-v3.10-windows-x64.zip

View file

@ -6,16 +6,25 @@
[[ -f windows.zip ]]; check "windows zip" [[ -f windows.zip ]]; check "windows zip"
[[ -f macos.zip ]]; check "macos zip" [[ -f macos.zip ]]; check "macos zip"
unzip linux.zip; unzip macos.zip; unzip windows.zip unzip linux.zip; unzip macos.zip; unzip windows.zip
tar -xf windows.tar
mv gupaxx.exe skel/windows/Gupaxx.exe mv gupaxx.exe skel/windows/Gupaxx.exe
mv gupaxx_b.exe skel/windows_b/Gupaxx.exe
tar -xf linux.tar tar -xf linux.tar
mv gupaxx skel/linux/gupaxx mv gupaxx skel/linux/gupaxx
mv gupaxx_b skel/linux_b/gupaxx
tar -xf macos.tar tar -xf macos.tar
mv Gupaxx-macos-x64.app/Contents/Info.plist skel/macos-x64/Gupaxx.app/Contents/Info.plist mv Gupaxx-macos-x64.app/Contents/Info.plist skel/macos-x64/Gupaxx.app/Contents/Info.plist
mv Gupaxx-macos-x64.app/Contents/MacOS/gupaxx skel/macos-x64/Gupaxx.app/Contents/MacOS/gupaxx mv Gupaxx-macos-x64.app/Contents/MacOS/gupaxx skel/macos-x64/Gupaxx.app/Contents/MacOS/gupaxx
mv Gupaxx-macos-arm64.app/Contents/MacOS/gupaxx skel/macos-arm64/Gupaxx.app/Contents/MacOS/gupaxx mv Gupaxx-macos-x64.app_b/Contents/Info.plist skel/macos-x64_b/Gupaxx.app/Contents/Info.plist
mv Gupaxx-macos-x64.app_b/Contents/MacOS/gupaxx skel/macos-x64_b/Gupaxx.app/Contents/MacOS/gupaxx
mv Gupaxx-macos-arm64.app/Contents/Info.plist skel/macos-arm64/Gupaxx.app/Contents/Info.plist mv Gupaxx-macos-arm64.app/Contents/Info.plist skel/macos-arm64/Gupaxx.app/Contents/Info.plist
mv Gupaxx-macos-arm64.app/Contents/MacOS/gupaxx skel/macos-arm64/Gupaxx.app/Contents/MacOS/gupaxx
mv Gupaxx-macos-arm64.app_b/Contents/Info.plist skel/macos-arm64_b/Gupaxx.app/Contents/Info.plist
mv Gupaxx-macos-arm64.app_b/Contents/MacOS/gupaxx skel/macos-arm64_b/Gupaxx.app/Contents/MacOS/gupaxx
rm -r Gupaxx-macos-x64.app rm -r Gupaxx-macos-x64.app
rm -r Gupaxx-macos-arm64.app rm -r Gupaxx-macos-arm64.app
rm -r Gupaxx-macos-x64.app_b
rm -r Gupaxx-macos-arm64.app_b
rm linux.zip; rm macos.zip; rm windows.zip rm linux.zip; rm macos.zip; rm windows.zip
# windows unzip only the exe so not tar to delete. # windows unzip only the exe so not tar to delete.
rm linux.tar; rm macos.tar rm linux.tar; rm macos.tar; rm windows.tar

View file

@ -30,75 +30,76 @@ cd skel; check "CD into skel"
# and that the naming schemes are correct # and that the naming schemes are correct
title "Linux folder check" title "Linux folder check"
[[ -f linux/gupaxx ]]; check "linux/gupaxx" [[ -f linux/gupaxx ]]; check "linux/gupaxx"
[[ -f linux/p2pool/p2pool ]]; check "linux/p2pool/p2pool" [[ -f linux_b/gupaxx ]]; check "linux_b/gupaxx"
[[ -f linux/xmrig/xmrig ]]; check "linux/xmrig/xmrig" [[ -f linux_b/p2pool/p2pool ]]; check "linux_b/p2pool/p2pool"
[[ -f linux_b/xmrig/xmrig ]]; check "linux_b/xmrig/xmrig"
title "macOS-x64 folder check" title "macOS-x64 folder check"
[[ -d macos-x64/Gupaxx.app ]]; check "macos-x64/Gupaxx.app" [[ -d macos-x64/Gupaxx.app ]]; check "macos-x64/Gupaxx.app"
[[ -f macos-x64/Gupaxx.app/Contents/MacOS/p2pool/p2pool ]]; check "macos-x64/p2pool/p2pool" [[ -d macos-x64_b/Gupaxx.app ]]; check "macos-x64_b/Gupaxx.app"
[[ -f macos-x64/Gupaxx.app/Contents/MacOS/xmrig/xmrig ]]; check "macos-x64/xmrig/xmrig" [[ -f macos-x64_b/Gupaxx.app/Contents/MacOS/p2pool/p2pool ]]; check "macos-x64_b/p2pool/p2pool"
[[ -f macos-x64_b/Gupaxx.app/Contents/MacOS/xmrig/xmrig ]]; check "macos-x64_b/xmrig/xmrig"
title "macOS-arm64 folder check" title "macOS-arm64 folder check"
[[ -d macos-arm64/Gupaxx.app ]]; check "macos-arm64/Gupaxx.app" [[ -d macos-arm64/Gupaxx.app ]]; check "macos-arm64/Gupaxx.app"
[[ -f macos-arm64/Gupaxx.app/Contents/MacOS/p2pool/p2pool ]]; check "macos-arm64/p2pool/p2pool" [[ -d macos-arm64_b/Gupaxx.app ]]; check "macos-arm64_b/Gupaxx.app"
[[ -f macos-arm64/Gupaxx.app/Contents/MacOS/xmrig/xmrig ]]; check "macos-arm64/xmrig/xmrig" [[ -f macos-arm64_b/Gupaxx.app/Contents/MacOS/p2pool/p2pool ]]; check "macos-arm64_b/p2pool/p2pool"
[[ -f macos-arm64_b/Gupaxx.app/Contents/MacOS/xmrig/xmrig ]]; check "macos-arm64_b/xmrig/xmrig"
title "Windows folder check" title "Windows folder check"
[[ -f windows/Gupaxx.exe ]]; check "windows/Gupaxx.exe" [[ -f windows/Gupaxx.exe ]]; check "windows/Gupaxx.exe"
[[ -f windows/P2Pool/p2pool.exe ]]; check "windows/P2Pool/p2pool.exe" [[ -f windows_b/Gupaxx.exe ]]; check "windows_b/Gupaxx.exe"
[[ -f windows/XMRig/xmrig.exe ]]; check "windows/XMRig/xmrig.exe" [[ -f windows_b/P2Pool/p2pool.exe ]]; check "windows_b/P2Pool/p2pool.exe"
[[ -f windows_b/XMRig/xmrig.exe ]]; check "windows_b/XMRig/xmrig.exe"
# Tar Linux Bundle # Tar Linux Bundle
title "Tar Linux" title "Tar Linux"
# give execution permission # give execution permission
chmod +x linux/gupaxx chmod +x linux/gupaxx
chmod +x linux/p2pool/p2pool chmod +x linux_b/gupaxx
chmod +x linux/xmrig/xmrig chmod +x linux_b/p2pool/p2pool
mv linux "gupaxx-$NEW_VER-linux-x64-bundle"; check "linux -> gupaxx-$NEW_VER-linux-x64-bundle" chmod +x linux_b/xmrig/xmrig
mv linux_b "gupaxx-$NEW_VER-linux-x64-bundle"; check "linux -> gupaxx-$NEW_VER-linux-x64-bundle"
tar -czpf "gupaxx-${NEW_VER}-linux-x64-bundle.tar.gz" "gupaxx-$NEW_VER-linux-x64-bundle" --owner=lm --group=lm ; check "tar linux-bundle" tar -czpf "gupaxx-${NEW_VER}-linux-x64-bundle.tar.gz" "gupaxx-$NEW_VER-linux-x64-bundle" --owner=lm --group=lm ; check "tar linux-bundle"
# Tar Linux Standalone # Tar Linux Standalone
mv "gupaxx-$NEW_VER-linux-x64-bundle" "gupaxx-$NEW_VER-linux-x64-standalone"; check "gupaxx-$NEW_VER-linux-x64-bundle -> gupaxx-$NEW_VER-linux-x64-standalone" mv linux "gupaxx-$NEW_VER-linux-x64-standalone"
rm -r "gupaxx-$NEW_VER-linux-x64-standalone/p2pool"; check "rm gupaxx-$NEW_VER-linux-x64-standalone/p2pool"
rm -r "gupaxx-$NEW_VER-linux-x64-standalone/xmrig"; check "rm gupaxx-$NEW_VER-linux-x64-standalone/xmrig"
tar -czpf "gupaxx-${NEW_VER}-linux-x64-standalone.tar.gz" "gupaxx-$NEW_VER-linux-x64-standalone" --owner=lm --group=lm ; check "tar linux-standalone" tar -czpf "gupaxx-${NEW_VER}-linux-x64-standalone.tar.gz" "gupaxx-$NEW_VER-linux-x64-standalone" --owner=lm --group=lm ; check "tar linux-standalone"
# Remove dir # Remove dir
rm -r "gupaxx-$NEW_VER-linux-x64-standalone"; check "rm linux dir" rm -r "gupaxx-$NEW_VER-linux-x64-standalone"; check "rm linux dir"
rm -r "gupaxx-$NEW_VER-linux-x64-bundle"; check "rm linux_b dir"
# x64 # x64
# Tar macOS Bundle # Tar macOS Bundle
title "Tar macOS-x64" title "Tar macOS-x64"
mv macos-x64 "gupaxx-$NEW_VER-macos-x64-bundle"; check "macos-x64 -> gupaxx-$NEW_VER-macos-x64-bundle" mv macos-x64_b "gupaxx-$NEW_VER-macos-x64-bundle"; check "macos-x64_b -> gupaxx-$NEW_VER-macos-x64-bundle"
tar -czpf "gupaxx-${NEW_VER}-macos-x64-bundle.tar.gz" "gupaxx-$NEW_VER-macos-x64-bundle" --owner=lm --group=lm ; check "tar macos-bundle" tar -czpf "gupaxx-${NEW_VER}-macos-x64-bundle.tar.gz" "gupaxx-$NEW_VER-macos-x64-bundle" --owner=lm --group=lm ; check "tar macos-bundle"
# Tar macOS Standalone # Tar macOS Standalone
mv "gupaxx-$NEW_VER-macos-x64-bundle" "gupaxx-$NEW_VER-macos-x64-standalone"; check "gupaxx-$NEW_VER-macos-x64-bundle -> gupaxx-$NEW_VER-macos-x64-standalone" mv macos-x64 "gupaxx-$NEW_VER-macos-x64-standalone"; check "macos-x64 -> gupaxx-$NEW_VER-macos-x64-standalone"
rm -r "gupaxx-$NEW_VER-macos-x64-standalone/Gupaxx.app/Contents/MacOS/p2pool"; check "rm gupaxx-$NEW_VER-macos-x64-standalone/Gupaxx.app/Contents/MacOS/p2pool"
rm -r "gupaxx-$NEW_VER-macos-x64-standalone/Gupaxx.app/Contents/MacOS/xmrig"; check "rm gupaxx-$NEW_VER-macos-x64-standalone/Gupaxx.app/Contents/MacOS/xmrig/xmrig"
tar -czpf "gupaxx-${NEW_VER}-macos-x64-standalone.tar.gz" "gupaxx-$NEW_VER-macos-x64-standalone" --owner=lm --group=lm ; check "tar macos-x64-standalone" tar -czpf "gupaxx-${NEW_VER}-macos-x64-standalone.tar.gz" "gupaxx-$NEW_VER-macos-x64-standalone" --owner=lm --group=lm ; check "tar macos-x64-standalone"
# Remove dir # Remove dir
rm -r "gupaxx-$NEW_VER-macos-x64-standalone"; check "rm macos-x64 dir" rm -r "gupaxx-$NEW_VER-macos-x64-standalone"; check "rm macos-x64 dir"
rm -r "gupaxx-$NEW_VER-macos-x64-bundle"; check "rm macos-x64_b dir"
# ARM # ARM
# Tar macOS Bundle # Tar macOS Bundle
title "Tar macOS-arm64" title "Tar macOS-arm64"
mv macos-arm64 "gupaxx-$NEW_VER-macos-arm64-bundle"; check "macos-arm64 -> gupaxx-$NEW_VER-macos-arm64-bundle" mv macos-arm64_b "gupaxx-$NEW_VER-macos-arm64-bundle"; check "macos-arm64_b -> gupaxx-$NEW_VER-macos-arm64-bundle"
tar -czpf "gupaxx-${NEW_VER}-macos-arm64-bundle.tar.gz" "gupaxx-$NEW_VER-macos-arm64-bundle" --owner=lm --group=lm ; check "tar macos-arm64-bundle" tar -czpf "gupaxx-${NEW_VER}-macos-arm64-bundle.tar.gz" "gupaxx-$NEW_VER-macos-arm64-bundle" --owner=lm --group=lm ; check "tar macos-bundle"
# Tar macOS Standalone # Tar macOS Standalone
mv "gupaxx-$NEW_VER-macos-arm64-bundle" "gupaxx-$NEW_VER-macos-arm64-standalone"; check "gupaxx-$NEW_VER-macos-arm64-bundle -> gupaxx-$NEW_VER-macos-arm64-standalone" mv macos-arm64 "gupaxx-$NEW_VER-macos-arm64-standalone"; check "macos-arm64 -> gupaxx-$NEW_VER-macos-arm64-standalone"
rm -r "gupaxx-$NEW_VER-macos-arm64-standalone/Gupaxx.app/Contents/MacOS/p2pool"; check "rm gupaxx-$NEW_VER-macos-arm64-standalone/Gupaxx.app/Contents/MacOS/p2pool"
rm -r "gupaxx-$NEW_VER-macos-arm64-standalone/Gupaxx.app/Contents/MacOS/xmrig"; check "rm gupaxx-$NEW_VER-macos-arm64-standalone/Gupaxx.app/Contents/MacOS/xmrig/xmrig"
tar -czpf "gupaxx-${NEW_VER}-macos-arm64-standalone.tar.gz" "gupaxx-$NEW_VER-macos-arm64-standalone" --owner=lm --group=lm ; check "tar macos-arm64-standalone" tar -czpf "gupaxx-${NEW_VER}-macos-arm64-standalone.tar.gz" "gupaxx-$NEW_VER-macos-arm64-standalone" --owner=lm --group=lm ; check "tar macos-arm64-standalone"
# Remove dir # Remove dir
rm -r "gupaxx-$NEW_VER-macos-arm64-standalone"; check "rm macos dir" rm -r "gupaxx-$NEW_VER-macos-arm64-standalone"; check "rm macos-arm64 dir"
rm -r "gupaxx-$NEW_VER-macos-arm64-bundle"; check "rm macos-arm64_b dir"
# Zip Windows Bundle # Zip Windows Bundle
title "Zip Windows" title "Zip Windows"
mv windows "gupaxx-$NEW_VER-windows-x64-bundle"; check "windows -> gupaxx-$NEW_VER-windows-x64-bundle" mv windows_b "gupaxx-$NEW_VER-windows-x64-bundle"; check "windows_b -> gupaxx-$NEW_VER-windows-x64-bundle"
zip -qr "gupaxx-${NEW_VER}-windows-x64-bundle.zip" "gupaxx-$NEW_VER-windows-x64-bundle"; check "zip windows-bundle" zip -qr "gupaxx-${NEW_VER}-windows-x64-bundle.zip" "gupaxx-$NEW_VER-windows-x64-bundle"; check "zip windows-bundle"
# Zip Windows Standalone # Zip Windows Standalone
mv "gupaxx-$NEW_VER-windows-x64-bundle" "gupaxx-$NEW_VER-windows-x64-standalone"; check "gupaxx-$NEW_VER-windows-x64-bundle -> gupaxx-$NEW_VER-windows-x64-standalone" mv windows "gupaxx-$NEW_VER-windows-x64-standalone"; check "windows -> gupaxx-$NEW_VER-windows-x64-standalone"
rm -r "gupaxx-$NEW_VER-windows-x64-standalone/P2Pool"; check "rm gupaxx-$NEW_VER-windows-x64-standalone/p2pool"
rm -r "gupaxx-$NEW_VER-windows-x64-standalone/XMRig"; check "rm gupaxx-$NEW_VER-windows-x64-standalone/xmrig"
zip -qr "gupaxx-${NEW_VER}-windows-x64-standalone.zip" "gupaxx-$NEW_VER-windows-x64-standalone"; check "zip windows-standalone" zip -qr "gupaxx-${NEW_VER}-windows-x64-standalone.zip" "gupaxx-$NEW_VER-windows-x64-standalone"; check "zip windows-standalone"
# Remove dir # Remove dir
rm -r "gupaxx-$NEW_VER-windows-x64-standalone"; check "rm windows dir" rm -r "gupaxx-$NEW_VER-windows-x64-standalone"; check "rm windows dir"
rm -r "gupaxx-$NEW_VER-windows-x64-bundle"; check "rm windows_b dir"
# SHA256SUMS + Sign # SHA256SUMS + Sign
title "Hash + Sign" title "Hash + Sign"

View file

View file

View file

View file