summarylogtreecommitdiffstats
path: root/basis-pro5-install.sh
blob: caae6b0f8358c4057d067d29314db93e8f9498b2 (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
post_upgrade() {
  systemctl daemon-reload
  if systemctl -q is-enabled "basis_lmgrd.service"; then
    systemctl start "basis_lmgrd.service"
  fi
  #echo "Startup scripts updated or installed"
  # This prevents editing of the supplied utilites. Please make a copy.
  # chattr ensures that even root can't do it
  chattr +i "/usr/local/basis/pro5"/{ext,std,graphics}/*
}

post_install() {
  post_upgrade
  # It's a shame this path is hard coded into the license manager.
  # This, or maybe a binary patch?
  # Binary patch complete. gnu sed is binary compatible.
  # ln -s '/tmp' '/usr/tmp' || :
}

pre_upgrade() {
  systemctl stop "basis_lmgrd.service"
  rm -rf '/var/tmp/.flexlm'
  rm -f '/var/tmp/lockbasis' # otherwise a user change cannot work
  if ! chattr -i "/usr/local/basis/pro5"/{ext,std,graphics}/*; then
    # We must do this because of bug https://bugs.archlinux.org/task/45988
    case "/usr/local/basis" in
    '/usr/local/basis') chattr -i '/usr/share/basis/pro5'/{ext,std,graphics}/*;;
    '/usr/share/basis') chattr -i '/usr/local/basis/pro5'/{ext,std,graphics}/*;;
    esac
  fi
}

pre_remove() {
  pre_upgrade
}

post_remove() {
  systemctl daemon-reload
  #echo "startup scripts removed"
  # Having created this outside of the package manager, it isn't safe to delete.
  # Another package may have created it first.
  # Another Install may have configured based on its presence.
  # The admin will need to remove it and put it back if there's problems.
  #if [ -L '/usr/tmp' ]; then
  #  rm -f '/usr/tmp'
  #fi
}