Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ docs/.vitepress/cache
docs/.vitepress/.temp
docs/.vitepress/dist
node_modules
sfx
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 $@
Expand Down Expand Up @@ -103,4 +104,8 @@ help :
@echo " make clean clean"
@echo "Only for developers:"
@echo " make check run clang-tidy"
@echo " make format format code"
@echo " make format format code"
up :
git submodule update --init --recursive
git submodule foreach git pull origin main
git submodule foreach git checkout main
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
[![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)
# 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:
Expand Down
6 changes: 6 additions & 0 deletions build.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions src/archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/catsh
Submodule catsh updated 4 files
+4 −1 README.md
+55 −15 src/catsh.c
+9 −3 src/include/catsh.h
+3 −0 tests/demo.c
4 changes: 3 additions & 1 deletion src/include/rurima.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
void rurima_docker_print_config_from_json(const char *_Nonnull config, const char *_Nonnull savedir);
void rurima_sfx(int argc, char **argv);
7 changes: 5 additions & 2 deletions src/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ 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
#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__);
Expand Down
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ruri
Submodule ruri updated from 442f51 to 2e92fa
1 change: 1 addition & 0 deletions src/ssfx
Submodule ssfx added at 2c5862
34 changes: 34 additions & 0 deletions src/subcommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <output_file> <input_dir>\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");
}
}