Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 2bdba7a

Browse files
committed
add flathub (user) repo by default
this commit enables the flathub repository at user level for flatpak, enabling gnome-software to provide all apps available on flathub by default. Signed-off-by: Simental Magana, Marcos <marcos.simental.magana@intel.com>
1 parent 03c49f0 commit 2bdba7a

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

clr-init-flathub-repo

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2018 Intel Corporation
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
#
23+
24+
if flatpak remotes | grep "flathub" ; then
25+
exit 0
26+
fi
27+
28+
# check for proxy setup
29+
proxy_mode=$(gsettings get org.gnome.system.proxy mode)
30+
if [[ proxy_mode == 'manual' ]]; then
31+
https_proxy="$(gsettings get org.gnome.system.proxy.https host):$(gsettings get org.gnome.system.proxy.https port)"
32+
fi
33+
34+
# check for network availability prior to run the repo init command
35+
SECONDS=0
36+
while ! networkctl --no-legend list | grep -q configured ; do
37+
if [ $SECONDS -gt 60 ] ; then
38+
echo "Network timeout: unable to init flahub repository"
39+
exit 1 ;
40+
fi
41+
sleep 5 ;
42+
done
43+
44+
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

meson.build

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ bindir = get_option('bindir')
1111
xdgdir = join_paths(datadir, 'xdg')
1212
schemasdir = join_paths(datadir, 'glib-2.0', 'schemas')
1313
systemddir = join_paths(prefix, 'lib', 'systemd')
14+
libexecdir = join_paths(prefix, get_option('libexecdir'))
1415

1516
desktop_conf = configuration_data()
1617
desktop_conf.set('prefix', prefix)
1718

19+
configure_file(
20+
input: 'org.clearlinux.initFlathubRepo.desktop.in',
21+
output: 'org.clearlinux.initFlathubRepo.desktop',
22+
configuration: desktop_conf,
23+
install_dir: join_paths(xdgdir, 'autostart')
24+
)
25+
1826
configure_file(
1927
input: 'clr-desktop-files.desktop.in',
2028
output: 'clr-desktop-files.desktop',
@@ -27,5 +35,10 @@ install_data(
2735
install_dir : bindir
2836
)
2937

38+
install_data(
39+
'clr-init-flathub-repo',
40+
install_dir : libexecdir
41+
)
42+
3043
subdir('schemas')
3144
subdir('logind.conf.d')
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Desktop Entry]
2+
Name=Enable flathub (user) repository by default on flatpak
3+
Comment=Provide an out-of-the-box gnome-software experience
4+
Exec=@prefix@/libexec/clr-init-flathub-repo
5+
Terminal=false
6+
Type=Application
7+
Categories=
8+
NoDisplay=true
9+
OnlyShowIn=GNOME;

0 commit comments

Comments
 (0)