Compare commits
No commits in common. "33c1a9c92b8d94977ab48b7cc96b9c0c1962f6d1" and "e5905a33e15b281047f351357cb5096514c1177a" have entirely different histories.
33c1a9c92b
...
e5905a33e1
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,7 +5,6 @@ initrd/boot/moon
|
|||||||
env-local.sh
|
env-local.sh
|
||||||
initrd/bin/**
|
initrd/bin/**
|
||||||
base/usr/**
|
base/usr/**
|
||||||
base/etc/skel/LICENSE
|
|
||||||
.fakeroot
|
.fakeroot
|
||||||
kernel/config.cmake
|
kernel/config.cmake
|
||||||
ports/out/
|
ports/out/
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#include <luna/String.h>
|
#include <luna/String.h>
|
||||||
#include <os/ArgumentParser.h>
|
#include <os/ArgumentParser.h>
|
||||||
#include <os/File.h>
|
#include <os/File.h>
|
||||||
#include <os/FileSystem.h>
|
|
||||||
#include <os/Prompt.h>
|
|
||||||
|
|
||||||
using os::File;
|
using os::File;
|
||||||
|
|
||||||
@ -16,20 +14,10 @@ Result<int> luna_main(int argc, char** argv)
|
|||||||
parser.add_positional_argument(pathname, "path"_sv, true);
|
parser.add_positional_argument(pathname, "path"_sv, true);
|
||||||
parser.parse(argc, argv);
|
parser.parse(argc, argv);
|
||||||
|
|
||||||
if (os::FileSystem::exists(pathname))
|
|
||||||
{
|
|
||||||
String prompt = TRY(String::format("File %s already exists. Overwrite?"_sv, pathname.chars()));
|
|
||||||
bool overwrite = os::conditional_prompt(prompt.chars(), os::DefaultNo);
|
|
||||||
if (!overwrite) return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto file = TRY(File::open_or_create(pathname, File::WriteOnly));
|
auto file = TRY(File::open_or_create(pathname, File::WriteOnly));
|
||||||
|
|
||||||
auto input = File::standard_input();
|
auto input = File::standard_input();
|
||||||
|
|
||||||
os::println("- Editing %s. Press Enter to start a new line, or Ctrl+D at the start of a line to save and exit. -",
|
|
||||||
pathname.chars());
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
String line = TRY(input->read_line());
|
String line = TRY(input->read_line());
|
||||||
|
@ -323,7 +323,7 @@ static void mount_shmfs()
|
|||||||
if (chmod("/dev/shm", 01777) < 0) exit(255);
|
if (chmod("/dev/shm", 01777) < 0) exit(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> sysinit(StringView path)
|
Result<int> sysinit()
|
||||||
{
|
{
|
||||||
if (getpid() != 1)
|
if (getpid() != 1)
|
||||||
{
|
{
|
||||||
@ -358,8 +358,7 @@ Result<int> sysinit(StringView path)
|
|||||||
|
|
||||||
TRY(os::Security::pledge("stdio rpath wpath cpath proc exec id", nullptr));
|
TRY(os::Security::pledge("stdio rpath wpath cpath proc exec id", nullptr));
|
||||||
|
|
||||||
if (path.is_empty()) path = "/etc/init";
|
start_services("/etc/init");
|
||||||
start_services(path);
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -395,7 +394,7 @@ Result<int> sysinit(StringView path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> user_init(StringView path)
|
Result<int> user_init()
|
||||||
{
|
{
|
||||||
setpgid(0, 0);
|
setpgid(0, 0);
|
||||||
|
|
||||||
@ -406,8 +405,7 @@ Result<int> user_init(StringView path)
|
|||||||
|
|
||||||
TRY(os::Security::pledge("stdio rpath wpath cpath proc exec", nullptr));
|
TRY(os::Security::pledge("stdio rpath wpath cpath proc exec", nullptr));
|
||||||
|
|
||||||
if (path.is_empty()) path = "/etc/user";
|
start_services("/etc/user");
|
||||||
start_services(path);
|
|
||||||
|
|
||||||
TRY(os::Security::pledge("stdio rpath wpath proc exec", nullptr));
|
TRY(os::Security::pledge("stdio rpath wpath proc exec", nullptr));
|
||||||
|
|
||||||
@ -448,16 +446,13 @@ Result<int> user_init(StringView path)
|
|||||||
Result<int> luna_main(int argc, char** argv)
|
Result<int> luna_main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
bool user;
|
bool user;
|
||||||
StringView service_path;
|
|
||||||
|
|
||||||
os::ArgumentParser parser;
|
os::ArgumentParser parser;
|
||||||
parser.add_description("The init system for Luna.");
|
parser.add_description("The init system for Luna.");
|
||||||
parser.add_system_program_info("init"_sv);
|
parser.add_system_program_info("init"_sv);
|
||||||
parser.add_switch_argument(user, 'u', "user"_sv, "initialize a user session instead of the system");
|
parser.add_switch_argument(user, 'u', "user"_sv, "initialize a user session instead of the system");
|
||||||
parser.add_value_argument(service_path, 's', "service-path"_sv,
|
|
||||||
"change the default service path (/etc/init or /etc/user)");
|
|
||||||
parser.parse(argc, argv);
|
parser.parse(argc, argv);
|
||||||
|
|
||||||
if (user) return user_init(service_path);
|
if (user) return user_init();
|
||||||
return sysinit(service_path);
|
return sysinit();
|
||||||
}
|
}
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
Welcome to the Luna operating system!
|
|
||||||
You are running on the default user account, selene.
|
|
||||||
|
|
||||||
If you are familiar with Unix-style operating systems (like Linux or *BSD), you should be able to use the Luna terminal without much problems.
|
|
||||||
|
|
||||||
Following the traditional Unix filesystem structure, programs are installed in /usr/bin (/bin is a symlink to /usr/bin). The command `ls /bin` will show all commands available on your current Luna installation.
|
|
||||||
|
|
||||||
Currently, because of driver limitations, the root file system is mounted read-only. Your home folder is writable, but volatile; it is created and populated on boot, and its contents will vanish after a reboot.
|
|
||||||
|
|
||||||
The system is booted using the 'init' program. You can read its configuration files in the /etc/init directory to learn more about the boot process.
|
|
||||||
|
|
||||||
Luna is free software, released under the BSD-2-Clause license. The license is included in the LICENSE file in your home directory.
|
|
||||||
|
|
||||||
View the source code and read more about Luna at https://git.cloudapio.eu/apio/Luna.
|
|
@ -1,6 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Create and populate a volatile home directory.
|
|
||||||
mount -t tmpfs tmpfs /home/selene
|
mount -t tmpfs tmpfs /home/selene
|
||||||
chown selene:selene /home/selene
|
chown selene:selene /home/selene
|
||||||
cp /etc/skel/welcome /home/selene/
|
|
||||||
cp /etc/skel/LICENSE /home/selene/
|
|
||||||
|
@ -31,5 +31,3 @@ mkdir -p base/tmp
|
|||||||
|
|
||||||
rm -f base/bin
|
rm -f base/bin
|
||||||
ln -s usr/bin base/bin
|
ln -s usr/bin base/bin
|
||||||
|
|
||||||
cp $LUNA_ROOT/LICENSE base/etc/skel/LICENSE
|
|
||||||
|
Loading…
Reference in New Issue
Block a user