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 |
204 |
install -v -m 0755 -o root -g root ${file} ${BINDIR}/lib/udev/${udevhelper} || die |
install -v -m 0755 -o root -g root ${file} ${BINDIR}/lib/udev/${udevhelper} || die |
205 |
} |
} |
206 |
|
|
207 |
|
minstallhalinformation() |
208 |
|
{ |
209 |
|
local halrule |
210 |
|
local file |
211 |
|
|
212 |
|
[[ -z "$1" ]] && die "No hal rule given" |
213 |
|
|
214 |
|
# if no fullpath given use file from sourcedir |
215 |
|
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
216 |
|
then |
217 |
|
file="${SOURCEDIR}/$(mpname)/$1" |
218 |
|
else |
219 |
|
file="$1" |
220 |
|
fi |
221 |
|
|
222 |
|
if [[ -n "$2" ]] |
223 |
|
then |
224 |
|
halrule="$2" |
225 |
|
else |
226 |
|
halrule="$(basename ${file})" |
227 |
|
fi |
228 |
|
|
229 |
|
# needed directory |
230 |
|
install -d ${BINDIR}/usr/share/hal/fdi/information/20thirdparty || die |
231 |
|
|
232 |
|
# install our udev rule |
233 |
|
install -v -m 0644 -o root -g root ${file} ${BINDIR}/usr/share/hal/fdi/information/20thirdparty/${halrule} || die |
234 |
|
} |
235 |
|
|
236 |
|
minstallhalpolicy() |
237 |
|
{ |
238 |
|
local halrule |
239 |
|
local file |
240 |
|
|
241 |
|
[[ -z "$1" ]] && die "No hal rule given" |
242 |
|
|
243 |
|
# if no fullpath given use file from sourcedir |
244 |
|
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
245 |
|
then |
246 |
|
file="${SOURCEDIR}/$(mpname)/$1" |
247 |
|
else |
248 |
|
file="$1" |
249 |
|
fi |
250 |
|
|
251 |
|
if [[ -n "$2" ]] |
252 |
|
then |
253 |
|
halrule="$2" |
254 |
|
else |
255 |
|
halrule="$(basename ${file})" |
256 |
|
fi |
257 |
|
|
258 |
|
# needed directory |
259 |
|
install -d ${BINDIR}/usr/share/hal/fdi/policy/20thirdparty || die |
260 |
|
|
261 |
|
# install our udev rule |
262 |
|
install -v -m 0644 -o root -g root ${file} ${BINDIR}/usr/share/hal/fdi/policy/20thirdparty/${halrule} || die |
263 |
|
} |
264 |
|
|
265 |
|
minstallhalpreprobe() |
266 |
|
{ |
267 |
|
local halrule |
268 |
|
local file |
269 |
|
|
270 |
|
[[ -z "$1" ]] && die "No hal rule given" |
271 |
|
|
272 |
|
# if no fullpath given use file from sourcedir |
273 |
|
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
274 |
|
then |
275 |
|
file="${SOURCEDIR}/$(mpname)/$1" |
276 |
|
else |
277 |
|
file="$1" |
278 |
|
fi |
279 |
|
|
280 |
|
if [[ -n "$2" ]] |
281 |
|
then |
282 |
|
halrule="$2" |
283 |
|
else |
284 |
|
halrule="$(basename ${file})" |
285 |
|
fi |
286 |
|
|
287 |
|
# needed directory |
288 |
|
install -d ${BINDIR}/usr/share/hal/fdi/preprobe/10osvendor || die |
289 |
|
|
290 |
|
# install our udev rule |
291 |
|
install -v -m 0644 -o root -g root ${file} ${BINDIR}/usr/share/hal/fdi/preprobe/10osvendor/${halrule} || die |
292 |
|
} |
293 |
|
|
294 |
# install man files to appropiate dirs |
# install man files to appropiate dirs |
295 |
# minstallman /path/to/manfile.foo |
# minstallman /path/to/manfile.foo |
296 |
minstallman() |
minstallman() |
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 |
590 |
|
|
591 |
if [[ $1 = -s ]] |
if [[ $1 = -s ]] |
592 |
then |
then |
593 |
file="${SOURCEDIR}/${PNAME}/$2" |
file="${SOURCEDIR}/$(mpname)/$2" |
594 |
dest="$3" |
dest="$3" |
595 |
if [[ -z $3 ]] |
if [[ -z $3 ]] |
596 |
then |
then |
623 |
fi |
fi |
624 |
} |
} |
625 |
|
|
626 |
# mark directoris undeletable |
mcopy() |
627 |
|
{ |
628 |
|
local source="$1" |
629 |
|
local dest="$2" |
630 |
|
local opts |
631 |
|
|
632 |
|
# recursive |
633 |
|
if [[ $1 = -r ]] || [[ $1 = -R ]] |
634 |
|
then |
635 |
|
opts="--recursive" |
636 |
|
source="$2" |
637 |
|
dest="$3" |
638 |
|
fi |
639 |
|
|
640 |
|
# recursive |
641 |
|
if [[ $1 = -rf ]] || [[ $1 = -fr ]] || [[ $1 = -Rf ]] || [[ $1 = -fR ]] |
642 |
|
then |
643 |
|
opts="--recursive --force" |
644 |
|
source="$2" |
645 |
|
dest="$3" |
646 |
|
fi |
647 |
|
|
648 |
|
[[ -z ${source} ]] && die "No source given." |
649 |
|
[[ -z ${dest} ]] && die "No dest given." |
650 |
|
|
651 |
|
cp -v ${opts} ${source} ${BINDIR}/${dest} || die |
652 |
|
} |
653 |
|
|
654 |
|
mmove() |
655 |
|
{ |
656 |
|
local source="$1" |
657 |
|
local dest="$2" |
658 |
|
local opts |
659 |
|
|
660 |
|
# force |
661 |
|
if [[ $1 = -f ]] |
662 |
|
then |
663 |
|
opts="--force" |
664 |
|
source="$2" |
665 |
|
dest="$3" |
666 |
|
fi |
667 |
|
|
668 |
|
[[ -z ${source} ]] && die "No source given." |
669 |
|
[[ -z ${dest} ]] && die "No dest given." |
670 |
|
|
671 |
|
mv -v ${opts} ${source} ${BINDIR}/${dest} || die |
672 |
|
} |
673 |
|
|
674 |
|
# mark directories undeletable |
675 |
mkeepdir() |
mkeepdir() |
676 |
{ |
{ |
677 |
local keepdir |
local keepdir |