Debian Codegraph @

cmake/tribits/doc/publish_docs.sh

raw
1 #!/bin/bash
2
3 # This simple script copies selected TriBITS documents (built using the script
4 # 'build_docs.sh') so they can be viewed through a web browser. This is run
5 # as:
6 #
7 # <some-base-dir>/publish_docs.sh <destination-dir>
8 #
9 # (where <destination-dir> must be an absolute path). The script only needs
10 # to be given the (already existing) destination base directory as an
11 # argument. The script already knows the location of the TriBITS source
12 # directories if this is run out of the source tree.
13
14 #_SCRIPT_DIR=`echo $0 | sed "s/\(.*\)\/.*\.sh/\1/g"`
15 _ABS_FILE_PATH=`readlink -f $0`
16 #echo "_ABS_FILE_PATH = '$_ABS_FILE_PATH'"
17 _SCRIPT_DIR=`dirname $_ABS_FILE_PATH`
18 #echo "_SCRIPT_DIR = '$_SCRIPT_DIR'"
19
20 cd $_SCRIPT_DIR
21 echo "Copy from: $PWD"
22
23 function copy_over_readonly {
24 from_dir=$1
25 file=$2
26 to_dir=$3
27 if [ -e $to_dir/$file ] ; then
28 #echo "$to_dir/$file"
29 chmod u+w $to_dir/$file
30 fi
31 cp -u -v $from_dir/$file $to_dir/$file
32 file_lc=$(echo $file | tr '[:upper:]' '[:lower:]')
33 if [ -e $to_dir/$file_lc ] ; then
34 rm -f $to_dir/$file_lc
35 fi
36 cp -u -v $from_dir/$file $to_dir/$file_lc
37
38 }
39
40
41 function create_symlink {
42 file_from=$1
43 file_to=$2
44 if [ -e $file_to ] ; then
45 echo "rm -f $file_to"
46 rm -f $file_to
47 fi
48 echo "ln -s $file_from $file_to"
49 ln -s $file_from $file_to
50 }
51
52
53 function rm_if_exists {
54 file_to_rm=$1
55 if [ -e $file_to_rm ] ; then
56 echo "Removing old file $file_to_rm"
57 rm -f $file_to_rm
58 fi
59
60 }
61
62
63
64 _DEST_BASE_DIR=$1
65
66 echo "Copy to: $_DEST_BASE_DIR"
67 copy_over_readonly guides/users_guide TribitsUsersGuide.html $_DEST_BASE_DIR
68 copy_over_readonly guides/maintainers_guide TribitsMaintainersGuide.html $_DEST_BASE_DIR
69 copy_over_readonly build_ref TribitsBuildReference.html $_DEST_BASE_DIR
70 copy_over_readonly build_ref TribitsBuildReference.pdf $_DEST_BASE_DIR
71
72 echo "Create symlinks for old TribitsDevelopersGuide.html"
73 cd $_DEST_BASE_DIR
74 create_symlink TribitsUsersGuide.html TribitsDevelopersGuide.html
75 create_symlink TribitsUsersGuide.html tribitsdevelopersguide.html
76
77 echo "Removing old copies for PDf files for now"
78 rm_if_exists TribitsDevelopersGuide.pdf
79 rm_if_exists tribitsdevelopersguide.pdf