9 |
mpname() |
mpname() |
10 |
{ |
{ |
11 |
local pname="${PNAME}" |
local pname="${PNAME}" |
12 |
[[ ! -z ${SPLIT_PACKAGE_BASE} ]] && pname ="${SPLIT_PACKAGE_BASE}" |
[[ ! -z ${SPLIT_PACKAGE_BASE} ]] && pname="${SPLIT_PACKAGE_BASE}" |
13 |
|
|
14 |
echo "${pname}" |
echo "${pname}" |
15 |
} |
} |
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 |
|
|
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 |
|
} |
758 |
|
|
759 |
|
# installs systemd units |
760 |
|
# minstallunit /path/to/unit-file {destfilename} |
761 |
|
minstallunit() |
762 |
|
{ |
763 |
|
local unit |
764 |
|
local file |
765 |
|
|
766 |
|
[[ -z "$1" ]] && die "No unit given" |
767 |
|
|
768 |
|
# if no fullpath given use file from sourcedir |
769 |
|
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
770 |
|
then |
771 |
|
file="${SOURCEDIR}/$(mpname)/$1" |
772 |
|
else |
773 |
|
file="$1" |
774 |
|
fi |
775 |
|
|
776 |
|
if [[ -n "$2" ]] |
777 |
|
then |
778 |
|
unit="$2" |
779 |
|
else |
780 |
|
unit="$(basename ${file})" |
781 |
|
fi |
782 |
|
|
783 |
|
# needed directory |
784 |
|
install -d ${BINDIR}/lib/systemd/system || die |
785 |
|
|
786 |
|
# install our initscript |
787 |
|
install -v -m 0644 -o root -g root ${file} ${BINDIR}/lib/systemd/system/${unit} || die |
788 |
|
} |
789 |
|
|
790 |
|
# installs systemd tmp configs to /etc/tmpfiles.d |
791 |
|
# minstalltmp /path/to/tmpdfile {destfilename} |
792 |
|
minstalltmp() |
793 |
|
{ |
794 |
|
local tmpdfile |
795 |
|
local file |
796 |
|
|
797 |
|
[[ -z "$1" ]] && die "No tmpd file given" |
798 |
|
|
799 |
|
# if no fullpath given use file from sourcedir |
800 |
|
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
801 |
|
then |
802 |
|
file="${SOURCEDIR}/$(mpname)/$1" |
803 |
|
else |
804 |
|
file="$1" |
805 |
|
fi |
806 |
|
|
807 |
|
if [[ -n "$2" ]] |
808 |
|
then |
809 |
|
tmpdfile="$2" |
810 |
|
else |
811 |
|
tmpdfile="$(basename ${file})" |
812 |
|
fi |
813 |
|
|
814 |
|
# needed directory |
815 |
|
install -d ${BINDIR}/etc/tmpfiles.d || die |
816 |
|
|
817 |
|
# install our tmpdfile |
818 |
|
install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/tmpfiles.d/${tmpdfile} || die |
819 |
} |
} |