summarylogtreecommitdiffstats
path: root/appimage-git.install
blob: 092bd191b9d05244d0578ce935620ba9516a1196 (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

install_appimaged_service() {
  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
}

uninstall_appimaged_service() {
  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
}

post_install() {
    echo "----------------------------------------------------------------"
    echo "To enable the appimaged daemon on your account:"
    echo "systemctl --user enable appimaged"
    echo "systemctl --user start appimaged"
    echo "----------------------------------------------------------------"
}