Skip to content

Commit 0e9b7e5

Browse files
committed
mount-in: new command, generic replacement for add-fscomp
Add function _is_fscomp mount-in: add initial implementation Add a stub for _is_fscomp Add tests and fixes Add zsh autocompletion Add mount-in to the available command list Mark add-fscomp as deprecated Add copy-in and mount-in as flavourable commands
1 parent b35bb97 commit 0e9b7e5

File tree

9 files changed

+999
-1
lines changed

9 files changed

+999
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
- execute: an orchestration oriented command that imports and automatically set several settings on a pot
1111
- prepare: new command, taking the place of execute
1212
- copy-in: new command, to copy files or directory inside a pot (generalized replacement of add-file)
13+
- mount-in: new command, to mount a directory, a zfs dataset or a fscomp inside a pot (replacement for add-fscomp)
1314

1415
### Changed
1516
- export-ports: removed -S for static port export
@@ -18,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1819

1920
### Deprecated
2021
- add-file: deprecated, replaced by the more general new copy-in command
22+
- add-fscomp: deprecated, replaces by the more general new mount-in command
2123

2224
## [0.6.1] 2019-06-25
2325
### Fixed

bin/pot

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Commands:
9191
rename -- Rename a pot
9292
destroy -- Destroy a pot
9393
copy-in -- Copy a file or a directory into a pot
94+
mount-in -- Mount a directory, a zfs dataset or a fscomp into a pot
9495
add-file -- Add a file to a pot
9596
add-fscomp -- Add a fs component or a directory to a pot
9697
add-dep -- Add a dependency
@@ -159,7 +160,7 @@ case "${CMD}" in
159160
list|info|ps|top|\
160161
init|de-init|vnet-start|\
161162
create-base|create-fscomp|create|create-dns|\
162-
copy-in|\
163+
copy-in|mount-in|\
163164
add-file|add-fscomp|destroy|add-dep|set-rss|set-cmd|\
164165
export|import|prepare|\
165166
export-ports|set-attribute|get-attribute|\

share/pot/add-fscomp.sh

+6
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ pot-add-fscomp()
192192
esac
193193
done
194194

195+
echo '###############################'
196+
echo '# add-fscomp is deprecated #'
197+
echo '###############################'
198+
echo '# Please use mount-in instead #'
199+
echo '###############################'
200+
195201
if [ -z "$_pname" ]; then
196202
_error "A pot name is mandatory"
197203
add-fscomp-help

share/pot/common.sh

+21
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,26 @@ _is_vnet_up()
380380
fi
381381
}
382382

383+
# $1 fscomp name
384+
# $2 quiet / no _error messages are emitted (sometimes usefult)
385+
# tested
386+
_is_fscomp()
387+
{
388+
local _fscomp _fdir _fdset
389+
_fscomp="$1"
390+
_fdir="${POT_FS_ROOT}/fscomp/$_fscomp"
391+
_fdset="${POT_ZFS_ROOT}/fscomp/$_fscomp"
392+
if [ ! -d "$_fdir" ]; then
393+
_qerror "$2" "fscomp $_fscomp not found"
394+
return 1
395+
fi
396+
if ! _zfs_dataset_valid "$_fdset" ; then
397+
_qerror "$2" "dataset $_fdset for fscomp $_fscomp not found"
398+
return 2
399+
fi
400+
return 0
401+
}
402+
383403
# $1 base name
384404
# $2 quiet / no _error messages are emitted (sometimes usefult)
385405
# tested
@@ -556,6 +576,7 @@ _is_cmd_flavorable()
556576
_cmd=$1
557577
case $_cmd in
558578
add-dep|add-fscomp|set-attribute|\
579+
copy-in|mount-in|\
559580
set-rss|export-ports)
560581
return 0
561582
;;

0 commit comments

Comments
 (0)