File: 18-colorit-missing-packages.patch

package info (click to toggle)
dictd 1.13.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,940 kB
  • sloc: ansic: 12,523; sh: 4,435; yacc: 512; makefile: 442; cpp: 277; lex: 256; perl: 175; awk: 12
file content (38 lines) | stat: -rw-r--r-- 1,173 bytes parent folder | download | duplicates (2)
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
From: Robert Luberda <robert@debian.org>
Date: Sat, 30 Jun 2018 00:21:59 +0200
Subject: Check for missing packages in colorit

As gawk and m4 are not strict dependencies of the dict
package, make colorit fail with a message suggesting
installation of the packages when the appropriate commands
are missing.

Bugs-Ubuntu: https://bugs.launchpad.net/1048062
---
 colorit.in | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/colorit.in b/colorit.in
index 27f5481..4d94ad2 100755
--- a/colorit.in
+++ b/colorit.in
@@ -76,6 +76,19 @@ if test "_$pp" = "_-"; then
    pp=
 fi
 
+missing_pkg=""
+command -v gawk > /dev/null || missing_pkg="$missing_pkg gawk"
+[ "$pp" != m4 ] || command -v m4 > /dev/null || missing_pkg="$missing_pkg m4"
+if [ -n "$missing_pkg" ]; then
+  echo "*********************************************************************"  >&2
+  echo >&2
+  echo " To use 'colorit', please install the following package(s):$missing_pkg" >&2
+  echo >&2
+  echo "*********************************************************************"  >&2
+  exit 1
+fi
+
+
 convert_files_to_stdout (){
     gawk -v config_file="$config_file" -v pp="$pp" '
     BEGIN {