File tuxedo-control-center.spec of Package tuxedo-control-center
#
# spec file for package tuxedo-control-center
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: tuxedo-control-center
Version: 2.1.23
Release: 0
Summary: TUXEDO Control Center Application
License: GPL-3.0-only
URL: https://github.com/tuxedocomputers/tuxedo-control-center
Source0: https://rpm.tuxedocomputers.com/opensuse/15.6/x86_64/%{name}_%{version}.rpm
Source10: https://raw.githubusercontent.com/tuxedocomputers/tuxedo-control-center/v%{version}/COPYING
Source11: https://raw.githubusercontent.com/tuxedocomputers/tuxedo-control-center/v%{version}/CHANGELOG.md
Source12: https://raw.githubusercontent.com/tuxedocomputers/tuxedo-control-center/v%{version}/README.md
Source99: %{name}.rpmlintrc
NoSource: 0
BuildRequires: hicolor-icon-theme
BuildRequires: update-desktop-files
Requires: (libayatana-appindicator3-1 or libappindicator or libappindicator3-1)
Requires: tuxedo-drivers
Requires: pkexec
Requires(post): systemd
Recommends: kmod(v4l2loopback.ko)
Suggests: %{name}-config
Suggests: %{name}-faketools
ExclusiveArch: x86_64
AutoReqProv: no
%{?systemd_ordering}
%description
TUXEDO Control Center Application.
%package config
Summary: Access config for the TUXEDO Control Center
Requires: %{name}
Requires: xhost
BuildArch: noarch
%description config
Configuration for the TUXEDO Control Center Application to
avoid some errors of the 'tccd' daemon accessing the GUI.
%package faketools
Summary: Fake tools for the TUXEDO Control Center
Suggests: %{name}
Conflicts: suse-prime
BuildArch: noarch
%description faketools
Fake tools for the TUXEDO Control Center Application, mainly
'%{_bindir}/prime-select' and '%{_bindir}/prime-supported'.
%prep
%setup -q -c -T
rpm2cpio %{SOURCE0} | cpio -idmv
%build
# nop
%install
export NO_BRP_STRIP_DEBUG=true
DIST_DATA=/opt/%{name}/resources/dist/%{name}/data/dist-data
# main
mv opt usr %{buildroot}
# desktop file
cp -p %{buildroot}${DIST_DATA}/%{name}.desktop %{buildroot}%{_datadir}/applications
%suse_update_desktop_file %{name}
# bin
install -d -m 0755 %{buildroot}%{_bindir}
ln -s /opt/%{name}/%{name} %{buildroot}%{_bindir}
# dbus, polkit, udev
install -D -m 0644 -t %{buildroot}%{_datadir}/dbus-1/system.d \
%{buildroot}${DIST_DATA}/com.tuxedocomputers.tccd.conf
install -D -m 0644 -t %{buildroot}%{_datadir}/polkit-1/actions \
%{buildroot}${DIST_DATA}/com.tuxedocomputers.tccd.policy
install -D -m 0644 -t %{buildroot}%{_udevrulesdir} %{buildroot}${DIST_DATA}/99-webcam.rules
# systemd services
install -D -m 0644 -t %{buildroot}%{_unitdir} %{buildroot}${DIST_DATA}/tccd{,-sleep}.service
# misc dirs
install -d -m 0755 %{buildroot}%{_sysconfdir}/tcc %{buildroot}%{_localstatedir}/log/tccd
# doc
install -m 0644 %{SOURCE10} %{SOURCE11} %{SOURCE12} .
# config
install -d %{buildroot}%{_sysconfdir}/profile.d
cat << EOF > %{buildroot}%{_sysconfdir}/profile.d/tccd.sh
if test "\$UID" -ne 0 -a -n "\$DISPLAY" ; then
if systemctl --quiet is-active tccd.service ; then
xhost | grep -iqw "si:localuser:root" || xhost +si:localuser:root
fi
fi
EOF
# faketools
ln -s %{_bindir}/false %{buildroot}%{_bindir}/prime-select
ln -s %{_bindir}/false %{buildroot}%{_bindir}/prime-supported
%pre
%service_add_pre tccd.service tccd-sleep.service
%post
%service_add_post tccd.service tccd-sleep.service
%preun
%service_del_preun tccd.service tccd-sleep.service
%postun
%service_del_postun tccd.service tccd-sleep.service
%posttrans
systemctl disable --now --quiet tuxedofancontrol.service >/dev/null 2>&1 || :
systemctl enable tccd.service tccd-sleep.service
systemctl restart tccd.service
%files
%license COPYING
%doc CHANGELOG.md README.md
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/dbus-1/system.d/com.tuxedocomputers.tccd.conf
%{_datadir}/metainfo/com.tuxedocomputers.tcc.metainfo.xml
%{_datadir}/polkit-1/actions/com.tuxedocomputers.tccd.policy
%{_sysconfdir}/tcc
%{_udevrulesdir}/99-webcam.rules
%{_unitdir}/tccd{,-sleep}.service
%{_localstatedir}/log/tccd
/opt/%{name}
%files config
%config %{_sysconfdir}/profile.d/tccd.sh
%files faketools
%{_bindir}/prime-select
%{_bindir}/prime-supported
%changelog