summarylogtreecommitdiffstats
path: root/slimbookbattery.install
blob: be3eb6b8457793858dcb5303db3bb5a328d56fba (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
post_install() {
  if python /usr/share/slimbookbattery/src/check_config.py; then
    echo 'Configuration OK'
  fi

  if chmod -R 766 /home/*/.config/slimbookbattery; then
    echo 'Read/Write permissions given to config files.'
  fi

  if chmod -R 755 /usr/share/slimbookbattery/src/*.sh; then
    echo 'Exec permissions given.'
  fi

  if chmod -R 755 /usr/share/slimbookbattery/src/*.py; then
    echo 'Exec permissions given to src.'
  fi

  # Enabling tlp.service
  if sudo systemctl enable tlp.service; then
    echo 'Tlp service enabled'
  fi

  echo 'Checking users autostart files'
  for user in $(ls /home); do
    echo
    echo $user

    if test -f /home/$user/.config/autostart/slimbookbattery-autostart.desktop; then
      echo "Restoring /home/$user/.config/autostart/slimbookbattery-autostart.desktop"
      cp /usr/share/slimbookbattery/src/slimbookbattery-autostart.desktop /home/$user/.config/autostart/slimbookbattery-autostart.desktop
    fi
  done
}

post_upgrade() {
    post_install
}