769 |
{ |
{ |
770 |
local unit |
local unit |
771 |
local file |
local file |
772 |
|
local prefix |
773 |
|
|
774 |
[[ -z "$1" ]] && die "No unit given" |
[[ -z "$1" ]] && die "No unit given" |
775 |
|
|
776 |
|
# get the right prefix for newer systemd |
777 |
|
[[ -x /bin/systemctl ]] && prefix="" |
778 |
|
[[ -x /usr/bin/systemctl ]] && prefix="/usr" |
779 |
|
|
780 |
# if no fullpath given use file from sourcedir |
# if no fullpath given use file from sourcedir |
781 |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] |
782 |
then |
then |
793 |
fi |
fi |
794 |
|
|
795 |
# needed directory |
# needed directory |
796 |
install -d ${BINDIR}/lib/systemd/system || die |
install -d ${BINDIR}${prefix}/lib/systemd/system || die |
797 |
|
|
798 |
# install our initscript |
# install our initscript |
799 |
install -v -m 0644 -o root -g root ${file} ${BINDIR}/lib/systemd/system/${unit} || die |
install -v -m 0644 -o root -g root ${file} ${BINDIR}${prefix}/lib/systemd/system/${unit} || die |
800 |
} |
} |
801 |
|
|
802 |
# installs systemd tmp configs to /etc/tmpfiles.d |
# installs systemd tmp configs to /etc/tmpfiles.d |