diff sbin/ftjail @ 380:6be930eb7490

Implement the "fzfs create-tree" command
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 20 Feb 2023 00:43:30 +0100
parents b4173e88c57c
children 84d2735fe7f6
line wrap: on
line diff
--- a/sbin/ftjail	Sun Feb 19 14:47:17 2023 +0100
+++ b/sbin/ftjail	Mon Feb 20 00:43:30 2023 +0100
@@ -40,7 +40,7 @@
 
   snapshot-tmpl BASE-RO SKELETON-RW SNAPSHOT-NAME
 
-  copy-skel [-A] [-L] [-M MOUNTPOINT] [-P] [-u]  SOURCE-DS SNAPSHOT-NAME TARGET-DS
+  copy-skel [-A] [-D] [-L] [-M MOUNTPOINT] [-P] [-u]  SOURCE-DS SNAPSHOT-NAME TARGET-DS
 
   build-etcupdate-current-tmpl DIRECTORY TARBALL
 
@@ -769,7 +769,7 @@
 #:
 command_copy_skel() {
     local _ds_source _snapshot_name _ds_target
-    local _opt_symlink _opt_nomount _opt_canmount _opt_mountpoint
+    local _opt_symlink _opt_nomount _opt_canmount _opt_mountpoint _opt_nodata
 
     local _opt _name _relative_name  _root_canmount
 
@@ -777,12 +777,16 @@
     _opt_nomount=""
     _opt_canmount="-o canmount=on"
     _opt_mountpoint=""
+    _opt_nodata=""
 
-    while getopts "ALM:Pu" _opt ; do
+    while getopts "ADLM:Pu" _opt ; do
         case ${_opt} in
             A)
                 _opt_canmount="-o canmount=noauto"
                 ;;
+            D)
+                _opt_nodata="yes"
+                ;;
             L)
                 _opt_symlink="yes"
                 ;;
@@ -804,6 +808,7 @@
     OPTIND=1
 
     [ -z "${_opt_symlink}" ] && { echo "ERROR: -L or -P must be given" 1>&2; return 2; }
+    [ \( "${_opt_nodata}" = "yes" \) -a \( "${_opt_symlink}" = "yes" \) ] && { echo "ERROR: -L and -D are incompatible" 1>&2; return 2; }
 
     _ds_source="${1-}"
     _snapshot_name="${2-}"