5 |
# this will provide the service management functions |
# this will provide the service management functions |
6 |
INHERITS="${INHERITS} mtools" |
INHERITS="${INHERITS} mtools" |
7 |
|
|
8 |
|
# get the pname right with splitpackages |
9 |
|
mpname() |
10 |
|
{ |
11 |
|
local pname="${PNAME}" |
12 |
|
[[ ! -z ${SPLIT_PACKAGE_BASE} ]] && pname ="${SPLIT_PACKAGE_BASE}" |
13 |
|
|
14 |
|
echo "${pname}" |
15 |
|
} |
16 |
|
|
17 |
# installs initscripts |
# installs initscripts |
18 |
# minstallrc /path/to/rc-script {destfilename} |
# minstallrc /path/to/rc-script {destfilename} |
19 |
minstallrc() |
minstallrc() |
26 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
27 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
28 |
then |
then |
29 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
30 |
else |
else |
31 |
file="$1" |
file="$1" |
32 |
fi |
fi |
57 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
58 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
59 |
then |
then |
60 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
61 |
else |
else |
62 |
file="$1" |
file="$1" |
63 |
fi |
fi |
88 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
89 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
90 |
then |
then |
91 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
92 |
else |
else |
93 |
file="$1" |
file="$1" |
94 |
fi |
fi |
120 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
121 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
122 |
then |
then |
123 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
124 |
else |
else |
125 |
file="$1" |
file="$1" |
126 |
fi |
fi |
156 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
157 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
158 |
then |
then |
159 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
160 |
else |
else |
161 |
file="$1" |
file="$1" |
162 |
fi |
fi |
185 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
186 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
187 |
then |
then |
188 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
189 |
else |
else |
190 |
file="$1" |
file="$1" |
191 |
fi |
fi |
214 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
215 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
216 |
then |
then |
217 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
218 |
else |
else |
219 |
file="$1" |
file="$1" |
220 |
fi |
fi |
243 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
244 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
245 |
then |
then |
246 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
247 |
else |
else |
248 |
file="$1" |
file="$1" |
249 |
fi |
fi |
272 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
273 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
274 |
then |
then |
275 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
276 |
else |
else |
277 |
file="$1" |
file="$1" |
278 |
fi |
fi |
374 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
375 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
376 |
then |
then |
377 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
378 |
else |
else |
379 |
file="$1" |
file="$1" |
380 |
fi |
fi |
412 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
413 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
414 |
then |
then |
415 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
416 |
else |
else |
417 |
file="$1" |
file="$1" |
418 |
fi |
fi |
447 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
448 |
if [[ -z $(dirname $2) ]] || [[ $(dirname $2) = . ]] |
if [[ -z $(dirname $2) ]] || [[ $(dirname $2) = . ]] |
449 |
then |
then |
450 |
file="${SOURCEDIR}/${PNAME}/$2" |
file="${SOURCEDIR}/$(mpname)/$2" |
451 |
else |
else |
452 |
file="$2" |
file="$2" |
453 |
fi |
fi |
479 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
480 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
481 |
then |
then |
482 |
file="${SOURCEDIR}/${PNAME}/$1" |
file="${SOURCEDIR}/$(mpname)/$1" |
483 |
else |
else |
484 |
file="$1" |
file="$1" |
485 |
fi |
fi |
526 |
|
|
527 |
if [[ $1 = -s ]] |
if [[ $1 = -s ]] |
528 |
then |
then |
529 |
file="${SOURCEDIR}/${PNAME}/$2" |
file="${SOURCEDIR}/$(mpname)/$2" |
530 |
dest="$3" |
dest="$3" |
531 |
if [[ -z $3 ]] |
if [[ -z $3 ]] |
532 |
then |
then |
558 |
|
|
559 |
if [[ $1 = -s ]] |
if [[ $1 = -s ]] |
560 |
then |
then |
561 |
file="${SOURCEDIR}/${PNAME}/$2" |
file="${SOURCEDIR}/$(mpname)/$2" |
562 |
dest="$3" |
dest="$3" |
563 |
if [[ -z $3 ]] |
if [[ -z $3 ]] |
564 |
then |
then |
585 |
{ |
{ |
586 |
local file |
local file |
587 |
local dest |
local dest |
588 |
|
local verbose="-v" |
589 |
|
|
590 |
|
# check for busybox as it doesn'tz support 'ln -v' |
591 |
|
[[ $(readlink $(which ln)) = */busybox ]] && verbose="" |
592 |
|
|
593 |
[[ -z $1 ]] && die "No file given" |
[[ -z $1 ]] && die "No file given" |
594 |
|
|
595 |
if [[ $1 = -s ]] |
if [[ $1 = -s ]] |
596 |
then |
then |
597 |
file="${SOURCEDIR}/${PNAME}/$2" |
file="${SOURCEDIR}/$(mpname)/$2" |
598 |
dest="$3" |
dest="$3" |
599 |
if [[ -z $3 ]] |
if [[ -z $3 ]] |
600 |
then |
then |
618 |
# 1. - library.so.1.0.0 -> library.so.1.0 |
# 1. - library.so.1.0.0 -> library.so.1.0 |
619 |
if [ "${file%.*}" != *.so ] |
if [ "${file%.*}" != *.so ] |
620 |
then |
then |
621 |
ln -v -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*}) |
ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*}) |
622 |
fi |
fi |
623 |
# 2. - library.so.1.0.0 -> library.so.1 |
# 2. - library.so.1.0.0 -> library.so.1 |
624 |
if [ "${file%.*.*}" != *.so ] |
if [ "${file%.*.*}" != *.so ] |
625 |
then |
then |
626 |
ln -v -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*.*}) |
ln ${verbose} -snf $(basename ${file}) ${BINDIR}/${dest}/$(basename ${file%.*.*}) |
627 |
fi |
fi |
628 |
} |
} |
629 |
|
|
664 |
# force |
# force |
665 |
if [[ $1 = -f ]] |
if [[ $1 = -f ]] |
666 |
then |
then |
667 |
opts="--recursive" |
opts="--force" |
668 |
source="$2" |
source="$2" |
669 |
dest="$3" |
dest="$3" |
670 |
fi |
fi |
745 |
{ |
{ |
746 |
local symlink="$1" |
local symlink="$1" |
747 |
local pathto="$2" |
local pathto="$2" |
748 |
|
local verbose="-v" |
749 |
|
|
750 |
|
# check for busybox as it doesn'tz support 'ln -v' |
751 |
|
[[ $(readlink $(which ln)) = */busybox ]] && verbose="" |
752 |
|
|
753 |
[[ -z ${symlink} ]] && die "No symlink given." |
[[ -z ${symlink} ]] && die "No symlink given." |
754 |
[[ -z ${pathto} ]] && die "No path given." |
[[ -z ${pathto} ]] && die "No path given." |
755 |
|
|
756 |
ln -v -snf ${symlink} ${BINDIR}/${pathto} || die |
ln ${verbose} -snf ${symlink} ${BINDIR}/${pathto} || die |
757 |
} |
} |