blob: 9e040f3a9298b6b6b721b6527a946c1a8c4895fc (
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
|
#!/bin/bash
get_users() {
usrs=()
if [[ -z "${SUDO_USER}" ]];
then
IFS=' ' usrs=($(users))
else
usrs+=("$SUDO_USER")
fi
echo usrs
}
post_install() {
users=()
if [[ -z "${SUDO_USER}" ]];
then # If pamac is called without sudo, we do not know the calling user, so we might as well try to install it for every user
IFS=' ' read -r -a users <<< "$(users | sort -u | tr ' ' '\n' | sort -u | tr '\n' ' ')"
else # pacman, on the other had requires sudo. pamac can be called with sudo but it is not recommended. I have no idea about other AUR helpers.
users+=("$SUDO_USER")
fi
for user in "${users[@]}"
do
echo "Installing Isabelle linter for user: $user"
su "$user" -c "isabelle components -u /opt/isabelle-linter/"
done
}
post_upgrade() {
pre_remove
post_install
}
pre_remove() {
users=()
if [[ -z "${SUDO_USER}" ]];
then
IFS=' ' read -r -a users <<< "$(users | sort -u | tr ' ' '\n' | sort -u | tr '\n' ' ')"
else
users+=("$SUDO_USER")
fi
for user in "${users[@]}"
do
echo "Removing Isabelle linter for user: $user"
su "$user" -c "isabelle components -x /opt/isabelle-linter/"
done
}
|