forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy_mount.cpp
29 lines (25 loc) · 1018 Bytes
/
copy_mount.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* Copyright (c) 2024, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibCore/ArgsParser.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
StringView original_mountpoint;
StringView target_mountpoint;
Core::ArgsParser args_parser;
// FIXME: Possibly allow to pass VFS root context IDs and flags?
args_parser.add_positional_argument(original_mountpoint, "Source path", "source", Core::ArgsParser::Required::Yes);
args_parser.add_positional_argument(target_mountpoint, "Mount point", "mountpoint", Core::ArgsParser::Required::Yes);
args_parser.parse(arguments);
VERIFY(!(original_mountpoint.is_null() || original_mountpoint.is_empty()));
VERIFY(!(target_mountpoint.is_null() || target_mountpoint.is_empty()));
TRY(Core::System::copy_mount({}, {}, original_mountpoint, target_mountpoint, 0));
return 0;
}