This article will describe installing and building Flatpak.
Flatpak is renamed from xdg-apps.
This is almost same with the way of Fedora 24.
Table of Contents
1 Install flatpak package
Install flatpak package from ppa repository according to flatpak.org.
$ sudo add-apt-repository -y ppa:alexlarsson/flatpak $ sudo apt update -y $ sudo apt install -y flatpak
This later is the same as the case of Fedora 24.
Following script will install org.gnome.gedit. Because org.gnome.Platform and org.gnome.Sdk have a problem, reinstall these for avoiding this problem.
#!/bin/sh sudo add-apt-repository -y ppa:alexlarsson/flatpak sudo apt update -y sudo apt install -y 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-apps org.gnome.gedit stable flatpak_user_install gnome org.gnome.Platform 3.20 flatpak_user_install gnome org.gnome.Sdk 3.20 sudo reboot
2 Build application
This is the same as the case of Fedora 24. This article writes build script only.
2.1 Building application without flatpak build (Not recommended)
#!/bin/sh # Create directory for this package. mkdir shell mkdir shell/files mkdir shell/files/bin mkdir shell/export # Create the command in this package. cat <<EOF > shell/files/bin/shell.sh #!/bin/sh if [ \$# -eq 0 ]; then PS1="shell> " /bin/sh else echo "shell> \$@" eval "\$@" fi EOF chmod a+x shell/files/bin/shell.sh # Create the metadata in this package. cat <<EOF > shell/metadata [Application] name=com.example.shell runtime=org.gnome.Platform/x86_64/3.20 command=shell.sh [Context] filesystems=host; EOF # Create repository. flatpak build-export repo shell # Install this package to user. flatpak --user remote-add --no-gpg-verify example-repo repo flatpak --user install example-repo com.example.shell
2.2 Building application with flatpak build (Recommended)
#!/bin/sh # Initialize flatpak build flatpak build-init tetris com.hiroom2.tetris org.gnome.Sdk \ org.gnome.Platform 3.20 # Download source code git clone https://github.com/hiroom2/tetris-sdl-and-ncurses cd tetris-sdl-and-ncurses/ # Build source code via flatpak build flatpak build ../tetris make all install DESTDIR=/app cd .. # Finalize flatpak build flatpak build-finish tetris --command=ncurses # Create repository. flatpak build-export repo tetris # Install this package to user. flatpak --user remote-add --no-gpg-verify tetris-repo repo flatpak --user install tetris-repo com.hiroom2.tetris