[mapplauncherd] Fixes MER#1916

Signed-off-by: Aleksey Mikhaylov <a.mikhaylov@omprussia.ru>
pull/1/head
Aleksey Mikhaylov 7 years ago
parent 6e72366257
commit 2442117654

@ -0,0 +1,11 @@
[Unit]
Description=Booster cgroup mounting service
Before=systemd-user-sessions.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/startup/booster-cgroup-mount
[Install]
WantedBy=multi-user.target

@ -6,6 +6,7 @@ Group: System/Daemons
License: LGPLv2+
URL: https://git.merproject.org/mer-core/mapplauncherd
Source0: %{name}-%{version}.tar.bz2
Source1: booster-cgroup-mount.service
Requires: systemd-user-session-targets
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
@ -35,6 +36,14 @@ Obsoletes: meegotouch-applauncherd-devel <= 3.0.3
Development files for creating applications that can be launched
using mapplauncherd.
%package cgroup
Summary: Service files for booster cgroup mount
Group: System/Daemons
Requires: %{name} = %{version}-%{release}
%description cgroup
Scripts and services files for application launcher to mount
booster cgroup at startup.
%prep
%setup -q -n %{name}-%{version}
@ -59,6 +68,12 @@ ln -s ../booster-generic.service %{buildroot}/usr/lib/systemd/user/user-session.
mkdir -p %{buildroot}%{_datadir}/mapplauncherd/privileges.d
install -D -m 0755 %{SOURCE1} %{buildroot}/lib/systemd/system/booster-cgroup-mount.service
mkdir -p %{buildroot}/lib/systemd/system/multi-user.target.wants
ln -s ../booster-cgroup-mount.service %{buildroot}/lib/systemd/system/multi-user.target.wants/
install -D -m 0755 scripts/booster-cgroup-mount %{buildroot}/usr/lib/startup/booster-cgroup-mount
%pre
groupadd -rf privileged
@ -80,3 +95,9 @@ groupadd -rf privileged
%files devel
%defattr(-,root,root,-)
%{_includedir}/applauncherd/*
%files cgroup
/lib/systemd/system/booster-cgroup-mount.service
/lib/systemd/system/multi-user.target.wants/booster-cgroup-mount.service
%dir %{_libdir}/startup
%{_libdir}/startup/booster-cgroup-mount

@ -0,0 +1,31 @@
#!/bin/sh
CGDIR="/sys/fs/cgroup"
# precondition: cgroup mount must exist
mountpoint -q $CGDIR || exit 1
# create booster directory
if [ ! -d $CGDIR/booster ]; then
FAIL=1
if mount -o remount,rw $CGDIR; then
if mkdir $CGDIR/booster; then
FAIL=0
fi
if ! mount -o remount,ro $CGDIR; then
FAIL=1
fi
fi
[ $FAIL = 0 ] || exit 1
fi
# mount booster directory
if ! mountpoint -q $CGDIR/booster; then
mount -t cgroup -o none,name=booster cgroup $CGDIR/booster || exit 1
fi
# adjust booster directory permissions
FAIL=0
chown -R root:privileged $CGDIR/booster || FAIL=1
chmod 0774 $CGDIR/booster || FAIL=1
exit $FAIL
Loading…
Cancel
Save