-- 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 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 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 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 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 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())