File: posti

package info (click to toggle)
espa-nol 1.11-9
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,120 kB
  • ctags: 28
  • sloc: makefile: 134; sh: 73; sed: 30; csh: 6; lisp: 3
file content (71 lines) | stat: -rwxr-xr-x 1,089 bytes parent folder | download | duplicates (11)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh

ECHO=/bin/echo
SUF_HASH=".hash"
SUF_AFF=".aff"
HASH_FILE=$1$SUF_HASH
AFF_FILE=$1$SUF_AFF

if [ $# != 1 ]
then
	$ECHO "Usage: posti file"
	exit 1
fi

if [ ! -f $HASH_FILE ]
then
	$ECHO "$1 does not exists"
	exit 1
fi

ispell -vv > /tmp/is$$ 2>&1

dir=`grep '^[ 	]*LIBDIR' /tmp/is$$ | awk '{print $3}' | sed -e 's/\"//g'`

rm -f /tmp/is$$

if [ ! -d $dir ]
then
	$ECHO "$dir is not a directory"
fi

$ECHO "$1 will be installed in $dir."
$ECHO "Please confirm (y/n) \c"
read aux

if [ "Y$aux" != "YY" -a "Y$aux" != "Yy" ]; then
	$ECHO "Installation cancelled"
	exit 1
fi

if [ -f $dir/$HASH_FILE ]
then
	mv $dir/$HASH_FILE $dir/${HASH_FILE}_OLD
	$ECHO "Old $HASH_FILE file saved as $dir/${HASH_FILE}_OLD"
fi

if [ -f $dir/$AFF_FILE ]
then
	mv $dir/$AFF_FILE $dir/${AFF_FILE}_OLD
	$ECHO "Old $AFF_FILE file saved as $dir/${AFF_FILE}_OLD"
fi

cp $HASH_FILE $AFF_FILE $dir

if [ $? != 0 ]
then
	$ECHO "$1 is not installed"
	exit 1
fi

chmod 444 $dir/$AFF_FILE $dir/$HASH_FILE

if [ $? != 0 ]
then
	$ECHO "$1 is not installed"
	rm -f $dir/$AFF_FILE $dir/$HASH_FILE
	exit 1
fi


exit 0