From 824f65baae146347bf8019c5ccaac2ac7e6b2788 Mon Sep 17 00:00:00 2001 From: Mbucari Date: Fri, 19 May 2023 15:05:19 -0600 Subject: [PATCH] Fix rpm upgrade --- Scripts/Bundle_Redhat.sh | 35 +++++++++++-------- .../LoadByOS/LinuxConfigApp/LinuxInterop.cs | 4 +-- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/Scripts/Bundle_Redhat.sh b/Scripts/Bundle_Redhat.sh index 77bb4769..c47474c9 100644 --- a/Scripts/Bundle_Redhat.sh +++ b/Scripts/Bundle_Redhat.sh @@ -81,8 +81,6 @@ if test -f 'libcoreclrtraceptprovider.so'; then rm 'libcoreclrtraceptprovider.so' fi -touch appsettings.json -chmod 666 appsettings.json install -m 666 libation_glass.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/libation.svg install -m 666 Libation.desktop %{buildroot}%{_datadir}/applications/Libation.desktop @@ -94,26 +92,33 @@ install * %{buildroot}%{_libdir}/%{name}/ %post -ln -s %{_libdir}/%{name}/Libation %{_bindir}/libation -ln -s %{_libdir}/%{name}/Hangover %{_bindir}/hangover -ln -s %{_libdir}/%{name}/LibationCli %{_bindir}/libationcli +if [ \$1 -eq 1 ] ; then + # Initial installation + touch %{_libdir}/%{name}/appsettings.json + chmod 666 %{_libdir}/%{name}/appsettings.json + + ln -s %{_libdir}/%{name}/Libation %{_bindir}/libation + ln -s %{_libdir}/%{name}/Hangover %{_bindir}/hangover + ln -s %{_libdir}/%{name}/LibationCli %{_bindir}/libationcli -gtk-update-icon-cache -f %{_datadir}/icons/hicolor/ + gtk-update-icon-cache -f %{_datadir}/icons/hicolor/ + + if ! grep -q 'fs.inotify.max_user_instances=524288' /etc/sysctl.conf; then + echo fs.inotify.max_user_instances=524288 | tee -a /etc/sysctl.conf && sysctl -p + fi +fi %postun - -rm %{_bindir}/libation -rm %{_bindir}/hangover -rm %{_bindir}/libationcli - -if ! grep -q 'fs.inotify.max_user_instances=524288' /etc/sysctl.conf; then - echo fs.inotify.max_user_instances=524288 | tee -a /etc/sysctl.conf && sysctl -p +if [ \$1 -eq 0 ] ; then + # Uninstall + rm %{_bindir}/libation + rm %{_bindir}/hangover + rm %{_bindir}/libationcli fi %files %{_datadir}/icons/hicolor/scalable/apps/libation.svg -%{_datadir}/applications/Libation.desktop -%{_libdir}/%{name}/appsettings.json" >> ~/rpmbuild/SPECS/libation.spec +%{_datadir}/applications/Libation.desktop" >> ~/rpmbuild/SPECS/libation.spec cd "$BIN_DIR" diff --git a/Source/LoadByOS/LinuxConfigApp/LinuxInterop.cs b/Source/LoadByOS/LinuxConfigApp/LinuxInterop.cs index d005c122..22203e1d 100644 --- a/Source/LoadByOS/LinuxConfigApp/LinuxInterop.cs +++ b/Source/LoadByOS/LinuxConfigApp/LinuxInterop.cs @@ -29,11 +29,11 @@ namespace LinuxConfigApp //only run the auto upgrader if the current app was installed from the //.deb or .rpm package. Try to detect this by checking if the symlink exists. - public bool CanUpgrade => Directory.Exists("/usr/lib/libation"); + public bool CanUpgrade => File.Exists("/bin/libation"); public void InstallUpgrade(string upgradeBundle) { if (File.Exists("/bin/yum")) - RunAsRoot("yum", $"install '{upgradeBundle}'"); + RunAsRoot("yum", $"install -y '{upgradeBundle}'"); else RunAsRoot("apt", $"install '{upgradeBundle}'"); }