improved code quality, few bug fixes

This commit is contained in:
Geoffray Levasseur
2023-08-02 11:36:01 +02:00
parent e16ce485f9
commit cd35f52509
29 changed files with 174 additions and 168 deletions

View File

@@ -37,7 +37,7 @@ conf_ceph()
pkginst ceph-common
# hosts files required for Ceph bootstrap when DNS not yet started
if [[ ! $(grep "# Ceph" /etc/hosts) ]]; then
if [[ -z $(grep "# Ceph" /etc/hosts) ]]; then
prnt I "Adding server list to /etc/hosts"
backup_dist /etc/hosts
tag_file /etc/hosts
@@ -57,7 +57,7 @@ conf_ceph()
fstabchanged=true
echo >> /etc/fstab
local srvlist=$(echo $CEPH_SRV_NAMES | sed "s/ /,/g")
if [[ ! $(grep $srvlist /etc/fstab) ]]; then
if [[ -z $(grep $srvlist /etc/fstab) ]]; then
echo "# Ceph :" >> /etc/fstab
echo "$srvlist:/ /srv/ceph ceph defaults,_netdev,name=admin,secret=$CEPH_SECRET 0 0" >> /etc/fstab
else
@@ -72,7 +72,7 @@ conf_ceph()
prnt I "Adding Samba entries to /etc/fstab"
fstabchanged=true
echo >> /etc/fstab
if [[ ! $(grep $SMBSRV /etc/fstab) ]]; then
if [[ -z $(grep $SMBSRV /etc/fstab) ]]; then
echo "# Samba:" >> /etc/fstab
echo "//$SMBSRV/share /srv/ceph/share cifs defaults,_netdev,username=root,password= 0 0" >> /etc/fstab
else
@@ -83,7 +83,7 @@ conf_ceph()
prnt E "Ceph status not understood, the next tasks will probably fail"
fi
if [[ $success == yes ]]; then
if [[ ! $(grep "^/srv/ceph/share" /etc/fstab) ]]; then
if [[ -z $(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
@@ -101,10 +101,10 @@ conf_ceph()
# Mount Ceph volumes if required
prnt I "Mounting ceph volumes"
[[ ! $(mount | grep "on /srv/ceph") ]] && mount -v /srv/ceph || mount -v /srv/ceph/share
[[ ! $(mount | grep "on /share") ]] && mount -v /share
[[ -z $(mount | grep "on /srv/ceph") ]] && mount -v /srv/ceph || mount -v /srv/ceph/share
[[ -z $(mount | grep "on /share") ]] && mount -v /share
if [[ $SHARED_HOME == "true" ]]; then
[[ ! $(mount | grep "on /home") ]] && mount -v /home
[[ -z $(mount | grep "on /home") ]] && mount -v /home
fi
}