summarylogtreecommitdiffstats
path: root/flutter-common.install
blob: 74db8fe8878c8d32a91427498716f3dfa41de5e1 (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
pre_install() {
  NEW=$1
  OLD=$2

  MAJOR=$(echo $OLD | awk -F '.' '{print $1}')
  MINOR=$(echo $OLD | awk -F '.' '{print $2}')
  PATCH=$(echo $OLD | awk -F '+' '{print $1}' | awk -F '.' '{print $3}')

  #if [[ $MAJOR == 3 && $MINOR -le 19 && $MINOR -le 4]]; then
    if [ -d "/opt/flutter" ]; then
      echo "Removing leftovers of previous Flutter installation in /opt/flutter."
      rm -rf "/opt/flutter"
    fi
    if [ -d "/usr/lib/flutter/.git" ]; then
      echo "Removing unwanted git-refs in /usr/lib/flutter/.git."
      rm -rf "/usr/lib/flutter/.git"
    fi
  #fi
}

post_install() {
  NEW=$1
  OLD=$2

  MAJOR=$(echo $OLD | awk -F '.' '{print $1}')
  MINOR=$(echo $OLD | awk -F '.' '{print $2}')
  PATCH=$(echo $OLD | awk -F '+' '{print $1}' | awk -F '.' '{print $3}')

  #if [[ $MAJOR == 3 && $MINOR -lt 8 ]]; then
    if grep -q "flutterusers" /etc/group; then
      echo "Removing group flutterusers as no longer needed."
      groupdel "flutterusers"
    fi
  #fi
}