@@ -30,6 +30,7 @@ create-help()
30
30
echo ' auto: usable with public-bridge and private-bridge (default)'
31
31
echo ' ipaddr: mandatory with alias, usable with public-bridge and private-bridge'
32
32
echo ' -B bridge-name : the name of the bridge to be used (private-bridge only)'
33
+ echo ' -S network-stack : the network stack (ipv4, ipv6 or dual)'
33
34
}
34
35
35
36
_cj_undo_create ()
@@ -221,12 +222,13 @@ _cj_zfs()
221
222
# $7 type
222
223
# $8 private bridge (if network tpye is private_bridge"
223
224
# $9 pot-base name
225
+ # $10 network-stack
224
226
_cj_conf ()
225
227
{
226
228
# shellcheck disable=SC2039
227
229
local _pname _base _ip _network_type _lvl _jdir _bdir _potbase _dns _type _pblvl _pbpb
228
230
# shellcheck disable=SC2039
229
- local _jdset _bdset _pbdset _baseos _bridge_name
231
+ local _jdset _bdset _pbdset _baseos _bridge_name _stack
230
232
_pname=$1
231
233
_base=$2
232
234
_network_type=$3
@@ -236,6 +238,8 @@ _cj_conf()
236
238
_type=$7
237
239
_bridge_name=$8
238
240
_potbase=$9
241
+ _stack=${10}
242
+
239
243
_jdir=${POT_FS_ROOT} /jails/$_pname
240
244
_bdir=${POT_FS_ROOT} /bases/$_base
241
245
@@ -301,6 +305,7 @@ _cj_conf()
301
305
echo " pot.attr.start-at-boot=NO"
302
306
echo " pot.attr.procfs=NO"
303
307
echo " pot.attr.prunable=NO"
308
+ echo " pot.stack=$_stack "
304
309
echo " network_type=$_network_type "
305
310
case $_network_type in
306
311
" inherit" )
@@ -347,6 +352,7 @@ _cj_conf()
347
352
# $4 ip
348
353
_cj_internal_conf ()
349
354
{
355
+ # shellcheck disable=SC2039
350
356
local _pname _type _lvl _ip _jdir
351
357
_pname=$1
352
358
_type=$2
@@ -489,7 +495,7 @@ _cj_single_install()
489
495
pot-create ()
490
496
{
491
497
# shellcheck disable=SC2039
492
- local _pname _ipaddr _lvl _base _flv _potbase _dns _type _new_lvl _network_type _private_bridge
498
+ local _pname _ipaddr _lvl _base _flv _potbase _dns _type _new_lvl _network_type _private_bridge _network_stack
493
499
OPTIND=1
494
500
_type=" multi"
495
501
_network_type=" inherit"
@@ -502,8 +508,9 @@ pot-create()
502
508
_potbase=
503
509
_dns=inherit
504
510
_private_bridge=
511
+ _network_stack=" $( _get_network_stack ) "
505
512
_cleanup_keep=" NO"
506
- while getopts " hvp:t:N:i:l:b:f:P:d:B:k" _o ; do
513
+ while getopts " hvp:t:N:i:l:b:f:P:d:B:S: k" _o ; do
507
514
case " $_o " in
508
515
h)
509
516
create-help
@@ -538,6 +545,14 @@ pot-create()
538
545
B)
539
546
_private_bridge=" $OPTARG "
540
547
;;
548
+ S)
549
+ if ! _is_in_list " $OPTARG " " ipv4" " ipv6" " dual" ; then
550
+ _error " Network stack $OPTARG not valid"
551
+ create-help
552
+ ${EXIT} 1
553
+ fi
554
+ _network_stack=" $OPTARG "
555
+ ;;
541
556
i)
542
557
if [ -z " $_ipaddr " ]; then
543
558
_ipaddr=" $OPTARG "
@@ -745,7 +760,7 @@ pot-create()
745
760
if ! _is_uid0 ; then
746
761
${EXIT} 1
747
762
fi
748
- if ! _ipaddr=" $( _validate_network_param " $_network_type " " $_ipaddr " " $_private_bridge " ) " ; then
763
+ if ! _ipaddr=" $( _validate_network_param " $_network_type " " $_ipaddr " " $_private_bridge " " $_network_stack " ) " ; then
749
764
echo " $_ipaddr "
750
765
${EXIT} 1
751
766
fi
@@ -760,22 +775,23 @@ pot-create()
760
775
fi
761
776
fi
762
777
_info " Creating a new pot"
763
- _info " pot name : $_pname "
764
- _info " type : $_type "
765
- _info " base : $_base "
766
- _info " pot_base : $_potbase "
767
- _info " level : $_lvl "
768
- _info " network-type: $_network_type "
769
- _info " ip : $_ipaddr "
770
- _info " bridge : $_private_bridge "
771
- _info " dns : $_dns "
772
- _info " flavours : $_flv "
778
+ _info " pot name : $_pname "
779
+ _info " type : $_type "
780
+ _info " base : $_base "
781
+ _info " pot_base : $_potbase "
782
+ _info " level : $_lvl "
783
+ _info " network-type : $_network_type "
784
+ _info " network-stack: $_network_stack "
785
+ _info " ip : $_ipaddr "
786
+ _info " bridge : $_private_bridge "
787
+ _info " dns : $_dns "
788
+ _info " flavours : $_flv "
773
789
export _cleanup_pname=" $_pname " # for the cleanup function
774
790
export _cleanup_keep
775
791
if ! _cj_zfs " $_pname " " $_type " " $_lvl " " $_base " " $_potbase " ; then
776
792
${EXIT} 1
777
793
fi
778
- if ! _cj_conf " $_pname " " $_base " " $_network_type " " $_ipaddr " " $_lvl " " $_dns " " $_type " " $_private_bridge " " $_potbase " ; then
794
+ if ! _cj_conf " $_pname " " $_base " " $_network_type " " $_ipaddr " " $_lvl " " $_dns " " $_type " " $_private_bridge " " $_potbase " " $_network_stack " ; then
779
795
${EXIT} 1
780
796
fi
781
797
if [ " $_type " = " single" ]; then
0 commit comments