Compare commits

...

5 Commits

Author SHA1 Message Date
cravl-dev
0248ad1f70 Merge 08786d64e8 into b6c6edb622 2024-02-28 21:12:40 -07:00
dw-0
b6c6edb622 refactor(Mobileraker): update companion install script (#431) (#433) 2024-02-24 14:53:41 +01:00
Cameron Ryder
08786d64e8 fix: don't block user and check more than home 2023-06-28 14:45:33 -04:00
cravl-dev
a976e60ffd Merge branch 'th33xitus:master' into fix-331 2023-06-28 14:44:45 -04:00
Cameron Ryder
3099a6c9fb feat: add free disk space startup check (#331) 2023-06-08 11:45:32 -04:00
3 changed files with 27 additions and 3 deletions

View File

@@ -82,6 +82,7 @@ function kiauh_update_dialog() {
}
check_euid
check_free_space
init_logfile
set_globals
kiauh_update_dialog

View File

@@ -61,8 +61,8 @@ function mobileraker_setup() {
exit 1
fi
status_msg "Installing Mobileraker's companion ..."
if "${MOBILERAKER_DIR}"/scripts/install-mobileraker-companion.sh; then
status_msg "Starting installer of Mobileraker's companion ..."
if "${MOBILERAKER_DIR}"/scripts/install.sh; then
ok_msg "Mobileraker's companion successfully installed!"
else
print_error "Mobileraker's companion installation failed!"
@@ -233,7 +233,7 @@ primary_branch:main
managed_services: mobileraker
env: ${HOME}/mobileraker-env/bin/python
requirements: scripts/mobileraker-requirements.txt
install_script: scripts/install-mobileraker-companion.sh
install_script: scripts/install.sh
MOONRAKER_CONF
fi

View File

@@ -28,6 +28,29 @@ function check_euid() {
fi
}
function check_free_space() {
local mount_free mb_rec=2048
local mount_check_regex='^/($|bin|etc|home|lib|mnt|opt|root|sbin|tmp|usr|var)' # all root dirs possibly relevant to software install
for mount_check in $(cat /etc/mtab | grep '^/dev' | cut -d ' ' -f 2 | grep -E '${mount_check_regex}'); do
mount_free=$(($(df -Pk ${mount_check} | sed 1d | grep -v used | awk '{ print $4 "\t" }')/1024))
if [[ ${mount_free} -lt ${mb_req} ]]; then
local yn
while true; do
echo -e "${yellow}Heads up! Free disk space in ${white}${mount_check}${yellow} is only ${white}${mount_free} MB${yellow}.${white}"
read -p "${yellow}You may run into errors installing or updating software that uses this mountpoint. Proceed? (y|N): ${white}" yn
case "${yn}" in
Y|y|Yes|yes)
break;;
N|n|No|no|"")
exit 1;;
*)
echo -e "${red}Please answer "y" or "n"${white}";;
esac
done
fi
done
}
#================================================#
#============= MESSAGE FORMATTING ===============#
#================================================#