Changeset 440 for CMT/HEAD/mgr
- Timestamp:
- Feb 11, 2008, 2:23:17 PM (16 years ago)
- Location:
- CMT/HEAD/mgr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/mgr/cmt_install_action.sh
r28 r440 1 1 #!/bin/sh -f 2 2 3 ###set -x4 5 3 #------------------------------------------------------------------------------ 4 # Arguments: 6 5 # 7 6 # -source=1 absolute source directory … … 11 10 # -cmtpath=5 cmtpath of the package 12 11 # 12 # OR 13 # 14 # -source 1 absolute source directory 15 # -name 2 file name 16 # -out 3 absolute installation directory 17 # -cmd 4 installation system command 18 # -cmtpath 5 cmtpath of the package 19 # 20 # OR 21 # 22 # 1 absolute source directory 23 # 2 file name 24 # 3 absolute installation directory 25 # 4 installation system command 26 # 5 cmtpath of the package 13 27 #------------------------------------------------------------------------------ 14 28 … … 26 40 opt="-source" 27 41 28 while test "$#"-gt 0; do42 while test $# -gt 0; do 29 43 arg=$1 30 44 shift … … 33 47 34 48 case ${arg} in 35 -*) 36 if echo $arg | grep '=' 2>&1 >/dev/null; then 37 opt=`echo ${arg} | sed -e 's#=.*##'` 38 val=`echo ${arg} | sed -e 's#[^=]*=##'` 39 else 40 opt=${arg} 41 val= 42 if test "$#" -gt 0; then 43 val=$1 44 shift 45 fi 46 fi 47 ;; 49 -?*=*) 50 opt=${arg%%"="*} 51 val=${arg#"${opt}="} 52 ;; 53 -?*) 54 opt=${arg} 55 val= 56 if test $# -gt 0; then 57 val=$1 58 shift 59 fi 60 ;; 48 61 esac 49 62 … … 100 113 fi 101 114 102 if test "${cmtpath}" = ""; then115 if test ! -d "${cmtpath}"; then 103 116 echo "cmt_install_action.sh> no cmtpath" 104 117 exit 1 … … 110 123 full_source_name=${source_dir}/${file_name} 111 124 112 if test "${cmtpath}" = "" ; then 113 echo "No installation directory specified" 114 exit 0 115 fi 116 117 b=`(cd ${cmtpath}; /bin/pwd)` 118 a=`/bin/pwd | grep -e "${b}"` 119 if test "${a}" = ""; then 120 echo "Current directory outside of the installation area. Cannot proceed" 121 exit 0 122 fi 123 124 if test "${install_dir}" = "" ; then 125 exit 0 126 fi 125 case `pwd -P` in 126 `(cd ${cmtpath}; pwd -P)`*) : ;; 127 *) echo "Current directory outside of the installation area. Cannot proceed"; 128 exit 0 ;; 129 esac 127 130 128 131 if test ! -d ${install_dir}; then 129 mkdir -p ${install_dir} 130 fi 131 132 if test ! -d ${install_dir}; then 133 echo "Cannot install file ${file_name}, no installation directory specified" 134 exit 0 132 mkdir -p ${install_dir} || 133 { echo "Cannot install file ${file_name} into installation directory ${install_dir}"; exit 0; } 135 134 fi 136 135 137 136 echo "Installing file ${file_name} into ${install_dir}" 138 if test -L ${dest_file_path}; then 139 /bin/rm -f ${dest_file_path} 140 elif test -f ${dest_file_path}; then 141 /bin/rm -f ${dest_file_path} 137 if test -L ${dest_file_path} -o -f ${dest_file_path}; then 138 /bin/rm -f ${dest_file_path} 142 139 fi 143 140 … … 146 143 fi 147 144 148 ${install_command} ${full_source_name} ${dest_file_path}145 eval ${install_command} ${full_source_name} ${dest_file_path} 149 146 echo ${full_source_name} >${ref_file} -
CMT/HEAD/mgr/cmt_uninstall_action.sh
r28 r440 1 1 #!/bin/sh -f 2 2 3 ###set -x4 5 3 #------------------------------------------------------------------------------ 4 # Arguments: 6 5 # 7 6 # -source=1 absolute source directory … … 10 9 # -cmtpath=4 cmtpath of the package 11 10 # 11 # OR 12 # 13 # -source 1 absolute source directory 14 # -name 2 file name 15 # -out 3 absolute installation directory 16 # -cmtpath 4 cmtpath of the package 17 # 18 # OR 19 # 20 # 1 absolute source directory 21 # 2 file name 22 # 3 absolute installation directory 23 # 4 cmtpath of the package 12 24 #------------------------------------------------------------------------------ 13 25 … … 15 27 file_name="" 16 28 install_dir="" 17 install_command=""18 29 cmtpath="" 19 30 … … 25 36 opt="-source" 26 37 27 while test "$#"-gt 0; do38 while test $# -gt 0; do 28 39 arg=$1 29 40 shift … … 32 43 33 44 case ${arg} in 34 -*) 35 if echo $arg | grep '=' 2>&1 >/dev/null; then 36 opt=`echo ${arg} | sed -e 's#=.*##'` 37 val=`echo ${arg} | sed -e 's#[^=]*=##'` 38 else 39 opt=${arg} 40 val= 41 if test "$#" -gt 0; then 42 val=$1 43 shift 44 fi 45 fi 46 ;; 45 -?*=*) 46 opt=${arg%%"="*} 47 val=${arg#"${opt}="} 48 ;; 49 -?*) 50 opt=${arg} 51 val= 52 if test $# -gt 0; then 53 val=$1 54 shift 55 fi 56 ;; 47 57 esac 48 58 … … 58 68 -out) 59 69 install_dir=${val}; 60 opt="-cmd";61 ;;62 -cmd)63 install_command=${val};64 70 opt="-cmtpath"; 65 71 ;; … … 94 100 fi 95 101 96 if test "${cmtpath}" = ""; then102 if test ! -d "${cmtpath}"; then 97 103 echo "cmt_uninstall_action.sh> no cmtpath" 98 104 exit 1 … … 104 110 full_source_name=${source_dir}/${file_name} 105 111 106 b=`(cd ${cmtpath}; /bin/pwd)` 107 a=`/bin/pwd | grep -e "${b}"` 108 if test "${a}" = ""; then 109 echo "Current directory outside of the installation area. Cannot proceed" 110 exit 0 111 fi 112 113 if test "${install_dir}" = "" ; then 114 exit 0 115 fi 112 case `pwd -P` in 113 `(cd ${cmtpath}; pwd -P)`*) : ;; 114 *) echo "Current directory outside of the installation area. Cannot proceed"; 115 exit 0 ;; 116 esac 116 117 117 118 if test ! -d ${install_dir}; then 118 echo "Cannot uninstall file ${file_name} , no installation directory specified"119 echo "Cannot uninstall file ${file_name} from installation directory ${install_dir}" 119 120 exit 0 120 121 fi … … 131 132 /bin/rm -f ${ref_file} 132 133 fi 133
Note: See TracChangeset
for help on using the changeset viewer.