-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdist
36 lines (27 loc) · 919 Bytes
/
dist
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
#!/bin/bash
# $RCSfile: dist,v $ $Date: 2022/01/19 07:49:40 $ $Revision: 2.7 $
# $Destination: /usr/bin/dist $
# purpose: use distribute method to copy/install files
# the filename is required as first command-line argument
dist_file=$1
if [ -z "$dist_file" ] ; then
echo "distribute which file?"
else
if [ -f "$dist_file" ] ; then
# search for the CVS tag
destination=$(grep \$Destination ${dist_file} | head -1 | grep -v distribute | awk '{ print $3 }')
if [ -z $destination ] ; then
echo "\$Destination$ tag not found in file"
exit 2
else
#echo "\$Destination\$ is: $destination"
# copy the file to the correct destination
cp --force ${dist_file} ${destination}
# use the exit code from 'cp' command as exit code for this script
exit $?
fi
else
echo "file '$dist_file' not found"
exit 1
fi
fi