Skip to content

Commit cbb2b93

Browse files
committed
checkspace
1 parent 9e86692 commit cbb2b93

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

install-webint-ob.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# Copyright (c) 2023 rM-self-serve
33
# SPDX-License-Identifier: MIT
44

5-
webinterface_onboot_sha256sum='edad550010f408ede2d85f723174735a19e9ffa12ffa31330a3b772e339ed841'
5+
webinterface_onboot_sha256sum='8795ecb9bdd18b84deab0efa1a96c08ff53559d65567babb0088400da44daf0f'
66
service_file_sha256sum='64cfdd5c8eaea1bc8df2e734a41c7ff038585cc2f4248c79e50531901b1ef651'
77

8-
release='v1.2.1'
8+
release='v1.2.2'
99

1010
installfile='./install-webint-ob.sh'
1111
pkgname='webinterface-onboot'

webinterface-onboot

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,19 @@ main() {
3838
run
3939
;;
4040
'apply-hack')
41+
checkspace
4142
apply_hack
4243
;;
4344
'revert-hack')
45+
checkspace
4446
revert_hack
4547
;;
4648
'apply-prstip')
49+
checkspace
4750
apply_prstip
4851
;;
4952
'revert-prstip')
53+
checkspace
5054
revert_prstip
5155
;;
5256
'is-hack-applied')
@@ -96,6 +100,36 @@ cli_info() {
96100
echo ' -h, --help Show help'
97101
}
98102

103+
checkspace() {
104+
if ! _checkspace / 1; then
105+
(
106+
echo "Not enough space on /"
107+
echo "Try to free space by running: journalctl --vacuum-time=1m"
108+
echo "Or: systemctl restart xochitl"
109+
exit 10
110+
)
111+
exit 1
112+
fi
113+
if ! _checkspace /home 12; then
114+
(
115+
echo "Not enough space on /home"
116+
exit 10
117+
)
118+
exit 1
119+
fi
120+
}
121+
122+
_checkspace() {
123+
part=$1
124+
needed=$2
125+
_available=$(df "$part" | tail -n1 | awk '{print $4}')
126+
available=$(("$_available" / 1024))
127+
if [ $available -lt "$needed" ]; then
128+
echo "Less than ${needed}MB free, ${available}MB"
129+
return 1
130+
fi
131+
}
132+
99133
run_vars() {
100134
user_conf='/home/root/.config/remarkable/xochitl.conf'
101135
usb0iprange='10.11.99.1/32'

0 commit comments

Comments
 (0)