User Tools

Site Tools


software:switch:fedora_packaging_test

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

software:switch:fedora_packaging_test [2019/08/31 04:47] (current)
chris created
Line 1: Line 1:
 +===== What is this? =====
 +An attempt to package as much as possible of the files of Fedora/switch. Could make deployment easier, replaying versions, rollbacks.
  
 +===== Simple packaging setup =====
 +I use noarch for building.  One can build the rpms for example on Fedora/x86_64 or rhel7/x86_64 and later install them on switch/aarch64. Used a KVM guest with RHEL7 for the following.
 +
 +<code>
 +### acting as root
 +[root@rhel7u4a ~]# yum -y install rpm-build
 +[root@rhel7u4a ~]# useradd -m chris
 +[root@rhel7u4a ~]# su - chris
 +
 +### acting as user from here.
 +[chris@rhel7u4a ~]$ echo '%_topdir /home/chris/rpmbuild' >~/.rpmmacros
 +[chris@rhel7u4a ~]$ mkdir -p ~/rpmbuild/SPECS
 +[chris@rhel7u4a ~]$ cd ~/rpmbuild
 +
 +# creating a sample specfile
 +[chris@rhel7u4a rpmbuild]$ cat >SPECS/test.spec<<EOT
 +Name: test
 +Version: 0.1
 +Release: 1
 +License: GPL2
 +Group: Applications/System
 +BuildArch: noarch
 +Summary: test for packaging files
 +
 +%description
 +Brief description of software package.
 +
 +%prep
 +
 +%build
 +
 +%install
 +mkdir -p %{buildroot}/usr/dir1
 +cp ./usr/dir1/* %buildroot/usr/dir1/
 +
 +%clean
 +
 +%files
 +/usr/*
 +EOT
 +
 +# deploying example files to package
 +[chris@rhel7u4a rpmbuild]$ mkdir -p BUILD/usr/dir1
 +[chris@rhel7u4a rpmbuild]$ echo hugo >BUILD/usr/dir1/file0
 +
 +# building
 +[chris@rhel7u4a rpmbuild]$ rpmbuild -bb SPECS/test.spec
 +[..]
 +Wrote: /home/chris/rpmbuild/RPMS/noarch/test-0.1-1.noarch.rpm
 +Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.GUsgLG
 ++ umask 022
 ++ cd /home/chris/rpmbuild/BUILD
 ++ exit 0
 +[chris@rhel7u4a rpmbuild]$
 +
 +### as root
 +[root@rhel7u4a rpmbuild]# rpm -ivh /home/chris/rpmbuild/RPMS/noarch/test-0.1-1.noarch.rpm
 +[root@rhel7u4a rpmbuild]# rpm -ql test
 +</code>
 +
 +===== advanced =====
 +<code>
 +%pre    executed just before the package is installed on the target system.
 +%post   executed just after the package is installed on the target system.
 +%preun  executed just before the package is uninstalled from the target system.
 +%postun executed just after the package is uninstalled from the target system.
 +</code>
software/switch/fedora_packaging_test.txt ยท Last modified: 2019/08/31 04:47 by chris