Skip to content
Merged
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ CLEAN_LOG = @printf ' $(CCCOLOR)CLEAN$(ENDCOLOR) $(BINCOLOR)%b$(ENDCOLOR)\n'
STRIP = strip
# Formater.
FORMATER = clang-format -i
SRC = src/*.c
SRC = src/*.c src/easteregg/*.c
HEADER = src/include/*.h
# Checker.
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 = 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 = 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 Down
7 changes: 7 additions & 0 deletions build.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,15 @@ void build()
for (int i = 0; catsh_files && catsh_files[i] != NULL; i++) {
add_args(&files, catsh_files[i]);
}
char easteregg_src_rma[PATH_MAX];
sprintf(easteregg_src_rma, "%s/easteregg", SRC_DIR);
char **easteregg_rma_files = find_file(easteregg_src_rma, ".c", NULL);
for (int i = 0; easteregg_rma_files && easteregg_rma_files[i] != NULL; i++) {
add_args(&files, easteregg_rma_files[i]);
}
compile_files_parallel(files, JOBS);
free_args(easteregg_files);
free_args(easteregg_rma_files);
free_args(catsh_files);
free_args(files);
// Link
Expand Down
2 changes: 1 addition & 1 deletion src/catsh
Submodule catsh updated 4 files
+13 −7 README.md
+27 −6 src/catsh.c
+6 −1 src/include/catsh.h
+4 −2 tests/demo.c
143 changes: 143 additions & 0 deletions src/easteregg/daijin.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
// SPDX-License-Identifier: MIT
/*
*
* This file is part of rurima, with ABSOLUTELY NO WARRANTY.
*
* MIT License
*
* Copyright (c) 2025 Moe-hacker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
#include "daijin.h"
// NOLINTNEXTLINE
static short x_win, y_win;
static size_t strlen_char32_rma(const char32_t *_Nonnull str)
{
size_t len = 0;
// clang-format off
while (str[len] != U'\0') {
len++;
}
// clang-format on
return len;
}
static void print_art(int x, bool clear)
{
// clang-format off
char32_t art[][128] = {
U" ⣀⠤⠤⠤⠤⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
U"⣰⠋⠁⠀⠀⠀⠀⠀⠈⠲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
U"⢯⣀⣀⣀⡀⠀⠀⠀⠀⠀⠈⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⢀⠀⠀⠀⠀⠀⠀⠀",
U"⠀⠀⠠⣏⠀⡀⠀⢀⡀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⢀⣀⠤⠔⠂⠁⠀⠀⠀⠀⠉⠰⢄⠀⠀⠀⠀",
U"⠀⠀⠀⠀⠀⠈⠉⠒⢌⢳⠀⠀⢹⠀⠀⠀⢞⠩⠃⣀⠖⠂⠀⠀⠀⠀⠀⡴⣧⡒⢤⡀⠱⡄⠀⠀",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠈⣦⡇⠀⢸⠀⠀⠀⢈⡶⠚⠁⣀⠀⠀⠀⠀⠀⠀⡇⠈⠿⣷⣿⣄⠙⣦⡄",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⣼⣀⣠⠔⣁⣠⣴⣾⠀⠀⠀⠀⠀⠀⠀⠱⡀⠤⠘⠿⡿⠁⠈⣴",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡆⠀⣿⣿⣿⢿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠉⠒⠒⠉⠀⠀⠀⢺",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⢰⣏⠊⢕⡒⠾⡯⣭⣽⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠏",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⠀⣼⠈⠀⠀⠈⠉⠙⠋⠋⡇⠔⠁⠀⠀⠀⠀⠀⡀⠀⢠⣀⣤⠾⠁⠀",
U" ⢠⡇⠀⠏⠀⠀⠀⠀⠀⠀⠀⠀⢙⠦⠒⠒⢺⣁⠤⠊⠧⠔⢡⡟⠁⠀⠀ ",
U"⠀⠀⠀⠀⠀⠀⠀⠀⣸⠂⢸⡀⠀⠀⠀⠀⠀⣀⠤⠄⠛⠂⠀⠐⠊⠁⠀⠀⠀⠀⠈⣣⠀⠀⠀⠀",
U"⠀⠀⠀⠀⠀⠀⠀⠀⡟⠀⢸⠀⠀⠀⠀⢠⣞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⡀⠀⠀⠀",
U"⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠸⡄⠀⠀⠀⡼⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⡏⠀⠀⠀⠀",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⢱⡀⠀⢰⡇⠀⠀⠀⠀⠀⢠⣀⠀⠀⠀⠀⠀⢠⠀⢹⠀⠀⠀⠀⠀",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣕⣊⠹⢆⣼⡧⡀⠀⠀⠀⠀⠀⠳⢨⠀⠀⠀⠀⡆⠀⣿⠀⠀⠀⠀⠀",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⢗⢠⠀⠳⡌⠒⠀⠀⠀⠀⠀⠀⡆⠀⠀⢰⠁⠈⠇⠀⠀⠀⠀⠀",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠁⠓⢿⣤⣀⠀⠀⠀⠀⠀⣇⠀⠀⣸⠈⠉⢳⠀⠀⠀⠀⠀",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠶⢤⣄⡀⠀⢀⣸⡄⠀⣠⣱⡼⠟⠀⠀⠀⠀⠀",
U"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠈⠑⠋⠉⠁⠀⠀⠀⠀⠀⠀"};
// clang-format on
size_t lines = sizeof(art) / sizeof(art[0]);
for (short i = 0; i < y_win - lines - 1; i++) {
printf("\n");
}
fflush(stdout);
for (size_t i = 0; i < lines; i++) {
char32_t *line = art[i];
size_t line_len = strlen_char32_rma(line);
for (short k = 0; k < (x_win - line_len) / 2; k++) {
printf(" ");
}
fflush(stdout);
for (size_t j = 0; j < line_len; j++) {
if ((i + x > (line_len - j) / 3 + 18) && clear) {
printf(" ");
continue;
}
if (!clear) {
if ((i + 10 < x + j / 3) && x > 0) {
printf("\033[0m");
} else if ((i + 10 < x + j / 3 + 1) && x > 0) {
printf("\033[37m");
} else {
printf("\033[38;2;254;228;208m");
}
fflush(stdout);
}
char character[64] = { '\0' };
mbstate_t state = { 0 };
size_t len = c32rtomb(character, line[j], &state);
if (len == (size_t)-1) {
perror("c32rtomb");
return;
}
character[len] = '\0';
printf("%s", character);
fflush(stdout);
}
printf("\n");
}
printf("\033[0m");
fflush(stdout);
}
void rurima_QwQ(void)
{
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
x_win = w.ws_col;
y_win = w.ws_row;
if (x_win < 60 || y_win < 30) {
fprintf(stderr, "Please resize your terminal to at least 60x30 and try again.\n");
return;
}
printf("\033[?25l");
printf("\033[?1049h");
setlocale(LC_CTYPE, "");
printf("\033[H\033[2J");
print_art(0, false);
sleep(2);
for (int i = 0; i < 30; i++) {
printf("\033[H\033[2J");
fflush(stdout);
print_art(i, false);
usleep(100000);
}
sleep(2);
for (int i = 0; i < 30; i++) {
printf("\033[H\033[2J");
fflush(stdout);
print_art(i, true);
usleep(50000);
}
printf("\033[H\033[2J");
printf("\033[?1049l");
printf("\033[?25h");
}
55 changes: 55 additions & 0 deletions src/easteregg/daijin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT
/*
*
* This file is part of rurima, with ABSOLUTELY NO WARRANTY.
*
* MIT License
*
* Copyright (c) 2025 Moe-hacker
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
// NOLINTERNEXTLINE
#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdatomic.h>
#include <sys/syscall.h>
#include <uchar.h>
#include <locale.h>
// This program should be compiled with -lpthread.
#include <pthread.h>
#ifndef _Nullable
#define _Nullable
#endif
#ifndef _Nonnull
#define _Nonnull
#endif
void rurima_QwQ(void);
1 change: 1 addition & 0 deletions src/include/rurima.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
#include "version.h"
#include "../ruri/src/include/ruri.h"
#include "../catsh/src/include/catsh.h"
#include "../easteregg/daijin.h"
struct RURIMA_CONFIG {
char *_Nonnull docker_mirror;
char *_Nonnull lxc_mirror;
Expand Down
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ int main(int argc, char **argv)
rurima_load_rootfs(argc - i - 1, &argv[i + 1]);
return 0;
}
if (strcmp(argv[i], "QwQ") == 0) {
rurima_QwQ();
return 0;
}
show_help();
rurima_error("{red}Invalid subcommand `%s`!\n", argv[i]);
return 1;
Expand Down
Loading