Sync from SUSE:SLFO:Main systemd-zram-service revision d81346ed0e9d3e93e5de0255f3476b08
This commit is contained in:
commit
74d80c4412
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
32
systemd-zram-service.changes
Normal file
32
systemd-zram-service.changes
Normal file
@ -0,0 +1,32 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 7 00:00:00 CEST 2022 - dsterba@suse.cz
|
||||
|
||||
- disable multi-zram devices (deprecated, not necessary since 4.7)
|
||||
- change compression to zstd
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 13 16:18:04 UTC 2021 - Johannes Segitz <jsegitz@suse.com>
|
||||
|
||||
- Drop hardenings again. The current set causes issues (bsc#1193402)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 24 12:39:05 UTC 2021 - Johannes Segitz <jsegitz@suse.com>
|
||||
|
||||
- Added hardening to systemd service(s) (bsc#1181400). Modified:
|
||||
* zramswap.service
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 17 22:59:00 UTC 2018 - malcolmlewis@opensuse.org
|
||||
|
||||
- Improve package description.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 19 14:31:00 UTC 2018 - malcolmlewis@opensuse.org
|
||||
|
||||
- Cleanup spec file for submission, (boo#1116056).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 7 16:13:34 UTC 2012 - malcolmlewis@opensuse.org
|
||||
|
||||
- Initial build.
|
||||
|
84
systemd-zram-service.spec
Normal file
84
systemd-zram-service.spec
Normal file
@ -0,0 +1,84 @@
|
||||
#
|
||||
# spec file for package systemd-zram-service
|
||||
#
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
# Copyright (c) 2012-2018 Malcolm J Lewis <malcolmlewis@opensuse.org>
|
||||
#
|
||||
# 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: systemd-zram-service
|
||||
Version: 0.2.1
|
||||
Release: 0
|
||||
Summary: Systemd service for zram
|
||||
License: GPL-2.0-only
|
||||
Group: System/Daemons
|
||||
URL: https://code.launchpad.net/~elementary-os/elementaryos/zramswap-enabler
|
||||
Source0: zramswap-enabler-0.2.1.tar.bz2
|
||||
#Source0: bzr branch lp:~elementary-os/elementaryos/zramswap-enabler
|
||||
Source1: zramswapon
|
||||
Source2: zramswapoff
|
||||
Source3: zramswap.service
|
||||
Conflicts: compcache
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildArch: noarch
|
||||
%systemd_requires
|
||||
|
||||
%description
|
||||
A successor to compcache, zRam, has been already integrated in the Linux kernel
|
||||
for a while now. This means that no additional compilation nor tweaking is
|
||||
required to benefit from compressing memory on the fly and massively reduced
|
||||
swapping.
|
||||
|
||||
This package contains command line scripts zramswapon, zramswapoff to enable
|
||||
zRam devices as required, or at boot time via a systemd service.
|
||||
|
||||
Individual Compressed RAM Block Devices are created based on cores/threads
|
||||
available, the size of each block device is calculated on cores/threads divided
|
||||
by total ram installed. The final total is then added to system swap.
|
||||
|
||||
%prep
|
||||
%setup -q -n zramswap-enabler-%{version}
|
||||
|
||||
%build
|
||||
# No building required, just a placehoder.
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{_sbindir}
|
||||
install -m 0755 %{S:1} %{S:2} %{buildroot}%{_sbindir}/
|
||||
mkdir -p %{buildroot}%{_unitdir}
|
||||
install -m 0644 %{S:3} %{buildroot}%{_unitdir}/
|
||||
pushd %{buildroot}%{_sbindir}
|
||||
ln -s service rczramswap
|
||||
popd
|
||||
|
||||
%pre
|
||||
%service_add_pre zramswap.service
|
||||
|
||||
%post
|
||||
%service_add_post zramswap.service
|
||||
|
||||
%preun
|
||||
%service_del_preun zramswap.service
|
||||
|
||||
%postun
|
||||
%service_del_postun zramswap.service
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc debian/copyright debian/changelog
|
||||
%{_sbindir}/rczramswap
|
||||
%{_sbindir}/zramswap*
|
||||
%{_unitdir}/zramswap.service
|
||||
|
||||
%changelog
|
BIN
zramswap-enabler-0.2.1.tar.bz2
(Stored with Git LFS)
Normal file
BIN
zramswap-enabler-0.2.1.tar.bz2
(Stored with Git LFS)
Normal file
Binary file not shown.
17
zramswap.service
Normal file
17
zramswap.service
Normal file
@ -0,0 +1,17 @@
|
||||
# /lib/systemd/system/zramswap.service
|
||||
#
|
||||
# Copyright (c) 2012-2018 Malcolm J Lewis <malcolmlewis@opensuse.org>
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=Service enabling compressing RAM with zRam
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/zramswapon
|
||||
ExecStop=/usr/sbin/zramswapoff
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
6
zramswapoff
Normal file
6
zramswapoff
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Switching off swap
|
||||
swapoff /dev/zram0
|
||||
|
||||
rmmod zram
|
18
zramswapon
Normal file
18
zramswapon
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get the amount of memory in the machine
|
||||
mem_total_kb=$(grep MemTotal /proc/meminfo | grep -E --only-matching '[[:digit:]]+')
|
||||
mem_total=$((mem_total_kb * 1024))
|
||||
|
||||
# load the dependency module
|
||||
modprobe zram
|
||||
|
||||
# initialize the device with zstd compression algorithm
|
||||
echo zstd > /sys/block/zram0/comp_algorithm;
|
||||
echo $mem_total > /sys/block/zram0/disksize
|
||||
|
||||
# Creating the swap filesystem
|
||||
mkswap /dev/zram0
|
||||
|
||||
# Switch the swaps on
|
||||
swapon -p 100 /dev/zram0
|
Loading…
x
Reference in New Issue
Block a user