Skip to content

Commit

Permalink
fix golang post install and post uninstall sriptlets
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasb-ms committed Feb 4, 2025
1 parent cb6ac00 commit 2a787a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
17 changes: 7 additions & 10 deletions SPECS/golang/golang-1.22.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
%global gopath %{_datadir}/gocode
%global ms_go_filename go1.22.10-20241203.4.src.tar.gz
%global ms_go_revision 1
%global go_priority %(echo %{version}.%{ms_go_revision} | tr -d .)
%ifarch aarch64
%global gohostarch arm64
%else
Expand All @@ -16,7 +15,7 @@
Summary: Go
Name: golang
Version: 1.22.10
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD-3-Clause
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand Down Expand Up @@ -134,17 +133,10 @@ EOF

%post -p /sbin/ldconfig

alternatives --install %{_bindir}/go go %{goroot}/bin/go %{go_priority}
alternatives --install %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt %{go_priority}

%postun
/sbin/ldconfig
if [ $1 -eq 0 ]; then
# This is uninstall
alternatives --remove go %{goroot}/bin/go
alternatives --remove gofmt %{goroot}/bin/gofmt

rm %{_sysconfdir}/profile.d/go-exports.sh
rm -rf /opt/go
exit 0
fi
Expand All @@ -162,6 +154,11 @@ fi
%{_bindir}/*

%changelog
* Tue Feb 04 2025 Tobias Brick <[email protected]> - 1.22.10-2
- Fix post scriptlet
- Remove calls to alternatives
- Don't manually delete go-exports.sh

* Wed Dec 04 2024 Microsoft Golang Bot <[email protected]> - 1.22.10-1
- Bump version to 1.22.10-1

Expand All @@ -186,7 +183,7 @@ fi
* Tue Jun 04 2024 Davis Goodin <[email protected]> - 1.22.4-1
- Bump version to 1.22.4-1

* Tue May 07 2024 Davis Goodin <[email protected]> - 1.22.3-1
* Mon May 27 2024 Davis Goodin <[email protected]> - 1.22.3-1
- Bump version to 1.22.3-1

* Wed May 08 2024 Davis Goodin <[email protected]> - 1.21.9-2
Expand Down
17 changes: 7 additions & 10 deletions SPECS/golang/golang.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
%global gopath %{_datadir}/gocode
%global ms_go_filename go1.23.3-20241202.3.src.tar.gz
%global ms_go_revision 2
%global go_priority %(echo %{version}.%{ms_go_revision} | tr -d .)
%ifarch aarch64
%global gohostarch arm64
%else
Expand All @@ -16,7 +15,7 @@
Summary: Go
Name: golang
Version: 1.23.3
Release: 2%{?dist}
Release: 3%{?dist}
License: BSD-3-Clause
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand Down Expand Up @@ -134,17 +133,10 @@ EOF

%post -p /sbin/ldconfig

alternatives --install %{_bindir}/go go %{goroot}/bin/go %{go_priority}
alternatives --install %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt %{go_priority}

%postun
/sbin/ldconfig
if [ $1 -eq 0 ]; then
# This is uninstall
alternatives --remove go %{goroot}/bin/go
alternatives --remove gofmt %{goroot}/bin/gofmt

rm %{_sysconfdir}/profile.d/go-exports.sh
rm -rf /opt/go
exit 0
fi
Expand All @@ -162,6 +154,11 @@ fi
%{_bindir}/*

%changelog
* Tue Feb 04 2025 Tobias Brick <[email protected]> - 1.23.3-3
- Fix post scriptlet
- Remove calls to alternatives
- Don't manually delete go-exports.sh

* Tue Dec 03 2024 Microsoft Golang Bot <[email protected]> - 1.23.3-2
- Bump version to 1.23.3-2

Expand All @@ -186,7 +183,7 @@ fi
* Tue Jun 04 2024 Davis Goodin <[email protected]> - 1.22.4-1
- Bump version to 1.22.4-1

* Tue May 07 2024 Davis Goodin <[email protected]> - 1.22.3-1
* Mon May 27 2024 Davis Goodin <[email protected]> - 1.22.3-1
- Bump version to 1.22.3-1

* Wed May 08 2024 Davis Goodin <[email protected]> - 1.21.9-2
Expand Down

0 comments on commit 2a787a7

Please sign in to comment.