Official Debian support!
#84
Code:
#!/bin/sh

# This script installs RockPro64 devicetree files into /boot when new kernels
# are installed. It should be copied into /etc/kernel/{postinst.d,postrm.d}/
# and named with a "zz-" prefix (e.g. zz-rockpro64-dtbs).
# https://www.debian.org/doc/manuals/debian-kernel-handbook/ch-update-hooks.html

set -e
exec </dev/null >&2  # Don't use stdin or stdout

version="$1"
pkgname=${DPKG_MAINTSCRIPT_PACKAGE:-kernel package}
if [ -z "$version" ]; then
    echo "W: $pkgname did not pass a version number; exiting."
    exit 0
fi

eval set -- "$DEB_MAINT_PARAMS"
action="$1"

srcdir=/usr/lib/linux-image-${version}/rockchip
fname=rk3399-rockpro64-v2.dtb
dirname=dtbs-${version}
destsubdir=/boot/$dirname/rockchip

if [ "$action" = configure ]; then

    if ! [ -f "$srcdir/$fname" ]; then
        echo "W: $pkgname did not provide $srcdir/$fname; exiting."
        exit 0
    fi

    echo "I: installing $destsubdir/$fname"
    mkdir -p "$destsubdir"
    cp "$srcdir/$fname" "$destsubdir/$fname"

    if [ -L /boot/dtbs ] && [ "$(readlink /boot/dtbs)" != "$dirname" ]; then
        #echo "I: moving /boot/dtbs symlink to /boot/dtbs.old"
        rm -f /boot/dtbs.old
        mv /boot/dtbs /boot/dtbs.old
    fi
    if ! [ -L /boot/dtbs ]; then
        #echo "I: creating /boot/dtbs symlink"
        ln -s "$dirname" /boot/dtbs
    fi
fi

if [ "$action" = remove ]; then

    if [ -L /boot/dtbs ] && [ "$(readlink /boot/dtbs)" = "$dirname" ]; then
        #echo "I: removing /boot/dtbs symlink"
        rm /boot/dtbs

        if [ -L /boot/dtbs.old ]; then
            #echo "I: moving /boot/dtbs.old symlink to /boot/dtbs"
            mv /boot/dtbs.old /boot/dtbs
        fi
        #todo: look for candidates to become .old, so removing two new kernels
        #      in a row won't leave the system without a dtbs symlink
    fi

    if [ -f "$destsubdir/$fname" ]; then
        echo "I: removing $destsubdir/$fname"
        rm "$destsubdir/$fname"
        rmdir "$destsubdir" || true
        rmdir "/boot/$dirname" || true
    fi
fi
  Reply


Messages In This Thread
Official Debian support! - by Luke - 04-26-2020, 03:02 PM
RE: Official Debian support! - by kuleszdl - 04-27-2020, 09:52 AM
RE: Official Debian support! - by linuxha - 04-27-2020, 10:43 PM
RE: Official Debian support! - by jazzmans - 04-28-2020, 05:35 PM
RE: Official Debian support! - by MIchael - 04-28-2020, 06:42 PM
RE: Official Debian support! - by jazzmans - 04-30-2020, 09:05 AM
RE: Official Debian support! - by pfeerick - 04-28-2020, 10:53 PM
RE: Official Debian support! - by fire219 - 04-30-2020, 12:28 PM
RE: Official Debian support! - by kuleszdl - 04-30-2020, 02:51 PM
RE: Official Debian support! - by amp - 05-01-2020, 01:28 AM
RE: Official Debian support! - by dukla2000 - 06-06-2020, 05:46 AM
RE: Official Debian support! - by pfeerick - 05-01-2020, 02:45 AM
RE: Official Debian support! - by kuleszdl - 05-01-2020, 10:31 AM
RE: Official Debian support! - by kuleszdl - 05-01-2020, 11:12 AM
RE: Official Debian support! - by foresto - 05-03-2020, 09:56 PM
RE: Official Debian support! - by tllim - 05-09-2020, 03:57 PM
RE: Official Debian support! - by xmixahlx - 06-06-2020, 03:06 PM
RE: Official Debian support! - by pinepersoon - 06-13-2020, 12:22 PM
RE: Official Debian support! - by foresto - 06-18-2020, 12:20 PM
RE: Official Debian support! - by pinepersoon - 06-25-2020, 03:53 PM
RE: Official Debian support! - by kuleszdl - 06-21-2020, 04:38 PM
RE: Official Debian support! - by xmixahlx - 06-21-2020, 09:18 PM
RE: Official Debian support! - by therrmann - 06-25-2020, 01:15 AM
RE: Official Debian support! - by therrmann - 06-25-2020, 02:03 AM
RE: Official Debian support! - by wasgurd - 07-03-2020, 01:01 PM
RE: Official Debian support! - by bcnaz - 07-03-2020, 06:31 PM
RE: Official Debian support! - by Nikolay_Po - 08-16-2020, 10:50 PM
RE: Official Debian support! - by Nikolay_Po - 08-17-2020, 04:31 PM
RE: Official Debian support! - by foresto - 08-16-2020, 11:21 PM
RE: Official Debian support! - by lrb - 09-12-2020, 09:53 PM
RE: Official Debian support! - by u974615 - 08-17-2020, 04:12 PM
RE: Official Debian support! - by xmixahlx - 08-19-2020, 11:54 AM
RE: Official Debian support! - by u974615 - 08-20-2020, 04:53 PM
RE: Official Debian support! - by moonwalkers - 08-21-2020, 10:49 PM
RE: Official Debian support! - by u974615 - 08-27-2020, 03:04 PM
RE: Official Debian support! - by moonwalkers - 08-27-2020, 04:30 PM
RE: Official Debian support! - by 5chn4pp - 08-26-2020, 01:28 PM
RE: Official Debian support! - by dkaparis - 10-11-2020, 08:10 AM
RE: Official Debian support! - by MSteam - 10-25-2020, 09:05 AM
RE: Official Debian support! - by snoopy_ca - 11-01-2020, 02:58 PM
RE: Official Debian support! - by eduapof - 11-17-2020, 06:42 PM
RE: Official Debian support! - by James Good - 12-21-2020, 11:39 AM
RE: Official Debian support! - by toons - 12-22-2020, 05:46 AM
RE: Official Debian support! - by kuleszdl - 12-24-2020, 12:00 PM
RE: Official Debian support! - by toons - 12-25-2020, 07:11 AM
RE: Official Debian support! - by kuleszdl - 12-25-2020, 08:46 AM
RE: Official Debian support! - by igorp - 01-05-2021, 07:17 AM
RE: Official Debian support! - by kuleszdl - 01-03-2021, 12:05 AM
RE: Official Debian support! - by kuleszdl - 01-05-2021, 09:44 AM
RE: Official Debian support! - by ryo - 01-06-2021, 04:08 AM
RE: Official Debian support! - by kwinz - 01-06-2021, 06:18 PM
RE: Official Debian support! - by igorp - 01-27-2021, 05:56 PM
RE: Official Debian support! - by ab1jx - 01-07-2021, 12:03 AM
RE: Official Debian support! - by kuleszdl - 01-07-2021, 09:12 AM
RE: Official Debian support! - by as365n4 - 01-19-2021, 12:35 PM
RE: Official Debian support! - by foobar - 01-30-2021, 07:52 PM
RE: Official Debian support! - by igorp - 01-31-2021, 06:34 PM
RE: Official Debian support! - by nyankat - 02-28-2021, 09:57 PM
RE: Official Debian support! - by ab1jx - 03-02-2021, 09:01 AM
RE: Official Debian support! - by alkisg - 04-26-2021, 03:01 AM
RE: Official Debian support! - by Enig123 - 04-28-2021, 01:22 PM
RE: Official Debian support! - by ab1jx - 04-28-2021, 03:38 PM
RE: Official Debian support! - by moonwalkers - 05-21-2021, 11:26 PM
RE: Official Debian support! - by jbrock - 05-30-2021, 03:43 PM
RE: Official Debian support! - by moonwalkers - 05-31-2021, 12:48 AM
RE: Official Debian support! - by jbrock - 06-01-2021, 01:09 AM
RE: Official Debian support! - by moonwalkers - 06-01-2021, 11:20 AM
missing firmware - by wchouser3 - 01-25-2022, 03:58 AM
RE: missing firmware - by foresto - 01-25-2022, 04:44 AM
RE: missing firmware - by wchouser3 - 01-25-2022, 11:49 AM
RE: Official Debian support! - by Barugon - 03-22-2022, 01:16 PM
RE: Official Debian support! - by as365n4 - 03-23-2022, 12:27 PM
RE: Official Debian support! - by Barugon - 03-24-2022, 11:43 PM
RE: Official Debian support! - by andersh - 05-19-2022, 10:11 AM
RE: Official Debian support! - by ljones - 10-29-2022, 11:44 AM
RE: Official Debian support! - by foresto - 10-29-2022, 01:35 PM
RE: Official Debian support! - by varac - 08-16-2023, 01:32 AM
RE: Official Debian support! - by foresto - 08-16-2023, 04:35 PM
debian kernel postinst/postrm script - by foresto - 12-16-2023, 03:00 PM
RE: Official Debian support! - by grobbs - 03-15-2024, 02:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  official support for aarch64 in OpenArena Opvolger 0 1,560 03-24-2022, 02:23 PM
Last Post: Opvolger
  Fedora 32 Release, improved support for Rock(Pro)64 Tharadash 2 5,872 05-05-2020, 08:37 AM
Last Post: zer0sig
  Kickstarter: Allwinner VPU support in the official Linux kernel xalius 8 14,825 10-03-2019, 03:03 AM
Last Post: bunkerWHz
Exclamation First images with DRM and Mali support for A64 Luke 74 119,323 04-27-2018, 10:22 PM
Last Post: Max11

Forum Jump:


Users browsing this thread: 1 Guest(s)