Skip to content

Instantly share code, notes, and snippets.

@rizkidoank
Last active August 17, 2021 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rizkidoank/52b614b9aa1db31038e71a993a0cedac to your computer and use it in GitHub Desktop.
Save rizkidoank/52b614b9aa1db31038e71a993a0cedac to your computer and use it in GitHub Desktop.
install go-main 1.0.0
-----------------------------------------------
Running transaction
Preparing : 1/1
Running scriptlet: go-main-1.0.0-1.el8.x86_64 1/1
Installing : go-main-1.0.0-1.el8.x86_64 1/1
Running scriptlet: go-main-1.0.0-1.el8.x86_64 1/1
POST Install
Created symlink /etc/systemd/system/multi-user.target.wants/go-main.service → /usr/lib/systemd/system/go-main.service.
Verifying : go-main-1.0.0-1.el8.x86_64 1/1
Installed:
go-main-1.0.0-1.el8.x86_64
-----------------------------------------------
Install go-main 1.0.1
-----------------------------------------------
Running transaction
Preparing : 1/1
Running scriptlet: go-main-1.0.1-1.el8.x86_64 1/1
Running scriptlet: go-main-1.0.1-1.el8.x86_64 1/2
Upgrading : go-main-1.0.1-1.el8.x86_64 1/2
Running scriptlet: go-main-1.0.1-1.el8.x86_64 1/2
POST Install
Running scriptlet: go-main-1.0.0-1.el8.x86_64 2/2
PRE Uninstall
Cleanup : go-main-1.0.0-1.el8.x86_64 2/2
Running scriptlet: go-main-1.0.0-1.el8.x86_64 2/2
POST Uninstall
Verifying : go-main-1.0.1-1.el8.x86_64 1/2
Verifying : go-main-1.0.0-1.el8.x86_64 2/2
Upgraded:
go-main-1.0.1-1.el8.x86_64
-----------------------------------------------
Downgrade go-main 1.0.0
-----------------------------------------------
Running transaction
Preparing : 1/1
Running scriptlet: go-main-1.0.0-1.el8.x86_64 1/1
Running scriptlet: go-main-1.0.0-1.el8.x86_64 1/2
Downgrading : go-main-1.0.0-1.el8.x86_64 1/2
Running scriptlet: go-main-1.0.0-1.el8.x86_64 1/2
POST Install
Running scriptlet: go-main-1.0.1-1.el8.x86_64 2/2
PRE Uninstall
Cleanup : go-main-1.0.1-1.el8.x86_64 2/2
Running scriptlet: go-main-1.0.1-1.el8.x86_64 2/2
POST Uninstall
Verifying : go-main-1.0.0-1.el8.x86_64 1/2
Verifying : go-main-1.0.1-1.el8.x86_64 2/2
Downgraded:
go-main-1.0.0-1.el8.x86_64
-----------------------------------------------
Remove go-main
-----------------------------------------------
Running transaction
Preparing : 1/1
Running scriptlet: go-main-1.0.1-1.el8.x86_64 1/1
PRE Uninstall
PRE Uninstall conditional
Removed /etc/systemd/system/multi-user.target.wants/go-main.service.
Erasing : go-main-1.0.1-1.el8.x86_64 1/1
Running scriptlet: go-main-1.0.1-1.el8.x86_64 1/1
POST Uninstall
POST Uninstall conditional
Verifying : go-main-1.0.1-1.el8.x86_64 1/1
Removed:
go-main-1.0.1-1.el8.x86_64
-----------------------------------------------
Name: go-main
Version: %{_version}
Release: 1%{?dist}
Summary: go-main
License: Proprietary
BuildArch: x86_64
BuildRequires: systemd
Requires(pre): shadow-utils
%global output_dir /usr/local/bin
%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
useradd -r -g %{name} -d /home/%{name} -m -c "User for the '%{name}' service" %{name}
exit 0
mkdir -p %{buildroot}%{output_dir}/
%description
This is just a sample golang http server
%install
mkdir -p %{buildroot}%{output_dir}/
%{__install} -D -m 0755 $RPM_SOURCE_DIR/%{name} %{buildroot}%{output_dir}
%{__install} -D -m 0644 $RPM_SOURCE_DIR/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
%files
%{output_dir}/%{name}
%{_unitdir}/%{name}.service
%post
echo "POST Install"
systemctl daemon-reload
systemctl enable %{name}.service
systemctl restart %{name}.service
%preun
echo "PRE Uninstall"
if [ $1 == 0 ]; then #uninstall
echo "PRE Uninstall conditional"
systemctl unmask %{name}.service
systemctl stop %{name}.service
systemctl disable %{name}.service
fi
%postun
echo "POST Uninstall"
if [ $1 == 0 ]; then #uninstall
echo "POST Uninstall conditional"
systemctl daemon-reload
systemctl reset-failed
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment