2 # Package: RN Makefile System Utility
4 # Desc: Install files for source directory to destination directory
5 # Usage: doinstall.sh [-s] mode source_dir dest_dir
8 # /*! \cond RNMAKE_DOXY*/
16 # Positional arguments
22 # Get options. Note: first colon says that getopts will not print errors.
24 while getopts :${optstr} opt
29 *) echo "rnmake: $0: error: Unknown opt: $opt"; exit 2;;
33 shift $(($OPTIND - 1))
41 echo "rnmake: $0: error: No file creation mode specified."
47 echo "rnmake: $0: error: No source directory specified."
53 echo "rnmake: $0: error: No destination install directory specified."
57 install -d -p -m 775 ${dstdir}
59 cd ${srcdir} >/dev/null
64 find . -type f -o -type l | \
70 # destination [sub]directory name
71 dname=${dstdir}/$(dirname ${src})
72 # create directory if it does not exist
75 install -d -p -m 775 ${dname}
77 # destination file name
78 dst="${dstdir}/${src}"
83 # 'install' symlink file
86 lnk=$(readlink ${srcpath})
87 cd ${dname} >/dev/null
88 fname=$(basename ${srcpath})
94 # install regular file with given permissions
96 install -p -m ${mode} ${srcpath} ${dst}
100 #/*! \endcond RNMAKE_DOXY */