From 047b74f18750c45e83fa6f649112ad3afa40fa98 Mon Sep 17 00:00:00 2001 From: Kurisu Date: Tue, 10 Sep 2024 20:06:11 +0800 Subject: [PATCH 1/8] build: prepare for publish to cargo. --- Cargo.toml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 31460c4..599d10b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,11 +2,26 @@ name = "ssh-utils" version = "0.1.0" edition = "2021" +license = "MulanPSL-2.0" +description = "ssh-utils is a tool for fast ssh connections." +repository = "https://gitee.com/openeuler/ssh-utils" +readme = "README.md" +keywords = ["ssh", "tool", "tui", "cli"] +categories = ["command-line-utilities"] +include = [ + "src/*", + "README.md", + "Cargo.toml" +] [lib] name = "ssh_utils_lib" path = "src/lib.rs" +[[bin]] +name = "ssh-utils" +path = "src/main.rs" + [features] integration_tests = [] -- Gitee From f0ffd72dc9e17b4bab0c0607e9e85e993e41f466 Mon Sep 17 00:00:00 2001 From: Kurisu Date: Tue, 10 Sep 2024 22:14:28 +0800 Subject: [PATCH 2/8] deps: enable `vendored` feature in openssl. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 599d10b..754ea73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ ratatui = "0.28" serde = { version = "1.0", features = ["derive"] } toml = "0.8.16" rand = "0.8.5" -openssl = "0.10.66" +openssl = { version = "0.10.66", features = ["vendored"] } sha2 = "0.10.8" rust-argon2 = "2.1.0" rpassword = "7.3.1" -- Gitee From 060374a526b4e3f6b6f26c585a64635d436505f0 Mon Sep 17 00:00:00 2001 From: Kurisu Date: Tue, 10 Sep 2024 23:31:19 +0800 Subject: [PATCH 3/8] build: add spec buld file. --- ssh-utils.spec | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 ssh-utils.spec diff --git a/ssh-utils.spec b/ssh-utils.spec new file mode 100644 index 0000000..7eccbf0 --- /dev/null +++ b/ssh-utils.spec @@ -0,0 +1,33 @@ +%define debug_package %{nil} + +Name: ssh-utils +Version: 0.1.0 +Release: 1%{?dist} +Summary: ssh-utils is a tool for fast ssh connections. + +License: MulanPSL-2.0 +URL: https://gitee.com/openeuler/ssh-utils +Source0: https://gitee.com/openeuler/ssh-utils/repository/archive/v0.1.0.zip + +BuildRequires: rust cargo openssl-devel + +%description +ssh-utils is a tool for fast ssh connections. + +%prep +%setup -q -n %{name}-v%{version} + +%build +cargo build --release + +%install +install -D -m 0755 target/release/ssh-utils %{buildroot}/usr/bin/ssh-utils + +%files +%license LICENSE +%doc README.md +/usr/bin/ssh-utils + +%changelog +* Tue Sep 10 2024 Kurisu - 0.1.0 + - Initial release. -- Gitee From ef36f39b886d350f7f4c68dbf6874ebb120a0b0f Mon Sep 17 00:00:00 2001 From: Kurisu Date: Wed, 11 Sep 2024 00:37:00 +0800 Subject: [PATCH 4/8] build: auto downlaod source files. --- ssh-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ssh-utils.spec b/ssh-utils.spec index 7eccbf0..202c813 100644 --- a/ssh-utils.spec +++ b/ssh-utils.spec @@ -9,12 +9,15 @@ License: MulanPSL-2.0 URL: https://gitee.com/openeuler/ssh-utils Source0: https://gitee.com/openeuler/ssh-utils/repository/archive/v0.1.0.zip -BuildRequires: rust cargo openssl-devel +BuildRequires: rust cargo openssl-devel wget %description ssh-utils is a tool for fast ssh connections. %prep +if [ ! -f %{_sourcedir}/v%{version}.zip ]; then + wget -O %{_sourcedir}/v%{version}.zip https://gitee.com/openeuler/ssh-utils/repository/archive/v%{version}.zip +fi %setup -q -n %{name}-v%{version} %build -- Gitee From 42f2c487626b470e603523d4e8b8e0488d32d92e Mon Sep 17 00:00:00 2001 From: Kurisu Date: Wed, 11 Sep 2024 00:37:18 +0800 Subject: [PATCH 5/8] build: add cross for cross-build. --- Cargo.lock | 10 ++++++++++ Cross.toml | 5 +++++ 2 files changed, 15 insertions(+) create mode 100644 Cross.toml diff --git a/Cargo.lock b/Cargo.lock index 5020f20..e51f4a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1134,6 +1134,15 @@ dependencies = [ "syn", ] +[[package]] +name = "openssl-src" +version = "300.3.2+3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.103" @@ -1142,6 +1151,7 @@ checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..daa7873 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,5 @@ +[target.x86_64-unknown-linux-gnu] +pre-build = [ + "dpkg --add-architecture $CROSS_DEB_ARCH", + "apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH" +] \ No newline at end of file -- Gitee From 20d95f3106c0c48f97026705b26b92c58c640a06 Mon Sep 17 00:00:00 2001 From: Kurisu Date: Wed, 11 Sep 2024 00:58:05 +0800 Subject: [PATCH 6/8] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A0=E5=AE=89?= =?UTF-8?q?=E8=A3=85=20openssl=20=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 4 ++++ README.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/README.en.md b/README.en.md index 797e66e..951705e 100644 --- a/README.en.md +++ b/README.en.md @@ -17,6 +17,8 @@ This tool provides a set of command-line utilities that allow you to select the ##### 1. Install via cargo ```bash +# OpenEuler : dnf install openssl-devel +# Debian/Ubuntu : apt install libssl-dev cargo install ssh-utils ``` @@ -25,6 +27,8 @@ Download the executable file or installation package for your platform from the ##### 3. Install from source code ```bash +# OpenEuler : dnf install openssl-devel +# Debian/Ubuntu : apt install libssl-dev git clone https://gitee.com/openeuler/ssh-utils cd ssh-utils cargo build --release diff --git a/README.md b/README.md index 4b097e5..b760f68 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ ##### 1. 通过 cargo 安装 ```bash +# OpenEuler : dnf install openssl-devel +# Debian/Ubuntu : apt install libssl-dev cargo install ssh-utils ``` @@ -24,6 +26,8 @@ cargo install ssh-utils ##### 3. 通过源码安装 ```bash +# OpenEuler : dnf install openssl-devel +# Debian/Ubuntu : apt install libssl-dev git clone https://gitee.com/openeuler/ssh-utils cd ssh-utils cargo build --release -- Gitee From 9f44c7f4de8045b220ae6211449579bb253fb529 Mon Sep 17 00:00:00 2001 From: Kurisu Date: Sat, 14 Sep 2024 20:16:21 +0800 Subject: [PATCH 7/8] fix: use `.tar.gz` instead `.zip`, change version to variable value. --- ssh-utils.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ssh-utils.spec b/ssh-utils.spec index 202c813..05e5613 100644 --- a/ssh-utils.spec +++ b/ssh-utils.spec @@ -7,7 +7,7 @@ Summary: ssh-utils is a tool for fast ssh connections. License: MulanPSL-2.0 URL: https://gitee.com/openeuler/ssh-utils -Source0: https://gitee.com/openeuler/ssh-utils/repository/archive/v0.1.0.zip +Source0: https://gitee.com/openeuler/ssh-utils/repository/archive/v%{version}.tar.gz BuildRequires: rust cargo openssl-devel wget @@ -15,8 +15,8 @@ BuildRequires: rust cargo openssl-devel wget ssh-utils is a tool for fast ssh connections. %prep -if [ ! -f %{_sourcedir}/v%{version}.zip ]; then - wget -O %{_sourcedir}/v%{version}.zip https://gitee.com/openeuler/ssh-utils/repository/archive/v%{version}.zip +if [ ! -f %{_sourcedir}/v%{version}.tar.gz ]; then + wget -O %{_sourcedir}/v%{version}.tar.gz https://gitee.com/openeuler/ssh-utils/repository/archive/v%{version}.tar.gz fi %setup -q -n %{name}-v%{version} -- Gitee From 74b1819f88923642116105897fbc45cd848d41bc Mon Sep 17 00:00:00 2001 From: Kurisu Date: Sat, 14 Sep 2024 21:45:43 +0800 Subject: [PATCH 8/8] chore: update compress file name. --- ssh-utils.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ssh-utils.spec b/ssh-utils.spec index 05e5613..a9ed99a 100644 --- a/ssh-utils.spec +++ b/ssh-utils.spec @@ -7,7 +7,7 @@ Summary: ssh-utils is a tool for fast ssh connections. License: MulanPSL-2.0 URL: https://gitee.com/openeuler/ssh-utils -Source0: https://gitee.com/openeuler/ssh-utils/repository/archive/v%{version}.tar.gz +Source0: https://gitee.com/openeuler/ssh-utils/repository/archive/v%{version}.tar.gz#/%{name}-v%{version}.tar.gz BuildRequires: rust cargo openssl-devel wget @@ -15,8 +15,8 @@ BuildRequires: rust cargo openssl-devel wget ssh-utils is a tool for fast ssh connections. %prep -if [ ! -f %{_sourcedir}/v%{version}.tar.gz ]; then - wget -O %{_sourcedir}/v%{version}.tar.gz https://gitee.com/openeuler/ssh-utils/repository/archive/v%{version}.tar.gz +if [ ! -f %{_sourcedir}/%{name}-v%{version}.tar.gz ]; then + wget -O %{_sourcedir}/%{name}-v%{version}.tar.gz https://gitee.com/openeuler/ssh-utils/repository/archive/v%{version}.tar.gz fi %setup -q -n %{name}-v%{version} -- Gitee