From b8f965f88d25d48dd6b1adf32e2978cb1b90d1f6 Mon Sep 17 00:00:00 2001 From: Moe-hacker Date: Thu, 20 Nov 2025 18:03:29 +0800 Subject: [PATCH 1/8] doc: update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 30a2b22..bffe543 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,10 @@ [![Build release](https://github.com/RuriOSS/rurima/actions/workflows/build.yml/badge.svg)](https://github.com/RuriOSS/rurima/actions/workflows/build.yml) ![](https://img.shields.io/badge/Powered%20By-GNU%20C-00d000?style=flat&labelColor=gray&logo=C) + +# Send us your feedback! +Your use case, your suggestions, and some ideas, anyway, we would love to hear from you! +[Discussions](https://github.com/RuriOSS/rurima/discussions/16) # What's new: - Some other OCI compatible registry support like ghcr.io could work with `-f/--fallback` option enabled now. # The first release: From c4491ae3e3e51313daf696ad1f37b59fa3c90279 Mon Sep 17 00:00:00 2001 From: Moe-hacker Date: Sun, 23 Nov 2025 21:19:45 +0800 Subject: [PATCH 2/8] non: sync catsh update --- src/catsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/catsh b/src/catsh index 10cd136..0323143 160000 --- a/src/catsh +++ b/src/catsh @@ -1 +1 @@ -Subproject commit 10cd1368bbd1bd5b34214b05114fee9aeaba8b11 +Subproject commit 032314350ae0fac7f7f9b5d07a070267b70e66ae From af44f4a8049fc8f82cf49459a42cf9f1815ed68d Mon Sep 17 00:00:00 2001 From: Moe-hacker Date: Sun, 23 Nov 2025 21:24:47 +0800 Subject: [PATCH 3/8] non: update version code --- src/info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/info.c b/src/info.c index 6d8a537..8ea5973 100644 --- a/src/info.c +++ b/src/info.c @@ -52,8 +52,8 @@ void rurima_show_version_info(void) #if defined(RURI_COMMIT_ID) cprintf("{base}%s%s%s", "built-in ruri commit id .........: ", RURI_COMMIT_ID, "\n"); #endif -#if defined(LIBCAP_MAJOR) && defined(LIBCAP_MINOR) - cprintf("{base}%s%d%s%d%s", "libcap ..........................: ", LIBCAP_MAJOR, ".", LIBCAP_MINOR, "\n"); +#if defined(CTH_VERSION_STRING) + cprintf("{base}%s%s%s", "built-in catsh version ..........: ", CTH_VERSION_STRING, "\n"); #endif cprintf("{base}%s%s\n", "Compiler version ................: ", __VERSION__); cprintf("{base}%s%s\n", "Build date ......................: ", __TIMESTAMP__); From aa498f5149c7f2eeb4004cd73229e302a113747d Mon Sep 17 00:00:00 2001 From: Moe-hacker Date: Sun, 23 Nov 2025 21:26:45 +0800 Subject: [PATCH 4/8] non: sync catsh update --- src/catsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/catsh b/src/catsh index 0323143..a76391e 160000 --- a/src/catsh +++ b/src/catsh @@ -1 +1 @@ -Subproject commit 032314350ae0fac7f7f9b5d07a070267b70e66ae +Subproject commit a76391e63d33828c6e16a1372464f3824ad422ee From 8548afa020d34f00258297d9b8f3a596a750d2b1 Mon Sep 17 00:00:00 2001 From: Moe-hacker Date: Sun, 23 Nov 2025 21:47:13 +0800 Subject: [PATCH 5/8] non: improve performance of show_progress() --- src/archive.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/archive.c b/src/archive.c index a133227..1fb8c86 100644 --- a/src/archive.c +++ b/src/archive.c @@ -168,6 +168,14 @@ static void show_progress(double per) if (rurima_global_config.no_progress) { return; } + if (per < 0.0 || per > 1.0) { + return; + } + static double last_per = 0.0; + if (per - last_per < 0.005 && per < 1.0) { + return; + } + last_per = per; struct winsize size; ioctl(STDOUT_FILENO, TIOCGWINSZ, &size); unsigned short width = size.ws_col - 10; @@ -188,6 +196,7 @@ static void show_progress_with_line(float per, int line) { /* * Show progress bar. + * Callback function for cth_exec_with_file_input(). */ if (rurima_global_config.no_progress) { return; From 834cb750f5055ac404982099573b69ec98e00b54 Mon Sep 17 00:00:00 2001 From: Moe-hacker Date: Sun, 23 Nov 2025 22:07:07 +0800 Subject: [PATCH 6/8] doc: update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bffe543..5f4589f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,11 @@ # Send us your feedback! Your use case, your suggestions, and some ideas, anyway, we would love to hear from you! -[Discussions](https://github.com/RuriOSS/rurima/discussions/16) +[Discussions](https://github.com/RuriOSS/rurima/discussions/16) +# Also, keep up to date: +Some updates and news will be posted on: +[Twitter(X)](https://x.com/RuriOSS) +And, dont forget to `rurima ota` to get the latest build! # What's new: - Some other OCI compatible registry support like ghcr.io could work with `-f/--fallback` option enabled now. # The first release: From 38f7159c527d052975bb12f5f1511a5571440f54 Mon Sep 17 00:00:00 2001 From: Moe-hacker Date: Mon, 24 Nov 2025 10:51:16 +0800 Subject: [PATCH 7/8] feat: import ssfx submodule --- .gitignore | 1 + .gitmodules | 3 +++ Makefile | 9 +++++++-- build.c | 6 ++++++ src/catsh | 2 +- src/include/rurima.h | 4 +++- src/main.c | 4 ++++ src/ruri | 2 +- src/ssfx | 1 + src/subcommand.c | 34 ++++++++++++++++++++++++++++++++++ 10 files changed, 61 insertions(+), 5 deletions(-) create mode 160000 src/ssfx diff --git a/.gitignore b/.gitignore index 8062af6..1e5190e 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,4 @@ docs/.vitepress/cache docs/.vitepress/.temp docs/.vitepress/dist node_modules +sfx \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 5edc699..fe8db4c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "src/catsh"] path = src/catsh url = https://github.com/rurioss/catsh +[submodule "src/ssfx"] + path = src/ssfx + url = https://github.com/rurioss/ssfx diff --git a/Makefile b/Makefile index ef67188..38ba7d3 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ CHECKER = clang-tidy CHECKER_FLAGS = --checks=*,-clang-analyzer-security.insecureAPI.strcpy,-altera-unroll-loops,-cert-err33-c,-concurrency-mt-unsafe,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,-readability-function-cognitive-complexity,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-bugprone-easily-swappable-parameters,-cert-err34-c,-misc-include-cleaner,-readability-identifier-length,-bugprone-signal-handler,-cert-msc54-cpp,-cert-sig30-c,-altera-id-dependent-backward-branch,-bugprone-suspicious-realloc-usage,-hicpp-signed-bitwise,-clang-analyzer-security.insecureAPI.UncheckedReturn -include config.mk # Target. -objects = easteregg/daijin.o catsh/src/catsh.o net.o checkdep.o dockerhub.o exec.o info.o lxcmirror.o shared.o signal.o archive.o subcommand.o main.o ruri/src/easteregg/action.o ruri/src/easteregg/nekofeng.o ruri/src/easteregg/layer.o ruri/src/easteregg/typewriter.o ruri/src/caplist.o ruri/src/chroot.o ruri/src/cprintf.o ruri/src/info.o ruri/src/rurienv.o ruri/src/rurifetch.o ruri/src/seccomp.o ruri/src/signal.o ruri/src/umount.o ruri/src/unshare.o ruri/src/rootless.o ruri/src/mount.o ruri/src/k2v.o ruri/src/elf-magic.o ruri/src/config.o ruri/src/cgroup.o ruri/src/passwd.o ruri/src/ps.o ruri/src/ruri.o +objects = ssfx/ssfx.o easteregg/daijin.o catsh/src/catsh.o net.o checkdep.o dockerhub.o exec.o info.o lxcmirror.o shared.o signal.o archive.o subcommand.o main.o ruri/src/easteregg/action.o ruri/src/easteregg/nekofeng.o ruri/src/easteregg/layer.o ruri/src/easteregg/typewriter.o ruri/src/caplist.o ruri/src/chroot.o ruri/src/cprintf.o ruri/src/info.o ruri/src/rurienv.o ruri/src/rurifetch.o ruri/src/seccomp.o ruri/src/signal.o ruri/src/umount.o ruri/src/unshare.o ruri/src/rootless.o ruri/src/mount.o ruri/src/k2v.o ruri/src/elf-magic.o ruri/src/config.o ruri/src/cgroup.o ruri/src/passwd.o ruri/src/ps.o ruri/src/ruri.o O = out BIN_TARGET = rurima .NOTPARALLEL: @@ -75,6 +75,7 @@ build_dir: @mkdir -p $(O)/ruri/src @mkdir -p $(O)/ruri/src/easteregg @mkdir -p $(O)/catsh/src + @mkdir -p $(O)/ssfx $(objects) :%.o:src/%.c $(build_dir) @cd $(O) @$(CC) $(CFLAGS) -c ../$< -o $@ @@ -103,4 +104,8 @@ help : @echo " make clean clean" @echo "Only for developers:" @echo " make check run clang-tidy" - @echo " make format format code" \ No newline at end of file + @echo " make format format code" +up : + git submodule update --init --recursive + git submodule foreach git pull origin main + git submodule foreach git checkout main \ No newline at end of file diff --git a/build.c b/build.c index 802453f..c56e1a9 100644 --- a/build.c +++ b/build.c @@ -665,6 +665,12 @@ void build() for (int i = 0; easteregg_rma_files && easteregg_rma_files[i] != NULL; i++) { add_args(&files, easteregg_rma_files[i]); } + char ssfx_src[PATH_MAX]; + sprintf(ssfx_src, "%s/ssfx", SRC_DIR); + char **ssfx_files = find_file(ssfx_src, ".c", (char *[]){ "main.c", NULL }); + for (int i = 0; ssfx_files && ssfx_files[i] != NULL; i++) { + add_args(&files, ssfx_files[i]); + } compile_files_parallel(files, JOBS); free_args(easteregg_files); free_args(easteregg_rma_files); diff --git a/src/catsh b/src/catsh index a76391e..9aff401 160000 --- a/src/catsh +++ b/src/catsh @@ -1 +1 @@ -Subproject commit a76391e63d33828c6e16a1372464f3824ad422ee +Subproject commit 9aff401e13a96664563c8e1d3b2c1e48d969ab57 diff --git a/src/include/rurima.h b/src/include/rurima.h index 7e97dbc..04df23e 100644 --- a/src/include/rurima.h +++ b/src/include/rurima.h @@ -69,6 +69,7 @@ #include "../ruri/src/include/ruri.h" #include "../catsh/src/include/catsh.h" #include "../easteregg/daijin.h" +#include "../ssfx/include/ssfx.h" struct RURIMA_CONFIG { char *_Nonnull docker_mirror; char *_Nonnull lxc_mirror; @@ -201,4 +202,5 @@ void rurima_ota(void); void rurima_run(int argc, char **_Nonnull argv); void rurima_netns_wrapper(int argc, char **argv); void rurima_load_rootfs(int argc, char **argv); -void rurima_docker_print_config_from_json(const char *_Nonnull config, const char *_Nonnull savedir); \ No newline at end of file +void rurima_docker_print_config_from_json(const char *_Nonnull config, const char *_Nonnull savedir); +void rurima_sfx(int argc, char **argv); \ No newline at end of file diff --git a/src/main.c b/src/main.c index fe081a4..e727c62 100644 --- a/src/main.c +++ b/src/main.c @@ -279,6 +279,10 @@ int main(int argc, char **argv) rurima_QwQ(); return 0; } + if (strcmp(argv[i], "sfx") == 0) { + rurima_sfx(argc - i - 1, &argv[i + 1]); + return 0; + } show_help(); rurima_error("{red}Invalid subcommand `%s`!\n", argv[i]); return 1; diff --git a/src/ruri b/src/ruri index 442f516..2e92fa6 160000 --- a/src/ruri +++ b/src/ruri @@ -1 +1 @@ -Subproject commit 442f516dd4272545fe659d15c24235c3e0c82123 +Subproject commit 2e92fa6710be1314ab36cf0787d4f2a7e24efbf2 diff --git a/src/ssfx b/src/ssfx new file mode 160000 index 0000000..2c58626 --- /dev/null +++ b/src/ssfx @@ -0,0 +1 @@ +Subproject commit 2c5862681e5109a3cb4b214ab095faa14586d90a diff --git a/src/subcommand.c b/src/subcommand.c index 98ac747..ae4d8fe 100644 --- a/src/subcommand.c +++ b/src/subcommand.c @@ -869,4 +869,38 @@ void rurima_load_rootfs(int argc, char **argv) rurima_check_dir_deny_list(tmp_dir); cth_exec_command((char *[]){ "rm", "-rf", tmp_dir, NULL }); exit(0); +} +void rurima_sfx(int argc, char **_Nonnull argv) +{ + // + if (self_is_valid_ssfx_master()) { + rurima_log("{base}This is a valid rurima sfx master executable.\n"); + } else if (self_is_valid_ssfx_pack()) { + rurima_log("{base}This is a valid rurima sfx packed executable.\n"); + } else if (self_is_valid_ssfx_other()) { + rurima_log("{base}This is a valid rurima sfx other executable.\n"); + } else { + rurima_log("{base}This is not a valid rurima sfx executable.\n"); + } + cprintf("{red}Warning: rurima sfx feature is in development, do not use it anyway!\n"); + // + if (argc == 0) { + rurima_error("{red}No subcommand specified!\n"); + } + if (strcmp(argv[0], "pack-self") == 0) { + if (argc < 3) { + rurima_error("{red}Usage: rurima sfx pack-self \n"); + } + char *tar_exe_path = argv[1]; + char *output_file = argv[2]; + rurima_check_dir_deny_list(output_file); + pack_ssfx_master(tar_exe_path, output_file); + cprintf("{yellow}Warning: this feature is only for developers!\n"); + cprintf("{yellow}Warning: make sure that tar and rurima executable are compatible with target system!\n"); + cprintf("{yellow}Warning: make sure that tar and rurima executable are statically linked!\n"); + exit(0); + } + if (!self_is_valid_ssfx_master()) { + rurima_error("{red}This executable is not a valid rurima sfx master!\n"); + } } \ No newline at end of file From 85a01943318a57386b828303d49af754e65f3dc7 Mon Sep 17 00:00:00 2001 From: Moe-hacker Date: Mon, 24 Nov 2025 10:53:27 +0800 Subject: [PATCH 8/8] non: update info.c --- src/info.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/info.c b/src/info.c index 8ea5973..d1fbadc 100644 --- a/src/info.c +++ b/src/info.c @@ -54,6 +54,9 @@ void rurima_show_version_info(void) #endif #if defined(CTH_VERSION_STRING) cprintf("{base}%s%s%s", "built-in catsh version ..........: ", CTH_VERSION_STRING, "\n"); +#endif +#if defined(SSFX_VERSION_STRING) + cprintf("{base}%s%s%s", "built-in ssfx version ...........: ", SSFX_VERSION_STRING, "\n"); #endif cprintf("{base}%s%s\n", "Compiler version ................: ", __VERSION__); cprintf("{base}%s%s\n", "Build date ......................: ", __TIMESTAMP__);