diff --git a/build.c b/build.c index a9db330..88cfb9b 100644 --- a/build.c +++ b/build.c @@ -837,6 +837,7 @@ int main(int argc, char **argv) check_and_add_lib("-lpthread", false); build(); remove_test_dot_c(); + printf("\n\nThis program has Super Neko Powers! >w<\n"); return 0; } diff --git a/doc/USAGE.md b/doc/USAGE.md index 4f2230c..6522f02 100644 --- a/doc/USAGE.md +++ b/doc/USAGE.md @@ -1,5 +1,8 @@ # Undocumented part: The `load`, `run`, `sfx` and `netns` subcommand is WIP, it should not be used by users. +# $PATH injection: +rurima will automatically add /path/to/rurima/ to the top of $PATH. +So you can just put required binaries like `tar/curl/jq/file` under the same dir of rurima, or do some wrapper script hacking. # Image source: rurima currently supports both lxc-mirror and dockerhub as container image source. # Unified image puller: diff --git a/src/archive.c b/src/archive.c index 1fb8c86..8124876 100644 --- a/src/archive.c +++ b/src/archive.c @@ -329,8 +329,15 @@ int rurima_backup_dir(char *_Nonnull file, char *_Nonnull dir) rurima_fork_rexec(rexec_args); if (!du_found()) { rurima_warning("{yellow}du not found, progress will not be shown.\n"); - int exstat = tar_backup__(file, dir); - return exstat; + pid_t pid = fork(); + if (pid > 0) { + int status; + waitpid(pid, &status, 0); + return WEXITSTATUS(status); + } else { + int exstat = tar_backup__(file, dir); + exit(exstat); + } } cprintf("{base}Getting total size to backup\n"); off_t totalsize = rurima_get_dir_file_size(dir); @@ -351,7 +358,7 @@ int rurima_backup_dir(char *_Nonnull file, char *_Nonnull dir) usleep(100); } show_progress(1.0); - return status; + return WEXITSTATUS(status); } else { int exstat = tar_backup__(file, dir); exit(exstat); diff --git a/src/include/rurima.h b/src/include/rurima.h index 04df23e..7daa36d 100644 --- a/src/include/rurima.h +++ b/src/include/rurima.h @@ -108,9 +108,9 @@ struct RURIMA_DOCKER { cfprintf(stderr, format, ##__VA_ARGS__); \ cfprintf(stderr, "{base}%s{clear}\n", " .^. .^."); \ cfprintf(stderr, "{base}%s{clear}\n", " /⋀\\_ノ_/⋀\\"); \ - cfprintf(stderr, "{base}%s{clear}\n", " /ノソノ\\ノソ丶)|"); \ + cfprintf(stderr, "{base}%s{clear}\n", " /ノソノ\\ノソ丶メ"); \ cfprintf(stderr, "{base}%s{clear}\n", " ルリリ > x )リ"); \ - cfprintf(stderr, "{base}%s{clear}\n", "ノノ㇏ ^ ノ|ノ"); \ + cfprintf(stderr, "{base}%s{clear}\n", "ノノ㇏ ^ ノノ"); \ cfprintf(stderr, "{base}%s{clear}\n", " ⠁⠁"); \ cfprintf(stderr, "{base}%s{clear}\n", "RURIMA ERROR MESSAGE"); \ cfprintf(stderr, "{base}%s{clear}\n", "Hint:"); \ diff --git a/src/info.c b/src/info.c index d1fbadc..8032b08 100644 --- a/src/info.c +++ b/src/info.c @@ -62,7 +62,7 @@ void rurima_show_version_info(void) cprintf("{base}%s%s\n", "Build date ......................: ", __TIMESTAMP__); cprintf("{base}\nThere is NO WARRANTY, to the extent permitted by law\n"); cprintf("{base}Docker is a registered trademark of Docker, Inc\nThis program has no relationship with it\n"); - cprintf("{base}\nThis program has Super Neko Powers!!!\n"); + cprintf("{base}\nThis program has Super Neko Powers! >w<\n"); cprintf("{clear}\n"); } // For `rurima -V`. diff --git a/src/ruri b/src/ruri index e612c43..c78a96d 160000 --- a/src/ruri +++ b/src/ruri @@ -1 +1 @@ -Subproject commit e612c43dba5caee3832283fa3ea448b10f92538c +Subproject commit c78a96d0acf37c401bac77c94c61a051adbb6f9f diff --git a/src/shared.c b/src/shared.c index 606b03c..33cfa8f 100644 --- a/src/shared.c +++ b/src/shared.c @@ -49,10 +49,10 @@ void end_loading_animation(void) { if (loading_animation_pid > 0) { kill(loading_animation_pid, SIGINT); - loading_animation_pid = 0; } waitpid(loading_animation_pid, NULL, 0); fflush(stdout); + loading_animation_pid = 0; } void loading_animation(char *msg) { diff --git a/src/signal.c b/src/signal.c index 269069b..ded9db7 100644 --- a/src/signal.c +++ b/src/signal.c @@ -43,9 +43,9 @@ static void panic(int sig) cfprintf(stderr, "{base}"); cfprintf(stderr, "{base}%s\n", " .^. .^."); cfprintf(stderr, "{base}%s\n", " /⋀\\_ノ_/⋀\\"); - cfprintf(stderr, "{base}%s\n", " /ノソノ\\ノソ丶)|"); + cfprintf(stderr, "{base}%s\n", " /ノソノ\\ノソ丶メ"); cfprintf(stderr, "{base}%s\n", " ルリリ > x )リ"); - cfprintf(stderr, "{base}%s\n", "ノノ㇏ ^ ノ|ノ"); + cfprintf(stderr, "{base}%s\n", "ノノ㇏ ^ ノノ"); cfprintf(stderr, "{base}%s\n", " ⠁⠁"); cfprintf(stderr, "{base}%s\n", "RURIMA ERROR MESSAGE"); cfprintf(stderr, "{base}Seems that it's time to abort.\n"); diff --git a/src/subcommand.c b/src/subcommand.c index 12be14d..e6c660d 100644 --- a/src/subcommand.c +++ b/src/subcommand.c @@ -55,6 +55,7 @@ static void docker_pull_try_mirrors(const char *_Nonnull image, const char *_Non rexec_argv[0] = NULL; for (int i = 0; try_mirrorlist[i] != NULL; i++) { cprintf("{base}Trying mirror: {cyan}%s\n", try_mirrorlist[i]); + rexec_argv[0] = NULL; rurima_add_argv(&rexec_argv, "docker"); rurima_add_argv(&rexec_argv, "pull"); rurima_add_argv(&rexec_argv, "-i"); @@ -812,14 +813,14 @@ void rurima_load_rootfs(int argc, char **argv) char manifest_path[PATH_MAX]; sprintf(manifest_path, "%s/manifest.json", tmp_dir); FILE *manifest_file = fopen(manifest_path, "r"); + if (!manifest_file) { + rurima_error("{red}Failed to open manifest.json!\n"); + } struct stat st; if (fstat(fileno(manifest_file), &st) != 0) { rurima_error("{red}Failed to stat manifest.json!\n"); } char *manifest_content = malloc(st.st_size + 1); - if (!manifest_file) { - rurima_error("{red}Failed to open manifest.json!\n"); - } fread(manifest_content, 1, st.st_size, manifest_file); manifest_content[st.st_size] = 0; fclose(manifest_file);