update memory
Написал алгоритм сжатия совместимый с UTF-8. Не очень эффективный, экономит 10-15% на тексте. Добавил генератор стартовой памяти, убран хардкод из MMC
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
-- generate_init_fs.lua
|
||||
-- Генерирует начальный образ SEG0 с man-страницами в /etc/man/
|
||||
-- Использует экспортированное FS API из MMC.lua
|
||||
-- Запуск: lua tools/generate_init_fs.lua > tools/init.amem
|
||||
|
||||
local base = arg and arg[0] and arg[0]:match("(.+)/") or "."
|
||||
dofile(base .. "/../MMC.lua")
|
||||
|
||||
FS.init()
|
||||
|
||||
FS.addUser(0, "root", 0, "/", "-")
|
||||
FS.addUser(100, "captain", 10, "/home/captain", "-")
|
||||
|
||||
FS.mkdir("/home", "755", 0, 0)
|
||||
FS.mkdir("/home/captain", "700", 100, 10)
|
||||
FS.mkfile("/home/captain/readme.txt", "Welcome to AtlasOS v2.0!\n", "644", 100, 10)
|
||||
FS.mkdir("/etc", "755", 0, 0)
|
||||
FS.mkdir("/etc/man", "755", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/help", [[NAME
|
||||
help - display help information
|
||||
|
||||
SYNOPSIS
|
||||
help
|
||||
|
||||
DESCRIPTION
|
||||
Show a list of all available commands with their usage
|
||||
and description.
|
||||
]], "644", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/echo", [[NAME
|
||||
echo - display a line of text
|
||||
|
||||
SYNOPSIS
|
||||
echo <text>
|
||||
|
||||
DESCRIPTION
|
||||
Write the given text to the terminal output.
|
||||
]], "644", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/clear", [[NAME
|
||||
clear - clear the terminal screen
|
||||
|
||||
SYNOPSIS
|
||||
clear
|
||||
|
||||
DESCRIPTION
|
||||
Clear all text from the terminal display.
|
||||
]], "644", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/color", [[NAME
|
||||
color - set terminal text color
|
||||
|
||||
SYNOPSIS
|
||||
color <R> <G> <B>
|
||||
|
||||
DESCRIPTION
|
||||
Change the text color for subsequent output.
|
||||
Each value must be 0-255 (red, green, blue).
|
||||
]], "644", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/status", [[NAME
|
||||
status - show system status
|
||||
|
||||
SYNOPSIS
|
||||
status
|
||||
|
||||
DESCRIPTION
|
||||
Display system information including current user,
|
||||
working directory, and memory usage.
|
||||
]], "644", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/ls", [[NAME
|
||||
ls - list directory contents
|
||||
|
||||
SYNOPSIS
|
||||
ls [-la] [path]
|
||||
|
||||
DESCRIPTION
|
||||
List contents of a directory. If no path is given,
|
||||
list the current directory.
|
||||
|
||||
OPTIONS
|
||||
-a Include hidden entries (. and ..)
|
||||
-l Long format (detailed listing)
|
||||
]], "644", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/cat", [[NAME
|
||||
cat - concatenate and display files
|
||||
|
||||
SYNOPSIS
|
||||
cat <path>
|
||||
|
||||
DESCRIPTION
|
||||
Read a file and display its contents on the terminal.
|
||||
]], "644", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/cd", [[NAME
|
||||
cd - change the working directory
|
||||
|
||||
SYNOPSIS
|
||||
cd [path]
|
||||
|
||||
DESCRIPTION
|
||||
Change the current working directory. If no path
|
||||
is given, go to root (/). Supports both absolute
|
||||
and relative paths.
|
||||
]], "644", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/stat", [[NAME
|
||||
stat - show file metadata
|
||||
|
||||
SYNOPSIS
|
||||
stat <path>
|
||||
|
||||
DESCRIPTION
|
||||
Display metadata for a file or directory, including
|
||||
inode number, type, permissions, owner, group, size,
|
||||
and modification time.
|
||||
]], "644", 0, 0)
|
||||
|
||||
FS.mkfile("/etc/man/man", [[NAME
|
||||
man - display manual page
|
||||
|
||||
SYNOPSIS
|
||||
man <command>
|
||||
|
||||
DESCRIPTION
|
||||
Display the manual page for a command. Manual pages
|
||||
are stored in /etc/man/.
|
||||
|
||||
EXAMPLE
|
||||
man ls
|
||||
man cat
|
||||
|
||||
SEE ALSO
|
||||
help
|
||||
]], "644", 0, 0)
|
||||
|
||||
print(FS.serialize())
|
||||
Reference in New Issue
Block a user