fix linking the caRepeater.service
This commit is contained in:
@ -215,38 +215,47 @@ shopt -s extglob
|
|||||||
%clean
|
%clean
|
||||||
%{__make} realclean
|
%{__make} realclean
|
||||||
%{__rm} -f modules/RELEASE.*.local
|
%{__rm} -f modules/RELEASE.*.local
|
||||||
|
%{__rm} -rf %{buildroot}
|
||||||
|
%{__cp} %{_rpmdir}/*/%{name}*%{version}-%{release}.*.rpm %{_sourcedir}
|
||||||
|
|
||||||
# Link caRepeater and profile script to highest installed EPICS version after install and uninstall
|
# Link caRepeater and profile script to highest installed EPICS version after install and uninstall
|
||||||
%post
|
%post
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
%{__rm} -f /etc/profile.d/epics-base.sh
|
%{__rm} -f /etc/profile.d/epics-base.sh
|
||||||
%{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/epics-base.sh | /usr/bin/head -n1)" /etc/profile.d/
|
%{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/epics-base.sh | /usr/bin/head -n1)" /etc/profile.d/
|
||||||
|
|
||||||
SYSTEMD_DIR=$(pkg-config systemd --variable=systemdsystemunitdir)
|
|
||||||
if [ -n "$SYSTEMD_DIR" ]
|
|
||||||
then
|
|
||||||
test -e $SYSTEMD_DIR/caRepeater.service && %{__rm} $SYSTEMD_DIR/caRepeater.service
|
|
||||||
%{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/%{epics_host_arch}/caRepeater.service | /usr/bin/head -n1)" $SYSTEMD_DIR/
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl enable --now caRepeater.service
|
|
||||||
fi
|
|
||||||
|
|
||||||
%postun
|
|
||||||
shopt -s extglob
|
|
||||||
|
|
||||||
%{__rm} -f /etc/profile.d/epics-base.sh
|
|
||||||
%{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/epics-base.sh 2>/dev/null | /usr/bin/head -n1)" /etc/profile.d/ 2>/dev/null
|
|
||||||
|
|
||||||
SYSTEMD_DIR=$(pkg-config systemd --variable=systemdsystemunitdir)
|
SYSTEMD_DIR=$(pkg-config systemd --variable=systemdsystemunitdir)
|
||||||
if [ -n "$SYSTEMD_DIR" ]
|
if [ -n "$SYSTEMD_DIR" ]
|
||||||
then
|
then
|
||||||
%{__rm} -f $SYSTEMD_DIR/caRepeater.service
|
%{__rm} -f $SYSTEMD_DIR/caRepeater.service
|
||||||
%{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/%{epics_host_arch}/caRepeater.service 2>/dev/null | /usr/bin/head -n1)" $SYSTEMD_DIR/ 2>/dev/null
|
LATEST_REPEATER=$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/%{epics_host_arch}/caRepeater.service | /usr/bin/head -n1)
|
||||||
|
%{__ln_s} $LATEST_REPEATER $SYSTEMD_DIR/
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl reenable caRepeater.service
|
||||||
|
systemctl start caRepeater.service
|
||||||
|
fi
|
||||||
|
|
||||||
|
%postun
|
||||||
|
shopt -s extglob
|
||||||
|
%{__rm} -f /etc/profile.d/epics-base.sh
|
||||||
|
%{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/epics-base.sh 2>/dev/null | /usr/bin/head -n1)" /etc/profile.d/ 2>/dev/null
|
||||||
|
SYSTEMD_DIR=$(pkg-config systemd --variable=systemdsystemunitdir)
|
||||||
|
if [ -n "$SYSTEMD_DIR" ]
|
||||||
|
then
|
||||||
|
LATEST_REPEATER=$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/%{epics_host_arch}/caRepeater.service 2>/dev/null | /usr/bin/head -n1)
|
||||||
|
if [ -z "$LATEST_REPEATER" ]
|
||||||
|
then
|
||||||
|
systemctl disable caRepeater.service
|
||||||
|
# Do not stop or restart caRepeater.service
|
||||||
|
# because EPICS clients cannot handle that.
|
||||||
|
# Next reboot will take care of this.
|
||||||
|
fi
|
||||||
|
%{__rm} -f $SYSTEMD_DIR/caRepeater.service
|
||||||
|
if [ -n "$LATEST_REPEATER" ]
|
||||||
|
then
|
||||||
|
%{__ln_s} $LATEST_REPEATER $SYSTEMD_DIR/ 2>/dev/null
|
||||||
|
systemctl reenable caRepeater.service
|
||||||
|
fi
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
# Do not disable or restart caRepeater.service
|
|
||||||
# because EPICS clients cannot handle that.
|
|
||||||
# Next reboot will take care of this.
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%files
|
%files
|
||||||
|
Reference in New Issue
Block a user