Compare commits
10 Commits
37a84864cf
...
04c4ed02cd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04c4ed02cd | ||
|
|
120047e2eb | ||
|
|
d95034acdb | ||
|
|
cefa1dcb2e | ||
|
|
b792a0b09c | ||
|
|
d723e12ef0 | ||
|
|
b80c15f78d | ||
|
|
9bfdc78ace | ||
|
|
4be2391c35 | ||
|
|
aac0531ad0 |
47
README.md
47
README.md
@ -2,29 +2,50 @@
|
|||||||
|
|
||||||
#### 介绍
|
#### 介绍
|
||||||
This is a systemd unit generator that enables swap on zram.
|
This is a systemd unit generator that enables swap on zram.
|
||||||
|
(With zram, there is no physical swap device. Part of the available RAM
|
||||||
#### 软件架构
|
is used to store compressed pages, essentially trading CPU cycles for memory.)
|
||||||
软件架构说明
|
To activate, install zram-generator-defaults subpackage.
|
||||||
|
|
||||||
|
|
||||||
#### 安装教程
|
#### 安装教程
|
||||||
|
|
||||||
1. xxxx
|
Install zram-generator rpm package:
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
yum install zram-generator
|
||||||
|
|
||||||
|
To install directly from sources, execute make build && sudo make install NOBUILD=true:
|
||||||
|
|
||||||
|
-zram-generator binary is installed in the systemd system generator directory (usually /usr/lib/systemd/system-generators/)
|
||||||
|
-zram-generator(8) and zram-generator.conf(5) manpages are installed into /usr/share/man/manN/, this requires ronn.
|
||||||
|
-units/systemd-zram-setup@.service is copied into the systemd system unit directory (usually /usr/lib/systemd/system/)
|
||||||
|
-zram-generator.conf.example is copied into /usr/share/doc/zram-generator/ You need though create your own config file at one of the locations listed above.
|
||||||
|
|
||||||
#### 使用说明
|
#### 使用说明
|
||||||
|
|
||||||
1. xxxx
|
A default config file may be located in /usr. This generator checks the following locations:
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
-/run/systemd/zram-generator.conf
|
||||||
|
-/etc/systemd/zram-generator.conf
|
||||||
|
-/usr/local/lib/systemd/zram-generator.conf
|
||||||
|
-/usr/lib/systemd/zram-generator.conf
|
||||||
|
… and the first file found in that list wins.
|
||||||
|
|
||||||
|
In addition, "drop-ins" will be loaded from .conf files in /etc/systemd/zram-generator.conf.d/, /usr/lib/systemd/zram-generator.conf.d/, etc.
|
||||||
|
|
||||||
|
The main configuration file is read before any of the drop-ins and has the lowest precedence; entries in the drop-in files override entries in the main configuration file.
|
||||||
|
|
||||||
|
See systemd.unit(5) for a detailed description of this logic.
|
||||||
|
|
||||||
|
See zram-generator.conf.example for a list of available settings.
|
||||||
|
|
||||||
#### 参与贡献
|
#### 参与贡献
|
||||||
|
|
||||||
1. Fork 本仓库
|
master分支使用最新的上游版本,如果检测到上游有最新版本发布,先形成issue后再提交对应PR更新,流程如下。
|
||||||
2. 新建 Feat_xxx 分支
|
1. 提交issue
|
||||||
3. 提交代码
|
2. Fork 本仓库
|
||||||
4. 新建 Pull Request
|
3. 新建 Feat_xxx 分支
|
||||||
|
4. 提交代码
|
||||||
|
5. 新建 Pull Request
|
||||||
|
|
||||||
|
|
||||||
#### 特技
|
#### 特技
|
||||||
|
|||||||
103
rust-zram-generator.spec
Normal file
103
rust-zram-generator.spec
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
%global crate zram-generator
|
||||||
|
|
||||||
|
Name: rust-%{crate}
|
||||||
|
Version: 1.1.2
|
||||||
|
Release: 4
|
||||||
|
Summary: Systemd unit generator for zram swap devices
|
||||||
|
|
||||||
|
License: MIT
|
||||||
|
URL: https://crates.io/crates/zram-generator
|
||||||
|
Source: %{crate}-%{version}.crate
|
||||||
|
Source1: zram-generator.conf
|
||||||
|
Source2: zram-generator-vendor.tar.gz
|
||||||
|
|
||||||
|
BuildRequires: rust-packaging rubygem-ronn
|
||||||
|
|
||||||
|
%global _description %{expand:
|
||||||
|
This is a systemd unit generator that enables swap on zram.
|
||||||
|
(With zram, there is no physical swap device. Part of the avaialable RAM
|
||||||
|
is used to store compressed pages, essentially trading CPU cycles for memory.)
|
||||||
|
}
|
||||||
|
|
||||||
|
%description %{_description}
|
||||||
|
|
||||||
|
%package -n %{crate}
|
||||||
|
Summary: %{summary}
|
||||||
|
Recommends: %{_sbindir}/zramctl
|
||||||
|
License: MIT
|
||||||
|
|
||||||
|
%description -n %{crate} %{_description}
|
||||||
|
|
||||||
|
%package -n %{crate}-defaults
|
||||||
|
Summary: Default configuration for %{crate}
|
||||||
|
Requires: %{crate} = %{version}-%{release}
|
||||||
|
Obsoletes: zram < 0.4-2
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description -n %{crate}-defaults
|
||||||
|
%{summary}.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{crate}-%{version} -p1
|
||||||
|
cp -a %{S:1} .
|
||||||
|
tar zxvf %{SOURCE2}
|
||||||
|
%cargo_prep
|
||||||
|
find %{_builddir} -type f -name 'Cargo.toml.orig' -exec rm -rf '{}' ';'
|
||||||
|
|
||||||
|
mkdir -p .cargo
|
||||||
|
cat >.cargo/config << EOF
|
||||||
|
|
||||||
|
[source.crates-io]
|
||||||
|
replace-with = "vendored-sources"
|
||||||
|
|
||||||
|
[source.vendored-sources]
|
||||||
|
directory = "vendor"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
%build
|
||||||
|
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
%cargo_build
|
||||||
|
%make_build SYSTEMD_SYSTEM_UNIT_DIR=%{_unitdir} SYSTEMD_SYSTEM_GENERATOR_DIR=%{_systemdgeneratordir} \
|
||||||
|
systemd-service man
|
||||||
|
|
||||||
|
%install
|
||||||
|
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
|
||||||
|
%cargo_install
|
||||||
|
|
||||||
|
mkdir -p %{buildroot}%{?_systemdgeneratordir}
|
||||||
|
cp -a $PWD/.cargo/bin %{buildroot}/usr/
|
||||||
|
mv -v %{buildroot}%{_bindir}/zram-generator %{buildroot}%{?_systemdgeneratordir}/
|
||||||
|
install -Dpm0644 -t %{buildroot}%{?_unitdir} units/systemd-zram-setup@.service
|
||||||
|
install -Dpm0644 -t %{buildroot}%{_prefix}/lib/systemd %{SOURCE1}
|
||||||
|
install -Dpm0644 -t %{buildroot}%{_mandir}/man8 man/zram-generator.8
|
||||||
|
install -Dpm0644 -t %{buildroot}%{_mandir}/man5 man/zram-generator.conf.5
|
||||||
|
rm -rf %{buildroot}%{cargo_registry}/%{crate}-%{version}
|
||||||
|
|
||||||
|
%files -n %{crate}
|
||||||
|
%license LICENSE
|
||||||
|
%doc zram-generator.conf.example
|
||||||
|
%doc README.md
|
||||||
|
%{?_systemdgeneratordir}/zram-generator
|
||||||
|
%{?_unitdir}/systemd-zram-setup@.service
|
||||||
|
%{_mandir}/man8/zram-generator.8*
|
||||||
|
%{_mandir}/man5/zram-generator.conf.5*
|
||||||
|
|
||||||
|
%files -n %{crate}-defaults
|
||||||
|
%{_prefix}/lib/systemd/zram-generator.conf
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Fri May 26 2023 duyiwei <duyiwei@kylinos.cn> - 1.1.2-4
|
||||||
|
- Fix build error with Rust 1.67
|
||||||
|
|
||||||
|
* Fri Dec 09 2022 dingdingaaaaa <dingziwei@kylinos.cn> - 1.1.2-3
|
||||||
|
- Enable debuginfo for fix strip
|
||||||
|
|
||||||
|
* Thu Sep 8 2022 duyiwei <duyiwei@kylinos.cn> - 1.1.2-2
|
||||||
|
- remove useless subpackage zram-generator-devel
|
||||||
|
|
||||||
|
* Tue Jul 19 2022 duyiwei <duyiwei@kylinos.cn> - 1.1.2-1
|
||||||
|
- upgrade to 1.1.2
|
||||||
|
|
||||||
|
* Tue May 10 2022 duyiwei <duyiwei@kylinos.cn> - 0.3.2-1
|
||||||
|
- Package init
|
||||||
BIN
zram-generator-1.1.2.crate
Normal file
BIN
zram-generator-1.1.2.crate
Normal file
Binary file not shown.
BIN
zram-generator-vendor.tar.gz
Normal file
BIN
zram-generator-vendor.tar.gz
Normal file
Binary file not shown.
8
zram-generator.conf
Normal file
8
zram-generator.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# This config file enables a /dev/zram0 device with the default settings:
|
||||||
|
# — size — same as available RAM or 8GB, whichever is less
|
||||||
|
# — compression — most likely lzo-rle
|
||||||
|
#
|
||||||
|
# To disable, uninstall zram-generator-defaults or create empty
|
||||||
|
# /etc/systemd/zram-generator.conf file.
|
||||||
|
[zram0]
|
||||||
|
zram-size = min(ram, 8192)
|
||||||
4
zram-generator.yaml
Normal file
4
zram-generator.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version_control: github
|
||||||
|
src_repo: systemd/zram-generator
|
||||||
|
tag_prefix: "v"
|
||||||
|
separator: "."
|
||||||
Loading…
x
Reference in New Issue
Block a user