Skip to content

Commit

Permalink
[rpm/meecast.spec] Fix writing dconf key, license etc.
Browse files Browse the repository at this point in the history
Addresses issue Meecast#50
  • Loading branch information
Olf0 authored Jun 12, 2024
1 parent a3cdfc9 commit 0b878e7
Showing 1 changed file with 41 additions and 35 deletions.
76 changes: 41 additions & 35 deletions rpm/meecast.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#
# Do not Edit! Generated by:
# spectacle version 0.18
#
%{!?qtc_qmake:%define qtc_qmake %qmake}
%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
%{!?qtc_make:%define qtc_make make}
Expand All @@ -12,7 +8,7 @@ Summary: Weather forecast application for SailfishOS
Version: 1.1.39
Release: 1
Group: Utility
License: GPLv2.1
License: LGPL-2.1-only
URL: https://github.com/Meecast/meecast
Source0: %{name}-%{version}.tar.bz2
#Temporary
Expand All @@ -38,8 +34,8 @@ BuildRequires: libkeepalive-devel
BuildRequires: mlite-qt5-devel
BuildRequires: pkgconfig(Qt5Concurrent)
#BuildRequires: libqt-devel
BuildRequires: qt5-qtpositioning-devel
BuildRequires: qml(Sailfish.Silica)
BuildRequires: qt5-qtpositioning-devel
BuildRequires: qml(Sailfish.Silica)
#Requires: qt5-qtpositioning
#Requires: sailfishsilica-qt5
#Requires: qt5-qtdeclarative-import-models2
Expand All @@ -54,41 +50,43 @@ Type: desktop-application
Categories:
- Science
- News
DeveloperName: Uladzislau Vasilyeu and Omweather team
DeveloperName: Uladzislau Vasilyeu and OMWeather team
Custom:
- Repo: https://github.com/meecast/meecast
Icon: https://github.com/Meecast/meecast/blob/master/meecast/core/data/desktop/Icon/128/meecast.png?raw=true
- Repo: %{url}
Icon: %{url}/raw/master/meecast/core/data/desktop/Icon/128/meecast.png
%endif


%package daemon
Version: 1.10
Release: 1
Summary: Daemon for Weather forecast application MeeCast on SailfishOS
Group: Utility
License: GPLv2.1
Requires: harbour-meecast
Group: Utility
License: LGPL-2.1-only
Requires: harbour-meecast
Requires: systemd
BuildRequires: pkgconfig(contentaction5)
%description daemon
MeeCast daemon for multiplatform highly customizable open source weather forecast client based on OMWeather code

%package lockscreen
Version: 0.5
Summary: Lockscreen Widget for Weather forecast application MeeCast on SailfishOS
Group: Utility
License: GPLv2.1
Group: Utility
License: LGPL-2.1-only
Requires: harbour-meecast
Requires: harbour-meecast-daemon => 0.3
Requires: patchmanager
Requires: systemd
%description lockscreen
MeeCast Lockscreen widget for multiplatform highly customizable open source weather forecast client based on OMWeather code

%package event
Version: 1.1
Release: 2
Release: 3
Summary: Event Widget for Weather forecast application MeeCast on SailfishOS
Group: Utility
License: GPLv2.1
Group: Utility
License: LGPL-2.1-only
Requires: harbour-meecast
Requires: harbour-meecast-daemon => 0.9
# Detect missing Lipstick Weather Widget on SailfishOS > 4.6.0.0
Expand All @@ -98,6 +96,10 @@ Requires: harbour-meecast-daemon => 0.9
# Require Lipstick Weather Widget on SailfishOS > 4.6.0.0
%if 0%{?add_weather_widget}
Require: lipstick-jolla-home-qt5-weather-widget-settings
# Require these to be able to set a dconf key of the primary user
Requires: coreutils
Requires: systemd
Requires: dconf
%endif
%description event
MeeCast event widget for multiplatform highly customizable open source weather forecast client based on OMWeather code
Expand Down Expand Up @@ -128,27 +130,28 @@ rm -rf %{buildroot}
#make INSTALL_ROOT=%{buildroot} install
#rm %{buildroot}/opt/com.meecast.omweather/lib/libomweather-core.a
# << install post
desktop-file-install --delete-original \
--dir %{buildroot}%{_datadir}/applications \
desktop-file-install --delete-original \
--dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/*.desktop


%pre lockscreen
if [ -f /usr/sbin/patchmanager ]; then
/usr/sbin/patchmanager -u sailfishos-lockscreen-meecast-patch || true
if [ -f %{_sbindir}/patchmanager ]; then
%{_sbindir}/patchmanager -u sailfishos-lockscreen-meecast-patch || true
fi

%pre daemon

%preun daemon
# Removal
if [ "$1" = "0" ]; then
systemctl-user disable meecastd.service
systemctl-user stop meecastd.service
fi

%preun lockscreen
if [ -f /usr/sbin/patchmanager ]; then
/usr/sbin/patchmanager -u sailfishos-lockscreen-meecast-patch || true
if [ -f %{_sbindir}/patchmanager ]; then
%{_sbindir}/patchmanager -u sailfishos-lockscreen-meecast-patch || true
fi

%postun daemon
Expand All @@ -159,42 +162,45 @@ fi

%postun event
%if 0%{?add_weather_widget}
if [ "$1" = "0" ] # Removal
then dconf write /desktop/lipstick-jolla-home/force_weather_loading false || true
# Removal
if [ "$1" = "0" ]
# then su --login "$(loginctl --no-legend list-sessions | grep -F seat0 | tr -s ' ' | cut -f 4 -d ' ')" --command='dconf write /desktop/lipstick-jolla-home/force_weather_loading false' || true
then su --login "$(loginctl --no-legend list-sessions | grep -F seat0 | tr -s ' ' | cut -f 4 -d ' ')" --command='dconf reset /desktop/lipstick-jolla-home/force_weather_loading' || true
fi
%endif

%post daemon
if ps -A | grep "meecastd" ; then killall meecastd ; fi
systemctl-user enable meecastd.service
systemctl-user start meecastd.service
exit 0

%post lockscreen
if ps -A | grep "meecastd" ; then killall meecastd ; fi
systemctl-user enable meecastd.service
systemctl-user start meecastd.service
exit 0

%post event
# Activate Lipstick Weather Widget on SFOS > 4.6.0.0
%if 0%{?add_weather_widget}
dconf write /desktop/lipstick-jolla-home/force_weather_loading true
exit 0
su --login "$(loginctl --no-legend list-sessions | grep -F seat0 | tr -s ' ' | cut -f 4 -d ' ')" --command='dconf write /desktop/lipstick-jolla-home/force_weather_loading true' || true
%endif

%files
%defattr(-,root,root,-)
/usr/share/applications/harbour-meecast.desktop
/usr/bin/harbour-meecast
%{_datadir}/applications/harbour-meecast.desktop
%{_bindir}/harbour-meecast
/usr/share/harbour-meecast
#/usr/share/iconsets
/usr/share/icons/hicolor
#%{_datadir}/iconsets
%{_datadir}/icons/hicolor
#/opt/com.meecast.omweather/share

%files daemon
%defattr(-,root,root,-)
/usr/bin/meecastd
/usr/bin/meecast_predaemon
/usr/lib/systemd/user/meecastd.service
%{_bindir}/meecastd
%{_bindir}/meecast_predaemon
%{_userunitdir}/meecastd.service
%{_libdir}/qt5/qml/org/meecast/data

%files lockscreen
Expand Down

0 comments on commit 0b878e7

Please sign in to comment.