forked from alexreinert/piVCCU
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move package meta data from create scripts to single files
- Loading branch information
1 parent
f324937
commit d568968
Showing
19 changed files
with
179 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,33 +28,10 @@ DPkg::Post-Invoke {"if [ -e /var/lib/piVCCU/dts/patch_dts.sh ]; then /var/lib/pi | |
EOF | ||
|
||
mkdir -p $TARGET_DIR/DEBIAN | ||
|
||
cat <<EOT >> $TARGET_DIR/DEBIAN/control | ||
Package: pivccu-devicetree-armbian | ||
Version: $PKG_VERSION | ||
Architecture: armhf | ||
Maintainer: Alexander Reinert <[email protected]> | ||
Provides: pivccu-devicetree | ||
Section: misc | ||
Priority: extra | ||
Homepage: https://github.com/alexreinert/piVCCU | ||
Description: piVCCU DeviceTree files for armbian | ||
This package contains piVCCU DeviceTree files for armbian | ||
EOT | ||
|
||
cat <<EOT >> $TARGET_DIR/DEBIAN/postinst | ||
#!/bin/sh | ||
/var/lib/piVCCU/dts/patch_dts.sh | ||
EOT | ||
|
||
chmod +x $TARGET_DIR/DEBIAN/postinst | ||
|
||
cat <<EOT >> $TARGET_DIR/DEBIAN/prerm | ||
#!/bin/sh | ||
/var/lib/piVCCU/dts/revert_dts.sh | ||
EOT | ||
|
||
chmod +x $TARGET_DIR/DEBIAN/prerm | ||
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,77 +42,11 @@ mkdir -p $TARGET_DIR/var/lib/piVCCU/dkms | |
cp -p $CURRENT_DIR/pivccu/dkms/*.sh $TARGET_DIR/var/lib/piVCCU/dkms | ||
|
||
mkdir -p $TARGET_DIR/DEBIAN | ||
|
||
cat <<EOT >> $TARGET_DIR/DEBIAN/control | ||
Package: pivccu-modules-dkms | ||
Version: $PKG_VERSION | ||
Architecture: armhf | ||
Maintainer: Alexander Reinert <[email protected]> | ||
Provides: pivccu-kernel-modules | ||
Pre-Depends: dkms, build-essential | ||
Recommends: pivccu-devicetree | ||
Section: kernel | ||
Priority: extra | ||
Homepage: https://github.com/alexreinert/piVCCU | ||
Description: DKMS package for kernel modules needed for Homematic | ||
This package contains the a DKMS package for kernel needed for Homematic. | ||
EOT | ||
|
||
echo /lib/systemd/system/pivccu-dkms.service >> $TARGET_DIR/DEBIAN/conffiles | ||
|
||
for file in preinst postinst prerm postrm; do | ||
echo "#!/bin/sh" > $TARGET_DIR/DEBIAN/$file | ||
chmod 755 $TARGET_DIR/DEBIAN/$file | ||
cp -p $CURRENT_DIR/package/pivccu-modules-dkms/* $TARGET_DIR/DEBIAN | ||
for file in $TARGET_DIR/DEBIAN/*; do | ||
sed -i "s/{PKG_VERSION}/$PKG_VERSION/g" $file | ||
done | ||
|
||
cat <<EOF >> $TARGET_DIR/DEBIAN/postinst | ||
set -e | ||
systemctl enable pivccu-dkms.service | ||
DKMS_NAME=pivccu | ||
DKMS_PACKAGE_NAME=\$DKMS_NAME-dkms | ||
DKMS_VERSION=$PKG_VERSION | ||
postinst_found=0 | ||
case "\$1" in | ||
configure) | ||
for DKMS_POSTINST in /usr/lib/dkms/common.postinst /usr/share/\$DKMS_PACKAGE_NAME/postinst; do | ||
if [ -f \$DKMS_POSTINST ]; then | ||
\$DKMS_POSTINST \$DKMS_NAME \$DKMS_VERSION /usr/share/\$DKMS_PACKAGE_NAME "" \$2 | ||
postinst_found=1 | ||
break | ||
fi | ||
done | ||
if [ "\$postinst_found" -eq 0 ]; then | ||
echo "ERROR: DKMS version is too old and \$DKMS_PACKAGE_NAME was not" | ||
echo "built with legacy DKMS support." | ||
echo "You must either rebuild \$DKMS_PACKAGE_NAME with legacy postinst" | ||
echo "support or upgrade DKMS to a more current version." | ||
exit 1 | ||
fi | ||
;; | ||
esac | ||
EOF | ||
|
||
cat <<EOF >> $TARGET_DIR/DEBIAN/prerm | ||
set -e | ||
systemctl disable pivccu-dkms.service | ||
DKMS_NAME=pivccu | ||
DKMS_VERSION=$PKG_VERSION | ||
case "\$1" in | ||
remove|upgrade|deconfigure) | ||
if [ "\$(dkms status -m \$DKMS_NAME -v \$DKMS_VERSION)" ]; then | ||
dkms remove -m \$DKMS_NAME -v \$DKMS_VERSION --all | ||
fi | ||
;; | ||
esac | ||
EOF | ||
|
||
cd $WORK_DIR | ||
|
||
dpkg-deb --build pivccu-modules-dkms-$PKG_VERSION | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,54 +53,11 @@ cd $CURRENT_DIR/dts | |
dtc -@ -I dts -O dtb -o $TARGET_DIR/boot/overlays/pivccu-bcm2835.dtbo pivccu-bcm2835.dts | ||
|
||
mkdir -p $TARGET_DIR/DEBIAN | ||
|
||
cat <<EOT >> $TARGET_DIR/DEBIAN/control | ||
Package: pivccu-modules-raspberrypi | ||
Version: $PKG_VERSION | ||
Architecture: armhf | ||
Maintainer: Alexander Reinert <[email protected]> | ||
Provides: pivccu-kernel-modules | ||
Depends: raspberrypi-kernel (= $KERNEL_TAG) | ||
Section: kernel | ||
Priority: extra | ||
Homepage: https://github.com/alexreinert/piVCCU | ||
Description: Raspberry Pi kernel modules needed for Homematic | ||
This package contains the Raspberry Pi kernel needed for Homematic. | ||
EOT | ||
|
||
for file in preinst postinst prerm postrm; do | ||
echo "#!/bin/sh" > $TARGET_DIR/DEBIAN/$file | ||
chmod 755 $TARGET_DIR/DEBIAN/$file | ||
done | ||
|
||
for file in postinst postrm; do | ||
echo "depmod -a $KERNEL_RELEASE" >> $TARGET_DIR/DEBIAN/$file | ||
|
||
cat <<EOF >> $TARGET_DIR/DEBIAN/$file | ||
sed -i /boot/config.txt -e '/dtoverlay=pivccu-bcm2835/d' | ||
EOF | ||
|
||
done | ||
|
||
cat <<EOF >> $TARGET_DIR/DEBIAN/postinst | ||
echo "dtoverlay=pivccu-bcm2835" >> /boot/config.txt | ||
EOF | ||
|
||
cd $TARGET_DIR/boot | ||
|
||
for file in $(find * -type f) | ||
do | ||
cat <<EOF >> $TARGET_DIR/DEBIAN/preinst | ||
dpkg-divert --package rpikernelhack --divert /usr/share/rpikernelhack/$file /boot/$file | ||
EOF | ||
|
||
cat <<EOF >> $TARGET_DIR/DEBIAN/postinst | ||
if [ -f /usr/share/rpikernelhack/$file ]; then | ||
rm -f /boot/$file | ||
dpkg-divert --package rpikernelhack --remove --rename /boot/$file | ||
sync | ||
fi | ||
EOF | ||
cp -p $CURRENT_DIR/package/pivccu-modules-raspberrypi/* $TARGET_DIR/DEBIAN | ||
for file in $TARGET_DIR/DEBIAN/*; do | ||
sed -i "s/{PKG_VERSION}/$PKG_VERSION/g" $file | ||
sed -i "s/{KERNEL_TAG}/$KERNEL_TAG/g" $file | ||
sed -i "s/{KERNEL_RELEASE}/$KERNEL_RELEASE/g" $file | ||
done | ||
|
||
cd $WORK_DIR | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,65 +67,11 @@ mkdir -p $TARGET_DIR/lib/systemd/system/ | |
cp -p $CURRENT_DIR/pivccu/host/pivccu.service $TARGET_DIR/lib/systemd/system/ | ||
|
||
mkdir -p $TARGET_DIR/DEBIAN | ||
|
||
cat <<EOT >> $TARGET_DIR/DEBIAN/control | ||
Package: pivccu | ||
Version: $PKG_VERSION | ||
Architecture: armhf | ||
Maintainer: Alexander Reinert <[email protected]> | ||
Depends: pivccu-kernel-modules | ||
Pre-Depends: lxc, bridge-utils, systemd | ||
Section: misc | ||
Priority: extra | ||
Homepage: https://github.com/alexreinert/piVCCU | ||
Description: piVCCU - Homematic CCU LXC container | ||
This package contains piVCCU - a Homematic CCU LXC container | ||
EOT | ||
|
||
echo /etc/piVCCU/lxc.config >> $TARGET_DIR/DEBIAN/conffiles | ||
echo /lib/systemd/system/pivccu.service >> $TARGET_DIR/DEBIAN/conffiles | ||
|
||
cat <<EOT >> $TARGET_DIR/DEBIAN/postinst | ||
#!/bin/sh | ||
systemctl enable pivccu.service | ||
systemctl start pivccu.service || true | ||
if [ ! -e /usr/sbin/pivccu-attach ]; then | ||
ln -s /var/lib/piVCCU/pivccu-attach.sh /usr/sbin/pivccu-attach | ||
fi | ||
if [ ! -e /usr/sbin/pivccu-info ]; then | ||
ln -s /var/lib/piVCCU/pivccu-info.sh /usr/sbin/pivccu-info | ||
fi | ||
if [ ! -e /usr/sbin/pivccu-device ]; then | ||
ln -s /var/lib/piVCCU/pivccu-device.sh /usr/sbin/pivccu-device | ||
fi | ||
BRIDGE=\`brctl show | sed -n 2p | awk '{print \$1}'\` | ||
if [ -z "\$BRIDGE" ]; then | ||
echo "WARNING: No network bridge could be detected." | ||
fi | ||
sed -i 's/alexreinert.github.io/www.pivccu.de/g' /etc/apt/sources.list | ||
sed -i 's/http:\\/\\/www.pivccu.de/https:\\/\\/www.pivccu.de/g' /etc/apt/sources.list | ||
for file in \`find /etc/apt/sources.list.d/*.list -type f 2>/dev/null\`; do | ||
sed -i 's/alexreinert.github.io/www.pivccu.de/g' \$file | ||
sed -i 's/http:\\/\\/www.pivccu.de/https:\\/\\/www.pivccu.de/g' \$file | ||
cp -p $CURRENT_DIR/package/pivccu/* $TARGET_DIR/DEBIAN | ||
for file in $TARGET_DIR/DEBIAN/*; do | ||
sed -i "s/{PKG_VERSION}/$PKG_VERSION/g" $file | ||
sed -i "s/{CCU_VERSION}/$CCU_VERSION/g" $file | ||
done | ||
EOT | ||
|
||
chmod +x $TARGET_DIR/DEBIAN/postinst | ||
|
||
cat <<EOT >> $TARGET_DIR/DEBIAN/prerm | ||
#!/bin/sh | ||
systemctl stop pivccu.service | ||
systemctl disable pivccu.service | ||
rm -f /usr/sbin/pivccu-attach | ||
rm -f /usr/sbin/pivccu-info | ||
rm -f /usr/sbin/pivccu-device | ||
EOT | ||
|
||
chmod +x $TARGET_DIR/DEBIAN/prerm | ||
|
||
cd $WORK_DIR | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Package: pivccu-devicetree-armbian | ||
Version: {PKG_VERSION} | ||
Architecture: armhf | ||
Maintainer: Alexander Reinert <[email protected]> | ||
Provides: pivccu-devicetree | ||
Section: misc | ||
Priority: extra | ||
Homepage: https://github.com/alexreinert/piVCCU | ||
Description: piVCCU DeviceTree files for armbian | ||
This package contains piVCCU DeviceTree files for armbian | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
/var/lib/piVCCU/dts/patch_dts.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
/var/lib/piVCCU/dts/revert_dts.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/lib/systemd/system/pivccu-dkms.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Package: pivccu-modules-dkms | ||
Version: {PKG_VERSION} | ||
Architecture: armhf | ||
Maintainer: Alexander Reinert <[email protected]> | ||
Provides: pivccu-kernel-modules | ||
Pre-Depends: dkms, build-essential | ||
Recommends: pivccu-devicetree | ||
Section: kernel | ||
Priority: extra | ||
Homepage: https://github.com/alexreinert/piVCCU | ||
Description: DKMS package for kernel modules needed for Homematic | ||
This package contains the a DKMS package for kernel needed for Homematic. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
set -e | ||
|
||
systemctl enable pivccu-dkms.service | ||
|
||
DKMS_NAME=pivccu | ||
DKMS_PACKAGE_NAME=$DKMS_NAME-dkms | ||
DKMS_VERSION={PKG_VERSION} | ||
|
||
postinst_found=0 | ||
|
||
case "$1" in | ||
configure) | ||
for DKMS_POSTINST in /usr/lib/dkms/common.postinst /usr/share/$DKMS_PACKAGE_NAME/postinst; do | ||
if [ -f $DKMS_POSTINST ]; then | ||
$DKMS_POSTINST $DKMS_NAME $DKMS_VERSION /usr/share/$DKMS_PACKAGE_NAME "" $2 | ||
postinst_found=1 | ||
break | ||
fi | ||
done | ||
if [ "$postinst_found" -eq 0 ]; then | ||
echo "ERROR: DKMS version is too old and $DKMS_PACKAGE_NAME was not" | ||
echo "built with legacy DKMS support." | ||
echo "You must either rebuild $DKMS_PACKAGE_NAME with legacy postinst" | ||
echo "support or upgrade DKMS to a more current version." | ||
exit 1 | ||
fi | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
set -e | ||
|
||
systemctl disable pivccu-dkms.service | ||
|
||
DKMS_NAME=pivccu | ||
DKMS_VERSION={PKG_VERSION} | ||
|
||
case "$1" in | ||
remove|upgrade|deconfigure) | ||
if [ "$(dkms status -m $DKMS_NAME -v $DKMS_VERSION)" ]; then | ||
dkms remove -m $DKMS_NAME -v $DKMS_VERSION --all | ||
fi | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Package: pivccu-modules-raspberrypi | ||
Version: {PKG_VERSION} | ||
Architecture: armhf | ||
Maintainer: Alexander Reinert <[email protected]> | ||
Provides: pivccu-kernel-modules | ||
Depends: raspberrypi-kernel (= {KERNEL_TAG}) | ||
Section: kernel | ||
Priority: extra | ||
Homepage: https://github.com/alexreinert/piVCCU | ||
Description: Raspberry Pi kernel modules needed for Homematic | ||
This package contains the Raspberry Pi kernel needed for Homematic. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
depmod -a {KERNEL_RELEASE} | ||
|
||
if [ -f /usr/share/rpikernelhack/overlays/pivccu-bcm2835.dtbo ]; then | ||
rm -f /boot/overlays/pivccu-bcm2835.dtbo | ||
dpkg-divert --package rpikernelhack --remove --rename /boot/overlays/pivccu-bcm2835.dtbo | ||
sync | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
depmod -a {KERNEL_RELEASE} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
dpkg-divert --package rpikernelhack --divert /usr/share/rpikernelhack/overlays/pivccu-bcm2835.dtbo /boot/overlays/pivccu-bcm2835.dtbo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/etc/piVCCU/lxc.config | ||
/lib/systemd/system/pivccu.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Package: pivccu | ||
Version: {PKG_VERSION} | ||
Architecture: armhf | ||
Maintainer: Alexander Reinert <[email protected]> | ||
Depends: pivccu-kernel-modules | ||
Pre-Depends: lxc, bridge-utils, systemd | ||
Section: misc | ||
Priority: extra | ||
Homepage: https://github.com/alexreinert/piVCCU | ||
Description: piVCCU - Homematic CCU LXC container | ||
This package contains piVCCU - a Homematic CCU LXC container | ||
|
Oops, something went wrong.