Magellan Linux

Diff of /branches/R11-stable/include/mtools.sminc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 19668 by niro, Wed Oct 9 13:09:29 2013 UTC revision 19670 by niro, Wed Oct 9 13:16:15 2013 UTC
# Line 10  mpname() Line 10  mpname()
10   echo "${pname}"   echo "${pname}"
11  }  }
12    
13    # installs given directories
14    # minstalldir /path/to/dest/dir {/path/to/dest/dirN}
15    minstalldir()
16    {
17     local argv="$@"
18     local dest
19    
20     [[ -z ${argv} ]] && die "No dest dir given"
21     for dest in ${argv}
22     do
23     [[ -d ${BINDIR}${dest} ]] && continue
24     install -v -d ${BINDIR}/${dest} || die
25     done
26    }
27    
28    # install files to given path (defaults to /usr/bin)
29    # minstallfile {-s} /path/to/file {/path/to/dest}
30    minstallfile()
31    {
32     local file
33     local dest
34    
35     [[ -z $1 ]] && die "No etc file given"
36    
37     if [[ $1 = -s ]]
38     then
39     file="${SOURCEDIR}/$(mpname)/$2"
40     dest="$3"
41     if [[ -z $3 ]]
42     then
43     dest=/usr/bin
44     install -d ${BINDIR}/${dest} || die
45     fi
46     else
47     file="$1"
48     dest="$2"
49     if [[ -z $2 ]]
50     then
51     dest=/usr/bin
52     install -d ${BINDIR}/${dest} || die
53     fi
54     fi
55    
56     # install our configfile
57     install -v -m 0644 -o root -g root ${file} ${BINDIR}/${dest} || die
58    }
59    
60    # installs executables to given path
61    # minstallexec {-s} /path/to/exec {/path/to/dest}
62    minstallexec()
63    {
64     local file
65     local dest
66    
67     [[ -z $1 ]] && die "No file given"
68    
69     if [[ $1 = -s ]]
70     then
71     file="${SOURCEDIR}/$(mpname)/$2"
72     dest="$3"
73     if [[ -z $3 ]]
74     then
75     dest=/usr/bin
76     install -d ${BINDIR}/${dest} || die
77     fi
78     else
79     file="$1"
80     dest="$2"
81     if [[ -z $2 ]]
82     then
83     dest=/usr/bin
84     install -d ${BINDIR}/${dest} || die
85     fi
86     fi
87    
88     # install our configfile
89     install -v -m 0755 -o root -g root ${file} ${BINDIR}/${dest} || die
90    }
91    
92    # installs executables to given path
93    # minstalllib {-s} /path/to/exec {/path/to/dest}
94    minstalllib()
95    {
96     local file
97     local dest
98     local verbose="-v"
99    
100     # check for busybox as it doesn't support 'ln -v'
101     [[ $(readlink $(which ln)) = */busybox ]] && verbose=""
102    
103     [[ -z $1 ]] && die "No file given"
104    
105     if [[ $1 = -s ]]
106     then
107     file="${SOURCEDIR}/$(mpname)/$2"
108     dest="$3"
109     if [[ -z $3 ]]
110     then
111     dest=/usr/$(mlibdir)
112     install -d ${BINDIR}/${dest} || die
113     fi
114     else
115     file="$1"
116     dest="$2"
117     if [[ -z $2 ]]
118     then
119     dest=/usr/$(mlibdir)
120     install -d ${BINDIR}/${dest} || die
121     fi
122     fi
123    
124     # install our library
125     install -v -m 0755 -o root -g root ${file} ${BINDIR}/${dest} || die
126    
127     # prefer scanelf
128     if [[ -x $(type -P scanelf) ]]
129     then
130     local soname="$(scanelf -qBF '%S#p' ${file})"
131     ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/${soname} || die
132     else
133     echo -e "${COLYELLOW}minstalllib(): Warning: scanelf not found, using fallback symlink method${COLDEFAULT}"
134    
135     # create libtool symlinks
136     # 1. - library.so.1.0.0 -> library.so.1.0
137     if [ "${file%.*}" != *.so ]
138     then
139     ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*}) || die
140     fi
141     # 2. - library.so.1.0.0 -> library.so.1
142     if [ "${file%.*.*}" != *.so ]
143     then
144     ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*.*}) || die
145     fi
146     # 3. - library.so.1.0.0.0 -> library.so.1
147     if [ "${file%.*.*.*}" != *.so ]
148     then
149     ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*.*.*}) || die
150     fi
151     fi
152    }
153    
154  # installs environment files  # installs environment files
155  # minstallenv /path/to/envdfile {destfilename}  # minstallenv /path/to/envdfile {destfilename}
156  minstallenv()  minstallenv()
# Line 318  minstalllog() Line 459  minstalllog()
459   install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/logrotate.d/${logfile} || die   install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/logrotate.d/${logfile} || die
460  }  }
461    
   
 # installs given directories  
 # minstalldir /path/to/dest/dir {/path/to/dest/dirN}  
 minstalldir()  
 {  
  local argv="$@"  
  local dest  
   
  [[ -z ${argv} ]] && die "No dest dir given"  
  for dest in ${argv}  
  do  
  [[ -d ${BINDIR}${dest} ]] && continue  
  install -v -d ${BINDIR}/${dest} || die  
  done  
 }  
   
   
 # install files to given path (defaults to /usr/bin)  
 # minstallfile {-s} /path/to/file {/path/to/dest}  
 minstallfile()  
 {  
  local file  
  local dest  
   
  [[ -z $1 ]] && die "No etc file given"  
   
  if [[ $1 = -s ]]  
  then  
  file="${SOURCEDIR}/$(mpname)/$2"  
  dest="$3"  
  if [[ -z $3 ]]  
  then  
  dest=/usr/bin  
  install -d ${BINDIR}/${dest} || die  
  fi  
  else  
  file="$1"  
  dest="$2"  
  if [[ -z $2 ]]  
  then  
  dest=/usr/bin  
  install -d ${BINDIR}/${dest} || die  
  fi  
  fi  
   
  # install our configfile  
  install -v -m 0644 -o root -g root ${file} ${BINDIR}/${dest} || die  
 }  
   
 # installs executables to given path  
 # minstallexec {-s} /path/to/exec {/path/to/dest}  
 minstallexec()  
 {  
  local file  
  local dest  
   
  [[ -z $1 ]] && die "No file given"  
   
  if [[ $1 = -s ]]  
  then  
  file="${SOURCEDIR}/$(mpname)/$2"  
  dest="$3"  
  if [[ -z $3 ]]  
  then  
  dest=/usr/bin  
  install -d ${BINDIR}/${dest} || die  
  fi  
  else  
  file="$1"  
  dest="$2"  
  if [[ -z $2 ]]  
  then  
  dest=/usr/bin  
  install -d ${BINDIR}/${dest} || die  
  fi  
  fi  
   
  # install our configfile  
  install -v -m 0755 -o root -g root ${file} ${BINDIR}/${dest} || die  
 }  
   
 # installs executables to given path  
 # minstalllib {-s} /path/to/exec {/path/to/dest}  
 minstalllib()  
 {  
  local file  
  local dest  
  local verbose="-v"  
   
  # check for busybox as it doesn't support 'ln -v'  
  [[ $(readlink $(which ln)) = */busybox ]] && verbose=""  
   
  [[ -z $1 ]] && die "No file given"  
   
  if [[ $1 = -s ]]  
  then  
  file="${SOURCEDIR}/$(mpname)/$2"  
  dest="$3"  
  if [[ -z $3 ]]  
  then  
  dest=/usr/$(mlibdir)  
  install -d ${BINDIR}/${dest} || die  
  fi  
  else  
  file="$1"  
  dest="$2"  
  if [[ -z $2 ]]  
  then  
  dest=/usr/$(mlibdir)  
  install -d ${BINDIR}/${dest} || die  
  fi  
  fi  
   
  # install our library  
  install -v -m 0755 -o root -g root ${file} ${BINDIR}/${dest} || die  
   
  # prefer scanelf  
  if [[ -x $(type -P scanelf) ]]  
  then  
  local soname="$(scanelf -qBF '%S#p' ${file})"  
  ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/${soname} || die  
  else  
  echo -e "${COLYELLOW}minstalllib(): Warning: scanelf not found, using fallback symlink method${COLDEFAULT}"  
   
  # create libtool symlinks  
  # 1. - library.so.1.0.0 -> library.so.1.0  
  if [ "${file%.*}" != *.so ]  
  then  
  ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*}) || die  
  fi  
  # 2. - library.so.1.0.0 -> library.so.1  
  if [ "${file%.*.*}" != *.so ]  
  then  
  ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*.*}) || die  
  fi  
  # 3. - library.so.1.0.0.0 -> library.so.1  
  if [ "${file%.*.*.*}" != *.so ]  
  then  
  ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*.*.*}) || die  
  fi  
  fi  
 }  
   
462  mcopy()  mcopy()
463  {  {
464   local source="$1"   local source="$1"

Legend:
Removed from v.19668  
changed lines
  Added in v.19670