forked from alexreinert/piVCCU
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_devicetree_armbian.sh
executable file
·44 lines (28 loc) · 1.14 KB
/
create_devicetree_armbian.sh
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
#!/bin/bash
PKG_BUILD=37
CURRENT_DIR=$(pwd)
WORK_DIR=$(mktemp -d)
PKG_VERSION=1.0.$PKG_BUILD
TARGET_DIR=$WORK_DIR/pivccu-devicetree-armbian-$PKG_VERSION
cd $WORK_DIR
mkdir -p $TARGET_DIR/var/lib/piVCCU/dts
cp $CURRENT_DIR/dts/armbian/* $TARGET_DIR/var/lib/piVCCU/dts
cp $CURRENT_DIR/dts/*.dts.include $TARGET_DIR/var/lib/piVCCU/dts
mkdir -p $TARGET_DIR/boot/overlay-user
cd $CURRENT_DIR/dts
for dts in $(find *.dts -type f); do
dtc -@ -I dts -O dtb -W no-unit_address_vs_reg -o $TARGET_DIR/boot/overlay-user/${dts%.dts}.dtbo $dts
done
mkdir -p $TARGET_DIR/etc/apt/apt.conf.d
cat <<EOF >> $TARGET_DIR/etc/apt/apt.conf.d/99pivccu_patch_dts
DPkg::Post-Invoke {"if [ -e /var/lib/piVCCU/dts/patch_dts.sh ]; then /var/lib/piVCCU/dts/patch_dts.sh; fi";};
EOF
mkdir -p $TARGET_DIR/DEBIAN
cp -p $CURRENT_DIR/package/pivccu-devicetree-armbian/* $TARGET_DIR/DEBIAN
for file in $TARGET_DIR/DEBIAN/*; do
sed -i "s/{PKG_VERSION}/$PKG_VERSION/g" $file
done
cd $WORK_DIR
dpkg-deb --build -Zxz pivccu-devicetree-armbian-$PKG_VERSION
cp pivccu-devicetree-armbian*.deb $CURRENT_DIR
echo "Please clean-up the work dir temp folder $WORK_DIR, e.g. by doing rm -R $WORK_DIR"