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 |
} |
} |
169 |
fi |
fi |
170 |
|
|
171 |
# needed directory |
# needed directory |
172 |
install -d ${BINDIR}/etc/udev/rules.d || die |
install -d ${BINDIR}/lib/udev/rules.d || die |
173 |
|
|
174 |
# install our udev rule |
# install our udev rule |
175 |
install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/udev/rules.d/${udevrule} || die |
install -v -m 0644 -o root -g root ${file} ${BINDIR}/lib/udev/rules.d/${udevrule} || die |
176 |
} |
} |
177 |
|
|
178 |
minstalludevhelper() |
minstalludevhelper() |
468 |
|
|
469 |
|
|
470 |
# installs logrotate configuration files |
# installs logrotate configuration files |
471 |
# minstallpam /path/to/logrotatefile {destfilename} |
# minstalllog /path/to/logrotatefile {destfilename} |
472 |
minstalllog() |
minstalllog() |
473 |
{ |
{ |
474 |
local logfile |
local logfile |
636 |
# recursive |
# recursive |
637 |
if [[ $1 = -r ]] || [[ $1 = -R ]] |
if [[ $1 = -r ]] || [[ $1 = -R ]] |
638 |
then |
then |
639 |
opts="--recursive" |
opts="-R" |
640 |
source="$2" |
source="$2" |
641 |
dest="$3" |
dest="$3" |
642 |
fi |
fi |
644 |
# recursive |
# recursive |
645 |
if [[ $1 = -rf ]] || [[ $1 = -fr ]] || [[ $1 = -Rf ]] || [[ $1 = -fR ]] |
if [[ $1 = -rf ]] || [[ $1 = -fr ]] || [[ $1 = -Rf ]] || [[ $1 = -fR ]] |
646 |
then |
then |
647 |
opts="--recursive --force" |
opts="-R -f" |
648 |
|
source="$2" |
649 |
|
dest="$3" |
650 |
|
fi |
651 |
|
|
652 |
|
if [[ $1 = -a ]] |
653 |
|
then |
654 |
|
opts="-a" |
655 |
source="$2" |
source="$2" |
656 |
dest="$3" |
dest="$3" |
657 |
fi |
fi |
662 |
cp -v ${opts} ${source} ${BINDIR}/${dest} || die |
cp -v ${opts} ${source} ${BINDIR}/${dest} || die |
663 |
} |
} |
664 |
|
|
665 |
|
mdelete() |
666 |
|
{ |
667 |
|
local dest="$1" |
668 |
|
local opts |
669 |
|
|
670 |
|
# recursive |
671 |
|
if [[ $1 = -r ]] || [[ $1 = -R ]] |
672 |
|
then |
673 |
|
opts="-r" |
674 |
|
dest="$2" |
675 |
|
fi |
676 |
|
|
677 |
|
# recursive |
678 |
|
if [[ $1 = -rf ]] || [[ $1 = -fr ]] || [[ $1 = -Rf ]] || [[ $1 = -fR ]] |
679 |
|
then |
680 |
|
opts="-r -f" |
681 |
|
dest="$2" |
682 |
|
fi |
683 |
|
|
684 |
|
[[ -z ${dest} ]] && die "No dest given." |
685 |
|
[[ ! -e ${BINDIR}/${dest} ]] && die "${BINDIR}/${dest} does not exist." |
686 |
|
|
687 |
|
rm -v ${opts} ${BINDIR}/${dest} || die |
688 |
|
} |
689 |
|
|
690 |
mmove() |
mmove() |
691 |
{ |
{ |
692 |
local source="$1" |
local source="$1" |
696 |
# force |
# force |
697 |
if [[ $1 = -f ]] |
if [[ $1 = -f ]] |
698 |
then |
then |
699 |
opts="--force" |
opts="-f" |
700 |
source="$2" |
source="$2" |
701 |
dest="$3" |
dest="$3" |
702 |
fi |
fi |
742 |
# recursive |
# recursive |
743 |
if [[ $1 = -r ]] || [[ $1 = -R ]] |
if [[ $1 = -r ]] || [[ $1 = -R ]] |
744 |
then |
then |
745 |
local recursive="--recursive" |
local recursive="-R" |
746 |
local owner="$2" |
local owner="$2" |
747 |
local path="$3" |
local path="$3" |
748 |
fi |
fi |
762 |
# recursive |
# recursive |
763 |
if [[ $1 = -r ]] || [[ $1 = -R ]] |
if [[ $1 = -r ]] || [[ $1 = -R ]] |
764 |
then |
then |
765 |
local recursive="--recursive" |
local recursive="-R" |
766 |
local posix="$2" |
local posix="$2" |
767 |
local path="$3" |
local path="$3" |
768 |
fi |
fi |
787 |
|
|
788 |
ln ${verbose} -snf ${symlink} ${BINDIR}/${pathto} || die |
ln ${verbose} -snf ${symlink} ${BINDIR}/${pathto} || die |
789 |
} |
} |
790 |
|
|
791 |
|
# installs systemd units |
792 |
|
# minstallunit /path/to/unit-file {destfilename} |
793 |
|
minstallunit() |
794 |
|
{ |
795 |
|
local unit |
796 |
|
local file |
797 |
|
local prefix |
798 |
|
|
799 |
|
[[ -z "$1" ]] && die "No unit given" |
800 |
|
|
801 |
|
# get the right prefix for newer systemd |
802 |
|
[[ -x /bin/systemctl ]] && prefix="" |
803 |
|
[[ -x /usr/bin/systemctl ]] && prefix="/usr" |
804 |
|
|
805 |
|
# if no fullpath given use file from sourcedir |
806 |
|
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
807 |
|
then |
808 |
|
file="${SOURCEDIR}/$(mpname)/$1" |
809 |
|
else |
810 |
|
file="$1" |
811 |
|
fi |
812 |
|
|
813 |
|
if [[ -n "$2" ]] |
814 |
|
then |
815 |
|
unit="$2" |
816 |
|
else |
817 |
|
unit="$(basename ${file})" |
818 |
|
fi |
819 |
|
|
820 |
|
# needed directory |
821 |
|
install -d ${BINDIR}${prefix}/lib/systemd/system || die |
822 |
|
|
823 |
|
# install our initscript |
824 |
|
install -v -m 0644 -o root -g root ${file} ${BINDIR}${prefix}/lib/systemd/system/${unit} || die |
825 |
|
} |
826 |
|
|
827 |
|
# installs systemd tmp configs to /etc/tmpfiles.d |
828 |
|
# minstalltmp /path/to/tmpdfile {destfilename} |
829 |
|
minstalltmp() |
830 |
|
{ |
831 |
|
local tmpdfile |
832 |
|
local file |
833 |
|
|
834 |
|
[[ -z "$1" ]] && die "No tmpd file given" |
835 |
|
|
836 |
|
# if no fullpath given use file from sourcedir |
837 |
|
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
838 |
|
then |
839 |
|
file="${SOURCEDIR}/$(mpname)/$1" |
840 |
|
else |
841 |
|
file="$1" |
842 |
|
fi |
843 |
|
|
844 |
|
if [[ -n "$2" ]] |
845 |
|
then |
846 |
|
tmpdfile="$2" |
847 |
|
else |
848 |
|
tmpdfile="$(basename ${file})" |
849 |
|
fi |
850 |
|
|
851 |
|
# needed directory |
852 |
|
install -d ${BINDIR}/etc/tmpfiles.d || die |
853 |
|
|
854 |
|
# install our tmpdfile |
855 |
|
install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/tmpfiles.d/${tmpdfile} || die |
856 |
|
} |
857 |
|
|
858 |
|
mclearconfig() |
859 |
|
{ |
860 |
|
local confdir |
861 |
|
local prefix="${BINDIR}" |
862 |
|
[[ -z ${MCONFIG} ]] && die "No \$MCONFIG given!" |
863 |
|
|
864 |
|
# no bindir prefix if requested |
865 |
|
case $1 in |
866 |
|
-b|--no-bindir) prefix="";; |
867 |
|
esac |
868 |
|
|
869 |
|
confdir="$(dirname ${MCONFIG})" |
870 |
|
if [[ ! -d ${prefix}/${confdir} ]] |
871 |
|
then |
872 |
|
install -d ${prefix}/${confdir} || die |
873 |
|
fi |
874 |
|
: > ${prefix}/${MCONFIG} |
875 |
|
} |
876 |
|
|
877 |
|
maddconfig() |
878 |
|
{ |
879 |
|
local argv="$1" |
880 |
|
local confdir |
881 |
|
local prefix="${BINDIR}" |
882 |
|
|
883 |
|
[[ -z ${MCONFIG} ]] && die "No \$MCONFIG given!" |
884 |
|
|
885 |
|
# no bindir prefix if requested |
886 |
|
case $1 in |
887 |
|
-b|--no-bindir) prefix=""; argv="$2" ;; |
888 |
|
esac |
889 |
|
|
890 |
|
[[ -z ${argv} ]] && die "No argument given!" |
891 |
|
|
892 |
|
confdir="$(dirname ${MCONFIG})" |
893 |
|
if [[ ! -d ${prefix}/${confdir} ]] |
894 |
|
then |
895 |
|
install -d ${prefix}/${confdir} || die |
896 |
|
fi |
897 |
|
echo "${argv}" >> ${prefix}/${MCONFIG} || die |
898 |
|
} |