some readability improvements

This commit is contained in:
2021-12-06 17:06:49 +01:00
parent 239d9972a5
commit 056a6142bd
6 changed files with 82 additions and 29 deletions

43
conf/includes/gl.conf.sh Normal file
View File

@@ -0,0 +1,43 @@
# Domaine geoffray-levasseur.org
export MAINDOM="geoffray-levasseur.org"
# Proxy apt-cacher-ng
export PROXY_APT="balut.$MAINDOM"
export PROXY_APT_PORT="3142"
# Available languanges and system language
export LOCALESET="en_US.UTF-8 fr_FR.UTF-8"
export SYSLOCALE="fr_FR.UTF-8"
# Default Shell, for new users
export DEFAULT_SHELL="/bin/bash"
# User created by installer, unneeded
export REMOVE_USERS="fatal"
# NTP server list
export NTPSERVERS="didicas.$MAINDOM cagua.$MAINDOM"
# Ceph share
export CEPH_SRV_NAMES="mayon pinatubo ragang taal jolo"
export CEPHIP_mayon="192.168.1.254"
export CEPHIP_pinatubo="192.168.1.253"
export CEPHIP_ragang="192.168.1.252"
export CEPHIP_taal="192.168.1.251"
export CEPHIP_jolo="192.168.1.30"
export CEPH_SECRET="AQAxSf5c2A/CMxAAnOu1RrSf7Yr2h60CLttq4g=="
export SHARED_HOME="false"
# Check MK
export MK_VERSION="2.0.0p15-1"
export MK_URL="https://nagios.geoffray-levasseur.org/check_mk/check_mk/agents/check-mk-agent_${MK_VERSION}_all.deb"
export MK_SERVER_IP="192.168.1.201"
# Samba
export SMBSRV="silay"
# Syslog
export SYSLOG_SRV="biliran.$MAINDOM"
# System mail
export MAIL_RELAY="matutum.$MAINDOM"

View File

@@ -2,10 +2,10 @@
export MAINDOM="legos.obs-mip.fr"
# Proxy LEGOS
#export PROXYAPT="acng.$MAINDOM"
#export PROXYAPTPORT="3142"
export PROXYSRV="proxy.$MAINDOM"
export PROXYSRVPORT="3128"
#export PROXY_APT="acng.$MAINDOM"
#export PROXY_APT_PORT="3142"
export PROXY_SRV="proxy.$MAINDOM"
export PROXY_SRV_PORT="3128"
# Langues supportés et langue du systême
export LOCALESET="en_US.UTF-8 fr_FR.UTF-8"
@@ -19,4 +19,4 @@ export DEFAULT_SHELL="/bin/bash"
#export CALCMOUNTPOINT="/calcul/$HOSTNAME"
# Liste des serveurs NTP
#export NTPSERVERS="ntp1.$MAINDOM ntp2.$MAINDOM"
#export NTP_SERVERS="ntp1.$MAINDOM ntp2.$MAINDOM"

View File

@@ -2,13 +2,10 @@
export MAINDOM="legos.obs-mip.fr"
# Proxy LEGOS
export PROXYAPT="acng.$MAINDOM"
export PROXYAPTPORT="3142"
export PROXYSRV="proxy.$MAINDOM"
export PROXYSRVPORT="3128"
# Distribution sources.list (Ubuntu Focal)
export APT_SOURCE_LIST="ubuntu_focal.list"
export PROXY_APT="acng.$MAINDOM"
export PROXY_APT_PORT="3142"
export PROXY_SRV="proxy.$MAINDOM"
export PROXY_SRV_PORT="3128"
# Langues supportés et langue du systême
export LOCALESET="en_US.UTF-8 fr_FR.UTF-8"
@@ -22,4 +19,7 @@ export CALCTYPE="zfs"
export CALCMOUNTPOINT="/calcul/$HOSTNAME"
# Liste des serveurs NTP
export NTPSERVERS="ntp1.$MAINDOM ntp2.$MAINDOM"
export NTP_SERVERS="ntp1.$MAINDOM ntp2.$MAINDOM"
# Relay mail
export MAIL_RELAY="smpt.$MAINDOM"

View File

@@ -45,9 +45,9 @@ export -f get_mod_name
set_system_proxy()
{
# Declare proxy system vars if needed and if not already declared
if [[ -n $PROXYSRV && -n $PROXYSRVPORT && -z $NO_PROXY ]]; then
export http_proxy=${http_proxy:-"http://$PROXYSRV:$PROXYSRVPORT/"}
export https_proxy=${https_proxy:-"http://$PROXYSRV:$PROXYSRVPORT/"}
if [[ -n $PROXY_SRV && -n $PROXY_SRV_PORT && -z $NO_PROXY ]]; then
export http_proxy=${http_proxy:-"http://$PROXY_SRV:$PROXY_SRV_PORT/"}
export https_proxy=${https_proxy:-"http://$PROXY_SRV:$PROXY_SRV_PORT/"}
fi
}
export -f set_system_proxy

View File

@@ -11,7 +11,7 @@
# * NTPSERVERS: list of NTP servers
# ------------------------------------------------------------------------------
export VER_conf_ntp="0.1.2"
export VER_conf_ntp="0.1.3"
export DEP_conf_ntp=""
conf_ntp()
@@ -31,7 +31,7 @@ conf_ntp()
backupdist /etc/ntp.conf
installfile ntp.conf $dest
local line=""
for srv in $NTPSERVERS; do
for srv in $NTP_SERVERS; do
line="${line}server $srv iburst\n"
done
sed -i -e "s/@SERVERLIST@/$line/" $dest &&
@@ -47,12 +47,15 @@ conf_ntp()
# NTP
precheck_conf_ntp()
{
if [[ -z $NTPSERVERS ]]; then
if [[ -z $NTP_SERVERS ]]; then
prnt E "No configured NTP server!"
die 151
else
file_exists ntp.conf
prnt m "The NTP servers to be used will be: $NTPSERVERS"
prnt m "The NTP servers to be used will be:"
for srv in $NTP_SERVERS; do
prnt m " * $srv"
done
fi
}

View File

@@ -9,11 +9,13 @@
# https://opensource.org/licenses/BSD-3-Clause
# ------------------------------------------------------------------------------
# Variable:
# * PROXYAPT: Proxy to use with APT (eg. APT Cacher)
# * PROXYAPTPORT: Working port for APT proxy
# * PROXY_APT: Proxy to use with APT (eg. APT Cacher), optionnal
# * PROXY_APT_PORT: Working port for APT proxy if one declared
# * PROXY_SRV: General purpose proxy if PROXY_APT is undefined
# * PROXY_SRV_PORT: Working port for general purpose proxy if one declared
# ------------------------------------------------------------------------------
export VER_upgrade_dist="0.2.0"
export VER_upgrade_dist="0.2.1"
# As aptitude might fail if clock is too far from real time, we need to depend
# on ntp
@@ -27,12 +29,13 @@ upgrade_dist()
# We backup entire apt dir as future version will normalise source.list files
backupdist /etc/apt
prnt I "Basic apt configuration..."
echo 'APT::Install-Recommends "false";' > $norecommends
echo "# Generated automatically on $(stdtime) by $0" > $norecommend
echo 'APT::Install-Recommends "false";' >> $norecommends
echo 'APT::AutoRemove::RecommendsImportant "false";' >> $norecommends
echo 'APT::AutoRemove::SuggestsImportant "false";' >> $norecommends
prnt I "Configuring proxy for APT..."
if [[ -n $PROXYAPT ]]; then
if [[ -n $PROXY_APT ]]; then
if [[ ! -d $(dirname $proxyfile) ]]; then
mkdir -pv $(dirname $proxyfile) || (
prnt E "Impossible to create directory to receive APT configuration."
@@ -40,10 +43,10 @@ upgrade_dist()
)
fi
echo "# Generated automatically on $(stdtime) by $0" > $proxyfile
echo "Acquire::http::Proxy \"http://${PROXYAPT}:${PROXYAPT_PORT}\";" >> $proxyfile
echo "Acquire::http::Proxy \"http://${PROXY_APT}:${PROXY_APT_PORT}\";" >> $proxyfile
elif [[ -n $http_proxy ]]; then
echo "# Generated automatically on $(stdtime) by $0" > $proxyfile
echo "Acquire::http::Proxy \"http://${http_proxy}\";" >> $proxyfile
echo "Acquire::http::Proxy \"http://${PROXY_SRV}:${PROXY_SRV_PORT}\";" >> $proxyfile
else
prnt I "No proxy configured, nothing to do."
fi
@@ -69,8 +72,12 @@ precheck_upgrade_dist()
prnt E "It seems network configuration is not functionnal! Giving up."
die 160
fi
if [[ -n $PROXYAPT && -z $PROXYAPT_PORT ]]; then
prnt E "A proxy server have been specified but not its working port."
if [[ -n $PROXY_APT && -z $PROXY_APT_PORT ]]; then
prnt E "An APT proxy server have been specified but not its working port."
die 160
fi
if [[ -n $PROXY_SRV && -z $PROXY_SRV_PORT ]]; then
prnt E "A general proxy server have been specified but not its working port."
die 160
fi
file_exists pkgman/${SYS_DIST}_${SYS_VER}.list