improve hostname checking and add domain to dns config if exists
This commit is contained in:
parent
4aceceb5d4
commit
2c5d89fe69
16
install
16
install
@ -13,7 +13,7 @@
|
|||||||
# https://github.com/armbian/config/blob/master/debian-software
|
# https://github.com/armbian/config/blob/master/debian-software
|
||||||
# https://forum.openmediavault.org/index.php/Thread/25062-Install-OMV5-on-Debian-10-Buster/
|
# https://forum.openmediavault.org/index.php/Thread/25062-Install-OMV5-on-Debian-10-Buster/
|
||||||
#
|
#
|
||||||
# version: 1.3.2
|
# version: 1.3.3
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ $(id -u) -ne 0 ]]; then
|
if [[ $(id -u) -ne 0 ]]; then
|
||||||
@ -150,8 +150,15 @@ case ${codename} in
|
|||||||
esac
|
esac
|
||||||
echo "${omvCodename} :: ${version}"
|
echo "${omvCodename} :: ${version}"
|
||||||
|
|
||||||
hostname=$(</etc/hostname)
|
hostname="$(hostname --short)"
|
||||||
tz=$(</etc/timezone)
|
domainname="$(hostname --domain)"
|
||||||
|
tz="$(timedatectl show --property=Timezone --value)"
|
||||||
|
|
||||||
|
regex='[a-zA-Z]([-a-zA-Z0-9]{0,61}[a-zA-Z0-9])'
|
||||||
|
if [[ ! ${hostname} =~ ${regex} ]]; then
|
||||||
|
echo "Invalid hostname. Exiting..."
|
||||||
|
exit 6
|
||||||
|
fi
|
||||||
|
|
||||||
# Add Debian signing keys to raspbian to prevent apt-get update failures
|
# Add Debian signing keys to raspbian to prevent apt-get update failures
|
||||||
# when OMV adds security and/or backports repos
|
# when OMV adds security and/or backports repos
|
||||||
@ -321,6 +328,9 @@ omv_config_update "/config/services/ssh/permitrootlogin" "1"
|
|||||||
omv_config_update "/config/system/time/ntp/enable" "1"
|
omv_config_update "/config/system/time/ntp/enable" "1"
|
||||||
omv_config_update "/config/system/time/timezone" "${tz}"
|
omv_config_update "/config/system/time/timezone" "${tz}"
|
||||||
omv_config_update "/config/system/network/dns/hostname" "${hostname}"
|
omv_config_update "/config/system/network/dns/hostname" "${hostname}"
|
||||||
|
if [ -n "${domainname}" ]; then
|
||||||
|
omv_config_update "/config/system/network/dns/domainname" "${domainname}"
|
||||||
|
fi
|
||||||
|
|
||||||
# disable monitoring and apply changes
|
# disable monitoring and apply changes
|
||||||
echo "Disabling data collection ..."
|
echo "Disabling data collection ..."
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user