From: Bastian Dehn Date: Sat, 13 Apr 2024 08:49:50 +0000 (+0200) Subject: add postinst for debian X-Git-Tag: v1.0.0^2~17^2~2 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=21c16ee54e746c2322344f6c5324960cd76ef0a3;p=sane-kds-s2000w-net.git add postinst for debian --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f0e2a2..4a83338 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -74,5 +74,6 @@ SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) SET(CPACK_DEBIAN_PACKAGE_SECTION "libs") SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "sane network backend for kodak alaris s2000w series") set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_CURRENT_BINARY_DIR}/conffiles) +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_CURRENT_SOURCE_DIR}/debian/postinst) INCLUDE(CPack) \ No newline at end of file diff --git a/src/debian/postinst b/src/debian/postinst new file mode 100755 index 0000000..00151cd --- /dev/null +++ b/src/debian/postinst @@ -0,0 +1,26 @@ +#!/bin/bash + +main() +{ + DLLCONFIG="/etc/sane.d/dll.conf" + ENTRY="kds_s2000w_net" + + if [ ! -f "$DLLCONFIG" ]; then + echo "ERROR: $DLLCONFIG does not exist" + exit 1 + fi + + echo "found $DLLCONFIG" + ENTRYCHECK=$(cat $DLLCONFIG | grep $ENTRY) + + if [ -n "$ENTRYCHECK" ]; then + echo "$ENTRY entry exists in $DLLCONFIG" + exit 0 + fi + + sed -i "\$a$ENTRY" $DLLCONFIG + echo "add $ENTRY to $DLLCONFIG" +} + +main +exit 0 \ No newline at end of file