-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpost.sh.in
32 lines (28 loc) · 1.11 KB
/
post.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Enable verbose logging.
if [ "@VERBOSE_LOGGING@" = "TRUE" ]; then
set -o xtrace
echo "Running post script for v@CMAKE_PROJECT_VERSION@"
fi
# If we're installing the package for the first time, copy
# the service file to the service unit directory.
#
# Don't touch the service file if we're upgrading the package.
# Obviously this logic would need to be tweaked if the service
# file was changing between releases...
service_name=@SERVICE_NAME@
if [ $1 -eq 1 ]; then
%{__install} -m644 $RPM_INSTALL_PREFIX/share/$service_name %{_unitdir}/$service_name
fi
%systemd_post $service_name
# Not required, but it lets the user know the name of the
# service by printing it to the terminal. Also, if it's disabled,
# it'll return exit code 3, which gets interpreted as a failure.
#
# Suffocate any exit code that this prints - it's purely diagnostic.
systemctl status $service_name || true
# Only print about the service if it was installed for the first time.
if [ $1 -eq 1 ]; then
printf %"$COLUMNS"s |tr " " "-"
echo "$service_name was installed but wasn't started or enabled."
printf %"$COLUMNS"s |tr " " "-"
fi