diff options
author | Pascal Terjan <pterjan@mageia.org> | 2012-08-08 00:17:24 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2012-08-08 00:17:24 +0000 |
commit | 117ba04c1364d43c8c516de7b49e0e3cd6f5f892 (patch) | |
tree | 650f2cad7dad0f4ffc7a1a668981332cde07f078 /iurt_root_command | |
parent | ceddb814472cbd0d301d6a8d8433bd3bbbb8f356 (diff) | |
download | iurt-117ba04c1364d43c8c516de7b49e0e3cd6f5f892.tar iurt-117ba04c1364d43c8c516de7b49e0e3cd6f5f892.tar.gz iurt-117ba04c1364d43c8c516de7b49e0e3cd6f5f892.tar.bz2 iurt-117ba04c1364d43c8c516de7b49e0e3cd6f5f892.tar.xz iurt-117ba04c1364d43c8c516de7b49e0e3cd6f5f892.zip |
Initial btrfs support
Diffstat (limited to 'iurt_root_command')
-rwxr-xr-x | iurt_root_command | 30 |
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; |