/useful/trunk-1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/useful/trunk-1

« back to all changes in this revision

Viewing changes to scripts/process_text_to_image.sh

  • Committer: Gustav Hartvigsson
  • Date: 2024-07-10 21:07:31 UTC
  • Revision ID: git-v1:7631e167e18af814d7b1d6d9d4118e64e4afa741
* useful.inc.sh
  - changed from '-gt' to '>' in __find_tool ()

* process_text_to_image.sh
  - use function library

* pdf2images.sh
  - use function library

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
__SANITY=true
45
45
 
 
46
 
 
47
__SCRIPT_ROOT=$(dirname $(readlink -f $0))
 
48
source $__SCRIPT_ROOT/useful.inc.sh
 
49
 
46
50
function __usage () {
47
51
  
48
52
  echo "process_text_to_image.sh - Takes one text file and convernts it to a single"
95
99
  echo "---------------------"
96
100
}
97
101
 
98
 
function __silent () {
99
 
  $@ >> /dev/null 2>&1
100
 
  return $?
101
 
}
102
 
 
103
 
function __find_tool () {
104
 
  __silent which $1
105
 
 
106
 
  if [ $? -gt 0 ]; then
107
 
    echo "    Can't find tool \"${1}\"."
108
 
    ___SANITY=false
109
 
  fi
110
 
}
111
102
 
112
103
function __sanity_check () {
113
104
  # Check that we have the tools needed.
117
108
  __find_tool pdftoppm
118
109
  __find_tool pdfcrop
119
110
 
120
 
  if [[ $___SANITY == true ]]; then
 
111
  if [[ $__SANITY == false ]]; then
 
112
    echo ""
121
113
    echo "Please install the missing tools."
122
114
    echo ""
123
115
    exit 1