summarylogtreecommitdiffstats
path: root/appimage-git.install
blob: 98e08998cf1c461f36f6ddc289116c37074ed5b6 (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
post_install() {
  for username in `ls /home`; do
    user_exists=$(id -u $username > /dev/null 2>&1; echo $?)

    if [ "$user_exists" != "1" ]; then
        user_id=`id --user $username`

        su - $username -c "XDG_RUNTIME_DIR=/run/user/$user_id /usr/bin/systemctl --user daemon-reload > /dev/null 2>&1"
        su - $username -c "XDG_RUNTIME_DIR=/run/user/$user_id /usr/bin/systemctl --user enable appimaged > /dev/null 2>&1"
        su - $username -c "XDG_RUNTIME_DIR=/run/user/$user_id /usr/bin/systemctl --user start appimaged > /dev/null 2>&1"
    fi
  done
}

pre_remove() {
  for username in `ls /home`; do
    user_exists=$(id -u $username > /dev/null 2>&1; echo $?)

    if [ "$user_exists" != "1" ]; then
        user_id=`id --user $username`

        su - $username -c "XDG_RUNTIME_DIR=/run/user/$user_id /usr/bin/systemctl --user daemon-reload > /dev/null 2>&1"
        su - $username -c "XDG_RUNTIME_DIR=/run/user/$user_id /usr/bin/systemctl --user stop appimaged > /dev/null 2>&1"
        su - $username -c "XDG_RUNTIME_DIR=/run/user/$user_id /usr/bin/systemctl --user disable appimaged > /dev/null 2>&1"
    fi
  done
}