replace proccess check to filelock, tanks @themactep

pull/275/head
cronyx 2022-07-22 20:26:32 +03:00
parent f749e80de8
commit b694eda135
1 changed files with 7 additions and 5 deletions

View File

@ -3,11 +3,6 @@
# OpenIPC.org | v.20220722
#
if [ $(pidof sysupgrade) ]; then
echo "Sysupgrade script already running!"
exit 1
fi
set -e
echo_c() {
@ -111,6 +106,11 @@ free_resources() {
sync; echo 3 > /proc/sys/vm/drop_caches
}
create_lock() {
[ -f /tmp/sysupgrade.lock ] && echo -e "\e[1;31m\nAnother sysupgrade process already running!\e[0m\n" && exit 1
touch /tmp/sysupgrade.lock
}
get_device() {
echo -n "/dev/$(grep "\"$1\"" /proc/mtd | cut -d: -f1)"
}
@ -249,6 +249,8 @@ print_sysinfo
echo_c 97 "\nTry '$(basename "$0") --help' for options." && \
exit 0
create_lock
free_resources
[ "$remote_update" -eq 1 ] && download_firmware
[ "$update_kernel" -eq 1 ] && do_update_kernel "$kernel_file"