blob: d2eab2c0019bb350a647537567fafb72c6173aa7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# Copyright (C) 2024-2026 Maria Lisina
# Copyright (C) 2024-2026 Danil Lisin
# SPDX-License-Identifier: Apache-2.0
if [[ -n "${1}" ]]
then
data_name="${1}"
check_table=(${data_table[@]})
shift
fi
while [[ ${#check_table} -ge 2 ]]
do
if [[ "${data_name}" == "${check_table[1]}" ]]
then
break
elif [[ "${check_table[1]}" == "${check_table[-2]}" ]]
then
notification_text="No requested data found"
return
fi
shift 2 check_table
done
if mkdir "${user_config}_stop.lock"
then
notification_text="Click again to confirm data removal"
return
fi
for lock in ${user_locks[@]}
do
until mkdir "${user_config}_${lock}.lock"
do
sleep 1
done
done
if [[ -n "${data_name}" ]]
then
if ! rm -fr "${user_config}/${check_table[1]}"
then
notification_text="Something went wrong, try again later"
fi
else
if ! rm -fr "${user_config}"
then
notification_text="Something went wrong, try again later"
fi
fi
if [[ -d "${user_config}" ]]
then
user_data=($(ls -1 "${user_config}"))
if [[ ${#user_data} -eq 0 ]]
then
rmdir "${user_config}"
fi
fi
source "${units}/stop.zsh"
for lock in ${user_locks[@]}
do
rmdir "${user_config}_${lock}.lock"
done
rmdir "${user_config}_stop.lock"
|