]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add postinst for debian
authorBastian Dehn <hhaalo@arcor.de>
Sat, 13 Apr 2024 08:49:50 +0000 (10:49 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 13 Apr 2024 08:51:19 +0000 (10:51 +0200)
src/CMakeLists.txt
src/debian/postinst [new file with mode: 0755]

index 3f0e2a257a783cbb460addab0dc69e4cefa75557..4a8333801afc302cd073beb79aecb2f9f2c86984 100644 (file)
@@ -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 (executable)
index 0000000..00151cd
--- /dev/null
@@ -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