Skip to content

Commit

Permalink
checkspace
Browse files Browse the repository at this point in the history
  • Loading branch information
rM-self-serve committed Dec 6, 2023
1 parent 9e86692 commit cbb2b93
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions install-webint-ob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Copyright (c) 2023 rM-self-serve
# SPDX-License-Identifier: MIT

webinterface_onboot_sha256sum='edad550010f408ede2d85f723174735a19e9ffa12ffa31330a3b772e339ed841'
webinterface_onboot_sha256sum='8795ecb9bdd18b84deab0efa1a96c08ff53559d65567babb0088400da44daf0f'
service_file_sha256sum='64cfdd5c8eaea1bc8df2e734a41c7ff038585cc2f4248c79e50531901b1ef651'

release='v1.2.1'
release='v1.2.2'

installfile='./install-webint-ob.sh'
pkgname='webinterface-onboot'
Expand Down
34 changes: 34 additions & 0 deletions webinterface-onboot
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@ main() {
run
;;
'apply-hack')
checkspace
apply_hack
;;
'revert-hack')
checkspace
revert_hack
;;
'apply-prstip')
checkspace
apply_prstip
;;
'revert-prstip')
checkspace
revert_prstip
;;
'is-hack-applied')
Expand Down Expand Up @@ -96,6 +100,36 @@ cli_info() {
echo ' -h, --help Show help'
}

checkspace() {
if ! _checkspace / 1; then
(
echo "Not enough space on /"
echo "Try to free space by running: journalctl --vacuum-time=1m"
echo "Or: systemctl restart xochitl"
exit 10
)
exit 1
fi
if ! _checkspace /home 12; then
(
echo "Not enough space on /home"
exit 10
)
exit 1
fi
}

_checkspace() {
part=$1
needed=$2
_available=$(df "$part" | tail -n1 | awk '{print $4}')
available=$(("$_available" / 1024))
if [ $available -lt "$needed" ]; then
echo "Less than ${needed}MB free, ${available}MB"
return 1
fi
}

run_vars() {
user_conf='/home/root/.config/remarkable/xochitl.conf'
usb0iprange='10.11.99.1/32'
Expand Down

0 comments on commit cbb2b93

Please sign in to comment.