added tagfile and make use of it in modules

This commit is contained in:
2021-12-15 10:55:18 +01:00
parent 925d32c2b6
commit a79d079cac
15 changed files with 81 additions and 31 deletions

View File

@@ -15,7 +15,7 @@
# Mount points are hardcoded and should bet set differently
# ------------------------------------------------------------------------------
export VER_conf_ceph="0.0.2"
export VER_conf_ceph="0.0.3"
export DEP_conf_ceph="upgrade_dist"
conf_ceph()
@@ -26,6 +26,7 @@ conf_ceph()
mkdir -pv /share
local success=undef
local fstabchanged=false
if [[ $CEPH_STATUS == ceph ]]; then
# Install ceph package
pkginst ceph-common
@@ -34,6 +35,7 @@ conf_ceph()
if [[ ! $(grep "# Ceph" /etc/hosts) ]]; then
prnt I "Adding server list to /etc/hosts"
backupdist /etc/hosts
tagfile /etc/hosts
echo >> /etc/hosts
echo "# Ceph servers:" >> /etc/hosts
for srv in $CEPH_SRV_NAMES; do
@@ -47,6 +49,7 @@ conf_ceph()
backupdist /etc/fstab
prnt I "Adding ceph entries to /etc/fstab"
fstabchanged=true
echo >> /etc/fstab
local srvlist=$(echo $CEPH_SRV_NAMES | sed "s/ /,/g")
if [[ ! $(grep $srvlist /etc/fstab) ]]; then
@@ -58,10 +61,11 @@ conf_ceph()
unset srvlist
success=yes
elif [[ $CEPH_STATUS == smb ]]; then
pkginst smbclient
pkginst smbclient
backupdist /etc/fstab
prnt I "Adding Samba entries to /etc/fstab"
fstabchanged=true
echo >> /etc/fstab
if [[ ! $(grep $SMBSRV /etc/fstab) ]]; then
echo "# Samba:" >> /etc/fstab
@@ -75,6 +79,7 @@ conf_ceph()
fi
if [[ $success == yes ]]; then
if [[ ! $(grep "^/srv/ceph/share" /etc/fstab) ]]; then
fstabchanged=true
echo "/srv/ceph/share /share none defaults,_netdev,bind 0 0" >> /etc/fstab
if [[ $SHARED_HOME == 1 ]]; then
echo "/srv/ceph/share/home /home none defaults,_netdev,bind 0 0" >> /etc/fstab
@@ -84,6 +89,11 @@ conf_ceph()
prnt E "Failed creating original mount, not adding binded ones"
fi
if [[ $fstabchanged == true ]]; then
tagfile /etc/fstab
fi
unset fstabchanged
# Mount Ceph volumes if required
prnt I "Mounting ceph volumes"
[[ ! $(mount | grep "on /srv/ceph") ]] && mount -v /srv/ceph || mount -v /srv/ceph/share