summarylogtreecommitdiffstats
path: root/dwarffortress-sf.install
blob: e5ad5344e86f22322dcc0bd91e93bc7ea36958d4 (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
## arg 1:  the new package version
post_install() {
  echo "Make sure to add your user to the games group to play dwarffortress"
  post_upgrade $1 0
}

## arg 1:  the new package version
## arg 2:  the old package version
post_upgrade() {
  #may need to update savegames
  if [ ! `vercmp $2 $1` -eq 1 ]; then
    echo "Raws might have changed. Do you want to update your savegames? [y/N]"
    read -n 1 choice
    if [[ ("${choice}" == "y") || ("${choice}" == "Y") ]]; then
      for dir in $(find /opt/df_linux-sf/data/save/ -type d); do
        if [ -d "${dir}/raw" ]; then
          echo "Upgrading save ${dir}"
          cp -rf /opt/df_linux-sf/raw "${dir}/"
        fi
      done
    fi
  fi

  # Make sure that permissions are correct
  chown -R root:games /opt/df_linux-sf/data
  chown root:games /opt/df_linux-sf
  chmod 775 /opt/df_linux-sf
  find /opt/df_linux-sf/data/save -type d -exec chmod 775 {} + &
  find /opt/df_linux-sf/data/save -type f -exec chmod 664 {} + &
  
}

# vim:set ts=2 sw=2 et: