mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-25 00:33:37 +05:00
Compare commits
5 Commits
4897db0e6c
...
dbfb5d2012
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbfb5d2012 | ||
|
|
a929c6983d | ||
|
|
08786d64e8 | ||
|
|
a976e60ffd | ||
|
|
3099a6c9fb |
1
kiauh.sh
1
kiauh.sh
@@ -82,6 +82,7 @@ function kiauh_update_dialog() {
|
||||
}
|
||||
|
||||
check_euid
|
||||
check_free_space
|
||||
init_logfile
|
||||
set_globals
|
||||
kiauh_update_dialog
|
||||
|
||||
@@ -247,16 +247,16 @@ function get_spoolman_status() {
|
||||
}
|
||||
|
||||
function get_local_spoolman_version() {
|
||||
[[ ! -d "${SPOOLMAN_DIR}" ]] && return
|
||||
|
||||
local version
|
||||
if [[ -d "${SPOOLMAN_DIR}" ]]; then
|
||||
version=$(grep -o '"version":\s*"[^"]*' "${SPOOLMAN_DIR}"/release_info.json | cut -d'"' -f4)
|
||||
else
|
||||
version=""
|
||||
fi
|
||||
version=$(grep -o '"version":\s*"[^"]*' "${SPOOLMAN_DIR}"/release_info.json | cut -d'"' -f4)
|
||||
echo "${version}"
|
||||
}
|
||||
|
||||
function get_remote_spoolman_version() {
|
||||
[[ ! -d "${SPOOLMAN_DIR}" ]] && return
|
||||
|
||||
local version
|
||||
version=$(curl -s "${SPOOLMAN_REPO}" | grep -o '"tag_name":\s*"v[^"]*"' | cut -d'"' -f4)
|
||||
echo "${version}"
|
||||
|
||||
@@ -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 ===============#
|
||||
#================================================#
|
||||
|
||||
Reference in New Issue
Block a user