new conf files + fix bug in conf_ntp with devuan 5, fix a bug with early debian/devuan version, added git support for profile
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
export VER_conf_network="0.0.8"
|
||||
export DEP_conf_network="install_pkg"
|
||||
export DEP_conf_network=""
|
||||
|
||||
conf_network()
|
||||
{
|
||||
@@ -100,6 +100,9 @@ conf_network()
|
||||
fi
|
||||
done
|
||||
|
||||
prnt I "Trying to raise down iface up. Allready configured iface will require a reboot"
|
||||
ifup -a || true && prnt W "Ignoring errors here."
|
||||
|
||||
unset iface if_file
|
||||
NEED_REBOOT=true
|
||||
}
|
||||
|
||||
51
modules/conf_nfs.sh
Normal file
51
modules/conf_nfs.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description of module conf_nfs
|
||||
# Copyright (c) Year Your Name <your.mail@host.tld>
|
||||
# ------------------------------------------------------------------------------
|
||||
# <Licence header compatible with BSD-3 licence, you want to use>
|
||||
# ------------------------------------------------------------------------------
|
||||
# Variable list:
|
||||
# * <VARNAME>: role explaination
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Module version
|
||||
export VER_conf_nfs="0.0.1"
|
||||
|
||||
# Module's code
|
||||
conf_nfs()
|
||||
{
|
||||
pkginst nfs-common
|
||||
for mnt in $NFS_MOUNTS; do
|
||||
if [[ ! $(grep "$(eval echo \$MOUNTSERV_$mnt)/d" /etc/fstab) ]]; then
|
||||
echo -e "$(eval echo \$MOUNTSERV_$mnt)\t$(eval echo \$MOUNTPOINT_$mnt)\tnfs4\tdefaults,_netdev\t0\t0" >> /etc/fstab
|
||||
fi
|
||||
if [[ ! -d $(eval echo \$MOUNTPOINT_$mnt) ]]; then
|
||||
mkdir -pv $(eval echo \$MOUNTPOINT_$mnt)
|
||||
fi
|
||||
mount $(eval echo \$MOUNTPOINT_$mnt)
|
||||
done
|
||||
}
|
||||
|
||||
# Preliminary checks code for the module
|
||||
precheck_conf_nfs()
|
||||
{
|
||||
if [[ -n $NFS_MOUNTS ]]; then
|
||||
for mnt in $NFS_MOUNTS; do
|
||||
if [[ -z $(eval echo \$MOUNTSERV_$mnt) ]]; then
|
||||
prnt E "The server mount for $NFS_MOUNT is not declared."
|
||||
die 182
|
||||
fi
|
||||
if [[ -z $(eval echo \$MOUNTPOINT_$mnt) ]]; then
|
||||
prnt E "The mountpoint for $NFS_MOUNT is not declared."
|
||||
die 183
|
||||
fi
|
||||
prnt I "NFS server $(eval echo \$MOUNTSERV_$mnt) will be mounted on $(eval echo \$MOUNTPOINT_$mnt)."
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Public functions might be exported
|
||||
export -f conf_nfs
|
||||
export -f precheck_conf_nfs
|
||||
|
||||
# EOF
|
||||
@@ -24,23 +24,37 @@ conf_ntp()
|
||||
prnt I "Installing ntp daemon..."
|
||||
pkginst ntp
|
||||
prnt I "Stopping service ntp..."
|
||||
svc_stop ntp
|
||||
if [[ -n $NTP_SERV ]]; then
|
||||
svc_stop $NTP_SERV
|
||||
else
|
||||
svc_stop ntp
|
||||
fi
|
||||
|
||||
if [[ -n $NTP_SERV ]]; then
|
||||
local conf_file="/etc/$NTP_SERV/ntp.conf"
|
||||
else
|
||||
local conf_file="/etc/ntp.conf"
|
||||
fi
|
||||
|
||||
prnt I "Installing NTP configuration file..."
|
||||
local dest="/etc/ntp.conf.work"
|
||||
backup_dist /etc/ntp.conf
|
||||
tag_file $dest
|
||||
local dest="${conf_file}.work"
|
||||
backup_dist $conf_file
|
||||
install_file ntp.conf $dest
|
||||
tag_file $dest
|
||||
local line=""
|
||||
for srv in $NTP_SERVERS; do
|
||||
line="${line}server $srv iburst\n"
|
||||
done
|
||||
sed -i -e "s/@SERVERLIST@/$line/" $dest &&
|
||||
echo "# Generated on $(stdtime)" >> $dest &&
|
||||
mv -fv $dest /etc/ntp.conf
|
||||
mv -fv $dest $conf_file
|
||||
|
||||
prnt I "Starting service ntp..."
|
||||
svc_start ntp
|
||||
|
||||
if [[ -n $NTP_SERV ]]; then
|
||||
svc_start $NTP_SERV
|
||||
else
|
||||
svc_start ntp
|
||||
fi
|
||||
sleep 2 # short sleep so we're sure daemon is ready
|
||||
ntptime
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# https://opensource.org/licenses/BSD-3-Clause
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
export VER_install_profile="0.0.7"
|
||||
export VER_install_profile="0.1.0"
|
||||
export DEP_install_profile="install_pkg"
|
||||
|
||||
install_profile()
|
||||
@@ -23,11 +23,19 @@ install_profile()
|
||||
|
||||
for usr in $usrlist; do
|
||||
prnt I "Installing profile for user $usr..."
|
||||
backup_dist $usr/{.,}profile $usr/.bashrc
|
||||
install_file profile/{{.,}profile,.bashrc} $usr/
|
||||
tag_file $usr/{{.,}profile,.bashrc}
|
||||
install_file profile/.tmux/.tmux.conf{,.local} $usr/
|
||||
tag_file $usr/.tmux.conf{,.local}
|
||||
backup_dist $usr/{.profile,.bashrc}
|
||||
install_file profile/{.profile,.bashrc} $usr/
|
||||
tag_file $usr/{.profile,.bashrc}
|
||||
#install_file profile/.tmux/.tmux.conf{,.local} $usr/
|
||||
#tag_file $usr/.tmux.conf{,.local}
|
||||
if [[ ! -d $usr/profile ]]; then
|
||||
(
|
||||
cd $usr
|
||||
git config --global http.sslverify false
|
||||
git clone https://git.geoffray-levasseur.org/fatalerrors/profile.git
|
||||
git config --global http.sslverify true
|
||||
)
|
||||
fi
|
||||
done
|
||||
unset usrlist
|
||||
|
||||
@@ -39,7 +47,7 @@ install_profile()
|
||||
|
||||
precheck_install_profile()
|
||||
{
|
||||
file_must_exists profile/{motd,{.,}profile,.bashrc,.tmux/.tmux.conf{,.local}}
|
||||
file_must_exists profile/{motd,{.profile,.bashrc,.tmux/.tmux.conf{,.local}}
|
||||
}
|
||||
|
||||
export -f install_profile
|
||||
|
||||
Reference in New Issue
Block a user