--- branches/magellan-next/include/mtools.sminc 2010/09/14 16:46:32 6654 +++ branches/magellan-next/include/mtools.sminc 2011/06/02 20:44:40 7874 @@ -755,3 +755,65 @@ ln ${verbose} -snf ${symlink} ${BINDIR}/${pathto} || die } + +# installs systemd units +# minstallunit /path/to/unit-file {destfilename} +minstallunit() +{ + local unit + local file + + [[ -z "$1" ]] && die "No unit given" + + # if no fullpath given use file from sourcedir + if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] + then + file="${SOURCEDIR}/$(mpname)/$1" + else + file="$1" + fi + + if [[ -n "$2" ]] + then + unit="$2" + else + unit="$(basename ${file})" + fi + + # needed directory + install -d ${BINDIR}/lib/systemd/system || die + + # install our initscript + install -v -m 0644 -o root -g root ${file} ${BINDIR}/lib/systemd/system/${unit} || die +} + +# installs systemd tmp configs to /etc/tmpfiles.d +# minstalltmp /path/to/tmpdfile {destfilename} +minstalltmp() +{ + local tmpdfile + local file + + [[ -z "$1" ]] && die "No tmpd file given" + + # if no fullpath given use file from sourcedir + if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] + then + file="${SOURCEDIR}/$(mpname)/$1" + else + file="$1" + fi + + if [[ -n "$2" ]] + then + tmpdfile="$2" + else + tmpdfile="$(basename ${file})" + fi + + # needed directory + install -d ${BINDIR}/etc/tmpfiles.d || die + + # install our tmpdfile + install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/tmpfiles./${tmpdfile} || die +}