mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Also complain about low rootfs total disk space during postinstall
This commit is contained in:
parent
8b3ec8a137
commit
fd61900352
5 changed files with 17 additions and 3 deletions
|
@ -26,4 +26,4 @@ install-postinstall:
|
|||
script:
|
||||
- apt-get update -o Acquire::Retries=3
|
||||
- DEBIAN_FRONTEND=noninteractive SUDO_FORCE_REMOVE=yes apt --assume-yes -o Dpkg::Options::="--force-confold" --allow-downgrades install ./$YNH_BUILD_DIR/*.deb
|
||||
- yunohost tools postinstall -d domain.tld -p the_password --ignore-dyndns
|
||||
- yunohost tools postinstall -d domain.tld -p the_password --ignore-dyndns --force-diskspace
|
||||
|
|
|
@ -34,7 +34,7 @@ full-tests:
|
|||
PYTEST_ADDOPTS: "--color=yes"
|
||||
before_script:
|
||||
- *install_debs
|
||||
- yunohost tools postinstall -d domain.tld -p the_password --ignore-dyndns
|
||||
- yunohost tools postinstall -d domain.tld -p the_password --ignore-dyndns --force-diskspace
|
||||
script:
|
||||
- python3 -m pytest --cov=yunohost tests/ src/yunohost/tests/ --junitxml=report.xml
|
||||
needs:
|
||||
|
|
|
@ -1416,6 +1416,10 @@ tools:
|
|||
--force-password:
|
||||
help: Use this if you really want to set a weak password
|
||||
action: store_true
|
||||
--force-diskspace:
|
||||
help: Use this if you really want to install Yunohost on a setup with less than 10 GB on the root filesystem
|
||||
action: store_true
|
||||
|
||||
|
||||
### tools_update()
|
||||
update:
|
||||
|
|
|
@ -508,6 +508,7 @@
|
|||
"permission_require_account": "Permission {permission} only makes sense for users having an account, and therefore cannot be enabled for visitors.",
|
||||
"port_already_closed": "Port {port:d} is already closed for {ip_version:s} connections",
|
||||
"port_already_opened": "Port {port:d} is already opened for {ip_version:s} connections",
|
||||
"postinstall_low_rootfsspace": "The root filesystem has a total space less than 10 GB, which is quite worrisome! You will likely run out of disk space very quickly! It's recommended to have at least 16GB for the root filesystem. If you want to install YunoHost despite this warning, re-run the postinstall with --force-diskspace",
|
||||
"regenconf_file_backed_up": "Configuration file '{conf}' backed up to '{backup}'",
|
||||
"regenconf_file_copy_failed": "Could not copy the new configuration file '{new}' to '{conf}'",
|
||||
"regenconf_file_kept_back": "The configuration file '{conf}' is expected to be deleted by regen-conf (category {category}) but was kept back.",
|
||||
|
|
|
@ -229,7 +229,7 @@ def _detect_virt():
|
|||
|
||||
@is_unit_operation()
|
||||
def tools_postinstall(operation_logger, domain, password, ignore_dyndns=False,
|
||||
force_password=False):
|
||||
force_password=False, force_diskspace=False):
|
||||
"""
|
||||
YunoHost post-install
|
||||
|
||||
|
@ -242,6 +242,7 @@ def tools_postinstall(operation_logger, domain, password, ignore_dyndns=False,
|
|||
"""
|
||||
from yunohost.utils.password import assert_password_is_strong_enough
|
||||
from yunohost.domain import domain_main_domain
|
||||
import psutil
|
||||
|
||||
dyndns_provider = "dyndns.yunohost.org"
|
||||
|
||||
|
@ -249,6 +250,14 @@ def tools_postinstall(operation_logger, domain, password, ignore_dyndns=False,
|
|||
if os.path.isfile('/etc/yunohost/installed'):
|
||||
raise YunohostError('yunohost_already_installed')
|
||||
|
||||
# Check there's at least 10 GB on the rootfs...
|
||||
disk_partitions = sorted(psutil.disk_partitions(), key=lambda k: k.mountpoint)
|
||||
main_disk_partitions = [d for d in disk_partitions if d.mountpoint in ['/', '/var']]
|
||||
main_space = sum([psutil.disk_usage(d.mountpoint).total for d in main_disk_partitions])
|
||||
GB = 1024**3
|
||||
if not force_diskspace and main_space < 10 * GB:
|
||||
raise YunohostError("postinstall_low_rootfsspace")
|
||||
|
||||
# Check password
|
||||
if not force_password:
|
||||
assert_password_is_strong_enough("admin", password)
|
||||
|
|
Loading…
Add table
Reference in a new issue