aboutsummaryrefslogtreecommitdiffstats
path: root/iurt_root_command
diff options
context:
space:
mode:
Diffstat (limited to 'iurt_root_command')
-rwxr-xr-xiurt_root_command30
1 files changed, 30 insertions, 0 deletions
diff --git a/iurt_root_command b/iurt_root_command
index fad6c13..90abf38 100755
--- a/iurt_root_command
+++ b/iurt_root_command
@@ -147,6 +147,18 @@ $run{todo} = [];
"umount the given directory",
\&umount, "Unmounting" ],
+ [ "", "btrfs_create", 1, "<directory>",
+ "create a btrfs subvolume",
+ \&btrfs_create, "Create btrfs" ],
+
+ [ "", "btrfs_delete", 1, "<directory>",
+ "delete a btrfs subvolume",
+ \&btrfs_delete, "Delete btrfs" ],
+
+ [ "", "btrfs_snapshot", 2, "<source> <dest>",
+ "create a btrfs snapshot",
+ \&btrfs_snapshot, "btrfs snapshot" ],
+
[ "", "useradd", 3, "<directory> <username> [uid]",
"Add user in given chroot",
\&useradd, "Useradd" ],
@@ -381,6 +393,24 @@ sub untar {
return !system('tar', 'xf', $file, '-C', $dir, @o_files);
}
+sub btrfs_create {
+ my ($_run, $dest) = @_;
+ check_path_authorized($dest) or return;
+ return !system("btrfs", "subvolume", "create", $dest);
+}
+
+sub btrfs_delete {
+ my ($_run, $dest) = @_;
+ check_path_authorized($dest) or return;
+ return !system("btrfs", "subvolume", "delete", $dest);
+}
+
+sub btrfs_snapshot {
+ my ($_run, $source, $dest) = @_;
+ check_path_authorized($dest) or return;
+ return !system("btrfs", "subvolume", "snapshot", $source, $dest);
+}
+
sub bindmount {
my ($_run, $source, $dest) = @_;
check_path_authorized($dest) or return;