initial support
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<services>
|
||||
<service name="tar_scm">
|
||||
<param name="scm">git</param>
|
||||
<param name="url">https://git.oerv.ac.cn/OERV-BSP-RPM/oerv-firstboot.git</param>
|
||||
<param name="revision">master</param>
|
||||
<param name="submodules">disable</param>
|
||||
<param name="version">_none_</param>
|
||||
<param name="exclude">*</param>
|
||||
<!-- <param name="extract">*</param> -->
|
||||
<param name="extract">*.spec</param>
|
||||
</service>
|
||||
</services>
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Before=systemd-user-sessions.service
|
||||
ConditionPathExists=/etc/systemd/system/multi-user.target.wants/oerv-firstboot.service
|
||||
Requires=-.mount
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/oerv-firstboot.sh
|
||||
ExecStartPost=/usr/bin/rm /etc/systemd/system/multi-user.target.wants/oerv-firstboot.service
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
echo "OERV first-time booting helper."
|
||||
ROOT_PART="$(findmnt -no SOURCE /)"
|
||||
ROOT_PARTNUM="$(lsblk -pr -no partn "${ROOT_PART}")"
|
||||
ROOT_DISK="$(lsblk -p -no pkname "${ROOT_PART}")"
|
||||
sgdisk -e "${ROOT_DISK}"
|
||||
echo "Yes" | parted ---pretend-input-tty "${ROOT_DISK}" resizepart "${ROOT_PARTNUM}" 100%
|
||||
partprobe
|
||||
resize2fs "\${ROOT_PART}"
|
||||
@@ -0,0 +1,34 @@
|
||||
Name: oerv-firstboot
|
||||
Version: 1.0.0
|
||||
Release: 0%{?dist}
|
||||
Summary: OERV first boot service
|
||||
|
||||
License: GPLv2
|
||||
URL: https://git.oerv.ac.cn/OERV-BSP/oerv-firstboot
|
||||
BuildArch: noarch
|
||||
Source0: oerv-firstboot.tar
|
||||
|
||||
Requires: coreutils
|
||||
|
||||
%description
|
||||
Helper scripts for first boot.
|
||||
Expands rootfs to whole disk.
|
||||
|
||||
%prep
|
||||
%setup -n %{name}
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
install -Dm 755 oerv-firstboot.sh %{buildroot}/%{_sbindir}/oerv-firstboot.sh
|
||||
install -Dm 644 oerv-firstboot.service %{buildroot}/etc/systemd/system/oerv-firstboot.service
|
||||
ln -s "/etc/systemd/system/oerv-firstboot.service" "%{buildroot}/etc/systemd/system/multi-user.target.wants/oerv-firstboot.service"
|
||||
|
||||
%files
|
||||
%{_sbindir}/oerv-firstboot.sh
|
||||
%{buildroot}/etc/systemd/system/oerv-firstboot.service
|
||||
%{buildroot}/etc/systemd/system/multi-user.target.wants/oerv-firstboot.service
|
||||
|
||||
%changelog
|
||||
* Fri Sep 05 2024 Hangfan Li <lihangfan@iscas.ac.cn>
|
||||
- Initilal RPM release
|
||||
Reference in New Issue
Block a user