summaryrefslogtreecommitdiff
path: root/libre-testing/linux-libre-veyron/linux.install
blob: a524c8c38cfac296d91edbca57d29bc599c675fd (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
flash_kernel() {
  major=$(mountpoint -d / | cut -f 1 -d ':')
  minor=$(mountpoint -d / | cut -f 2 -d ':')
  device=$(awk '{if ($1 == "'"${major}"'" && $2 == "'"${minor}"'") print $4}' < /proc/partitions)
  device="/dev/${device/%2/1}"

  echo "A new kernel version needs to be flashed onto ${device}."
  echo -n "  do you want to do this now? [y/N] "
  read -n 1 -r
  (( ${#REPLY} == 1 )) && echo

  if [[ ! $REPLY =~ ^[Yy]$ ]]; then
    echo "You can do this later by running:"
    echo "# dd if=/boot/vmlinux.kpart of=${device}"
  else
    dd if=/boot/vmlinux.kpart of="${device}"
    sync
  fi
}

post_install () {
  flash_kernel
}

post_upgrade() {
  if [ "$(uname -m)" = "x86_64" ] || [ "$(uname -m)" = "i686" ]; then
    if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then
      echo "WARNING: /boot appears to be a separate partition but is not mounted."
    fi
  fi
  flash_kernel
}

post_remove() {
  rm -f boot/initramfs-%PKGBASE%.img
  rm -f boot/initramfs-%PKGBASE%-fallback.img
}