This article will describe porting Flatpak from Fedora 25 to OpenSUSE 13. But Flatpak needs kernel 4.0 or later while OpenSUSE has kernel 3.16, use kernel 4.4 in OpenSUSE Leap 42.2. You can also port Flatpak from Fedora 25 to OpenSUSE Leap 42.2.
Table of Contents
1 Install OpenSUSE Leap 42.2's kernel
Install kernel-default-4.4.36-8.1.x86_64.rpm in OpenSUSE Leap 42.2. Please prepare LiveDVD or LiveUSB for rescue boot failure. You can revert to OpenSUSE 13's kernel with installing kernel-desktop.
> L=http://download.opensuse.org/update/leap/42.2/ > wget -q ${L}/oss/x86_64/kernel-default-4.4.36-8.1.x86_64.rpm > sudo zypper -n in kernel-default-4.4.36-8.1.x86_64.rpm > sudo reboot
2 rpmbuild configuration
Install rpm-build and patterns-openSUSE-devel_basis.
> sudo zypper -n in rpm-build patterns-openSUSE-devel_basis
3 Install ostree
This article uses the following variables.
> F="https://dl.fedoraproject.org/pub/fedora/linux/releases/25" > B="BuildRequires:" > R="Requires:"
Download ostree src.rpm from Fedora 25.
> wget -q ${F}/Everything/source/tree/Packages/o/ostree-2016.12-1.fc25.src.rpm > rpm -i ostree-2016.12-1.fc25.src.rpm > cd ~/rpmbuild
Disable selinux. Change package name from Fedora 25 to OpenSUSE 13.
> sed -e "s/^$B\(.*\)pkgconfig(libselinux).*//g" \ -e "s;^$B\(.*\)/usr/bin/g-ir-scanner;$B\1gobject-introspection-devel;g" \ -e "s/^$R\(.*\)systemd-units/$R\1systemd/g" \ -e 's/--with-selinux/--without-selinux/g' \ -i SPECS/ostree.spec
Install BuildRequires packages.
> sudo zypper -n in $(rpmspec -q SPECS/ostree.spec --buildrequires)
Build and install ostree.
> rpmbuild -ba SPECS/ostree.spec > sudo zypper -n in RPMS/x86_64/ostree-*.rpm > cd
4 Install bubblewrap
This article uses the following variables.
> F="https://dl.fedoraproject.org/pub/fedora/linux/releases/25" > B="BuildRequires:" > R="Requires:"
Download bubblewrap src.rpm from Fedora 25.
> wget -q ${F}/Everything/source/tree/Packages/b/bubblewrap-0.1.3-2.fc25.src.rpm > rpm -i bubblewrap-0.1.3-2.fc25.src.rpm > cd ~/rpmbuild
Disable selinux. Change package name from Fedora 25 to OpenSUSE 13. Change undefined rpm macro to command.
> sed -e "s;^$B\(.*\)docbook-style-xsl;$B\1docbook-xsl-stylesheets;g" \ -e 's/^%configure \(.*\)/%configure --disable-selinux \1/g' \ -e 's/^%make_build/%{__make} -O %{?_smp_mflags}/g' \ -i SPECS/bubblewrap.spec
Install BuildRequires packages.
> sudo zypper -n in $(rpmspec -q SPECS/bubblewrap.spec --buildrequires)
Build and install bubblewrap.
> rpmbuild -ba SPECS/bubblewrap.spec > sudo zypper -n in RPMS/x86_64/bubblewrap-*.rpm > cd
5 Install flatpak
This article uses the following variables.
> F="https://dl.fedoraproject.org/pub/fedora/linux/releases/25" > B="BuildRequires:" > R="Requires:"
Download flatpak src.rpm from Fedora 25.
> wget -q ${F}/Everything/source/tree/Packages/f/flatpak-0.6.13-1.fc25.src.rpm > rpm -i flatpak-0.6.13-1.fc25.src.rpm > cd ~/rpmbuild
Change package name from Fedora 25 to OpenSUSE 13. Change undefined rpm macro to command.
> sed -e "s;^$B\(.*\)/usr/bin/xmlto;$B\1xmlto;g" \ -e "s;^$B\(.*\)/usr/bin/xsltproc;$B\1libxslt-tools;g" \ -e "s;^$B\(.*\)docbook-style-xsl;$B\1docbook-xsl-stylesheets;g" \ -e "s/^$B\(.*\)pkgconfig(libelf).*/$B\1libelf-devel/g" \ -e "s;^$R\(.*\)/usr/bin/tar;$R\1/bin/tar;g" \ -e 's;%{_pkgdocdir};/usr/share/doc/%{name};g' \ -e 's;%{_docdir}/%{name};/usr/share/doc/%{name};g' \ -e 's;%{_userunitdir};/usr/lib/systemd/user;g' \ -e 's/^%make_build/%{__make} -O %{?_smp_mflags}/g' \ -i SPECS/flatpak.spec
Create patch for no soup-autocleanups.h environment.
> P=SOURCES/autocleanups.patch > echo "diff -uprN a/common/flatpak-utils.h b/common/flatpak-utils.h" > $P > echo "--- a/common/flatpak-utils.h 2016-10-25 17:25:46.000000000 +0900" >> $P > echo "+++ b/common/flatpak-utils.h 2016-12-30 15:40:13.400390490 +0900" >> $P > echo "@@ -416,6 +416,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRep" >> $P > echo " G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupSession, g_object_unref)" >> $P > echo " G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupMessage, g_object_unref)" >> $P > echo " G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupRequest, g_object_unref)" >> $P > echo "+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupRequestHTTP, g_object_unref)" >> $P > echo " G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupURI, soup_uri_free)" >> $P > echo " #endif" >> $P > echo " " >> $P > sed -e \ "s/^$B libxslt-tools/$B libxslt-tools\nPatch0: autocleanups.patch/g" \ -e 's/^%setup -q/%setup -q\n%patch0 -p1/g' \ -i SPECS/flatpak.spec
Remove libelf0-devel which conflicts with libelf-devel. Install BuildRequires packages.
> sudo zypper -n rm libelf0-devel > sudo zypper -n in $(rpmspec -q SPECS/flatpak.spec --buildrequires)
Build and install flatpak.
> rpmbuild -ba SPECS/flatpak.spec > sudo zypper -n in RPMS/x86_64/flatpak-*.rpm > cd
6 Run flatpak
Install org.gnome.gedit with flatpak.
wget https://sdk.gnome.org/keys/gnome-sdk.gpg flatpak --user remote-add --gpg-import=gnome-sdk.gpg gnome \ https://sdk.gnome.org/repo/ flatpak --user remote-add --gpg-import=gnome-sdk.gpg gnome-apps \ https://sdk.gnome.org/repo-apps/ flatpak_user_install() { flatpak --user list --runtime --app | grep ${2} > /dev/null && return 0 while : ; do flatpak --user install $@ & pid=$! sleep 300 ps -p ${pid} | awk '{ print $1 }' | grep ${pid} > /dev/null || break sudo kill -KILL ${pid} done } flatpak_user_install gnome org.gnome.Platform 3.22 flatpak_user_install gnome org.gnome.Sdk 3.22 flatpak --user install gnome-apps org.gnome.gedit stable
org.gnome.gedit can be done on KDE.
> flatpak run org.gnome.gedit
7 Script for installing flatpak
The following script will install ostree, bubblewrap and flatpak.
#!/bin/sh F="https://dl.fedoraproject.org/pub/fedora/linux/releases/25" B="BuildRequires:" R="Requires:" opensuse_install_ostree() { wget -q ${F}/Everything/source/tree/Packages/o/ostree-2016.12-1.fc25.src.rpm rpm -i ostree-2016.12-1.fc25.src.rpm cd ~/rpmbuild sed -e "s/^$B\(.*\)pkgconfig(libselinux).*//g" \ -e "s;^$B\(.*\)/usr/bin/g-ir-scanner;$B\1gobject-introspection-devel;g" \ -e "s/^$R\(.*\)systemd-units/$R\1systemd/g" \ -e 's/--with-selinux/--without-selinux/g' \ -i SPECS/ostree.spec sudo zypper -n in $(rpmspec -q SPECS/ostree.spec --buildrequires) rpmbuild -ba SPECS/ostree.spec sudo zypper -n in RPMS/x86_64/ostree-*.rpm cd } opensuse_install_bubblewrap() { wget -q ${F}/Everything/source/tree/Packages/b/bubblewrap-0.1.3-2.fc25.src.rpm rpm -i bubblewrap-0.1.3-2.fc25.src.rpm cd ~/rpmbuild sed -e "s;^$B\(.*\)docbook-style-xsl;$B\1docbook-xsl-stylesheets;g" \ -e 's/^%configure \(.*\)/%configure --disable-selinux \1/g' \ -e 's/^%make_build/%{__make} -O %{?_smp_mflags}/g' \ -i SPECS/bubblewrap.spec sudo zypper -n in $(rpmspec -q SPECS/bubblewrap.spec --buildrequires) rpmbuild -ba SPECS/bubblewrap.spec sudo zypper -n in RPMS/x86_64/bubblewrap-*.rpm cd } opensuse_install_flatpak() { wget -q ${F}/Everything/source/tree/Packages/f/flatpak-0.6.13-1.fc25.src.rpm rpm -i flatpak-0.6.13-1.fc25.src.rpm cd ~/rpmbuild sed -e "s;^$B\(.*\)/usr/bin/xmlto;$B\1xmlto;g" \ -e "s;^$B\(.*\)/usr/bin/xsltproc;$B\1libxslt-tools;g" \ -e "s;^$B\(.*\)docbook-style-xsl;$B\1docbook-xsl-stylesheets;g" \ -e "s/^$B\(.*\)pkgconfig(libelf).*/$B\1libelf-devel/g" \ -e "s;^$R\(.*\)/usr/bin/tar;$R\1/bin/tar;g" \ -e 's;%{_pkgdocdir};/usr/share/doc/%{name};g' \ -e 's;%{_docdir}/%{name};/usr/share/doc/%{name};g' \ -e 's;%{_userunitdir};/usr/lib/systemd/user;g' \ -e 's/^%make_build/%{__make} -O %{?_smp_mflags}/g' \ -i SPECS/flatpak.spec P=SOURCES/autocleanups.patch echo "diff -uprN a/common/flatpak-utils.h b/common/flatpak-utils.h" > $P echo "--- a/common/flatpak-utils.h 2016-10-25 17:25:46.000000000 +0900" >> $P echo "+++ b/common/flatpak-utils.h 2016-12-30 15:40:13.400390490 +0900" >> $P echo "@@ -416,6 +416,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRep" >> $P echo " G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupSession, g_object_unref)" >> $P echo " G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupMessage, g_object_unref)" >> $P echo " G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupRequest, g_object_unref)" >> $P echo "+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupRequestHTTP, g_object_unref)" >> $P echo " G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupURI, soup_uri_free)" >> $P echo " #endif" >> $P echo " " >> $P sed -e \ "s/^$B libxslt-tools/$B libxslt-tools\nPatch0: autocleanups.patch/g" \ -e 's/^%setup -q/%setup -q\n%patch0 -p1/g' \ -i SPECS/flatpak.spec sudo zypper -n rm libelf0-devel sudo zypper -n in $(rpmspec -q SPECS/flatpak.spec --buildrequires) # automake-1.5 might be needed but not used in this time. rpmbuild -ba SPECS/flatpak.spec sudo zypper -n in RPMS/x86_64/flatpak-*.rpm cd } sudo zypper -n in rpm-build patterns-openSUSE-devel_basis opensuse_install_ostree opensuse_install_bubblewrap opensuse_install_flatpak