confz

git mirror of https://ccx.te2000.cz/bzr/confz
git clone https://ccx.te2000.cz/git/confz
Log | Files | Refs

commit 57cfcd78018d5a7fd6fc01a80ab74b2c18160111
parent 936508cb319fcc19cd6cc8855bdfd3e889e64d5d
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date:   Wed, 13 Feb 2019 10:28:10 +0100

Allow to specify root of vshost when using 'require vserver'
Diffstat:
Mzsh-functions/confz_fs_init | 8++++++--
Mzsh-functions/confz_vserver_init | 9+++++----
2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/zsh-functions/confz_fs_init b/zsh-functions/confz_fs_init @@ -681,11 +681,15 @@ confz_mounted_volume_check() { defvar lv_name ${${${vars[mountpoint]}##/}//\//_} defvar filesystem xfs defvar label ${${vars[lv_name]}[1,12]} + defvar root / + [[ $mountpoint == /* ]] || \\ + die "$0: mountpoint must be absolute path, got: ${(qqq)mountpoint}" require logical_volume %device \?vg_name :size :lv_name require filesystem :device :label :filesystem \?mkfs_opts - require fstab :device :mountpoint :filesystem \?opts \?dump \?pass - require mounted :device :mountpoint + require fstab fstab=${vars[root]%/}/etc/fstab \ + :device :mountpoint :filesystem \?opts \?dump \?pass + require mounted :device mountpoint=${vars[root]%/}/${vars[mountpoint]#/} do_command=( true ) } diff --git a/zsh-functions/confz_vserver_init b/zsh-functions/confz_vserver_init @@ -83,9 +83,10 @@ confz_vserver_run_dirs_check() { # configure and deploy vserver confz_vserver_check() { checkvars name size context_id source + defvar root / - setvar etcdir /etc/vservers/${vars[name]} - setvar vdir /vservers/${vars[name]} + setvar etcdir ${vars[root]%/}/etc/vservers/${vars[name]} + setvar vdir ${vars[root]%/}/vservers/${vars[name]} local ctx ret local -a fails @@ -97,7 +98,7 @@ confz_vserver_check() { fi else fails+=( "${vars[etcdir]}/context) missing" ) - for ctx in /etc/vservers/*/context(N); do + for ctx in ${vars[root]%/}/etc/vservers/*/context(N); do if [[ $(<$ctx) == ${vars[context_id]} ]]; then die "$0: context id already used by $ctx" fi @@ -114,7 +115,7 @@ confz_vserver_check() { label=${${vars[name]}[0,12]} \ mountpoint=$vars[vdir] - require deployed_system :source path=${vars[vdir]} + require deployed_system :root :source path=${vars[vdir]} fail_reason="${(j:,:)fails}" return $#fails