Skip to content

Commit

Permalink
data: Remove all /var/tmp/flatpak-cache-* directories on boot
Browse files Browse the repository at this point in the history
No one is clearing those directories so they pile up and can take a
significant amount of disk space.

Resolves: flatpak#1119
Signed-off-by: Alberto Garcia <[email protected]>
  • Loading branch information
bertogg committed Nov 8, 2023
1 parent ec3989d commit 3b8260e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ service_in_files = $(NULL)
dbus_service_DATA = $(NULL)
systemdsystemunit_DATA = $(NULL)
systemduserunit_DATA = $(NULL)
dist_tmpfiles_DATA = $(NULL)
CLEANFILES += $(dbus_service_DATA)
CLEANFILES += $(systemduserunit_DATA)
EXTRA_DIST += $(service_in_files)
Expand Down
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,13 @@ AC_ARG_WITH([sysusersdir],
[with_sysusersdir='${prefix}/lib/sysusers.d'])
AC_SUBST([sysusersdir], [$with_sysusersdir])

AC_ARG_WITH([tmpfilesdir],
[AS_HELP_STRING([--with-tmpfilesdir=DIR],
[Directory for systemd tmpfiles.d configuration files (default=PREFIX/lib/tmpfiles.d)])],
[],
[with_tmpfilesdir='${prefix}/lib/tmpfiles.d'])
AC_SUBST([tmpfilesdir], [$with_tmpfilesdir])

AC_ARG_WITH(system-helper-user,
[AS_HELP_STRING([--with-system-helper-user=USERNAME],
[Name of the system helper user])],
Expand Down
2 changes: 2 additions & 0 deletions data/Makefile.am.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ introspection_DATA = \
data/org.freedesktop.portal.Flatpak.xml \
$(NULL)

dist_tmpfiles_DATA += data/tmpfiles.d/flatpak.conf

EXTRA_DIST += \
data/meson.build \
data/org.freedesktop.portal.Documents.xml \
Expand Down
4 changes: 4 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ install_data(
'org.freedesktop.portal.Flatpak.xml',
install_dir : get_option('datadir') / 'dbus-1' / 'interfaces',
)
install_data(
'tmpfiles.d/flatpak.conf',
install_dir : get_option('tmpfilesdir'),
)
2 changes: 2 additions & 0 deletions data/tmpfiles.d/flatpak.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This is a systemd tmpfiles.d configuration file
R! /var/tmp/flatpak-cache-*
6 changes: 6 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ option(
description : 'directory for systemd sysusers.d configuration files',
value : 'lib/sysusers.d'
)
option(
'tmpfilesdir',
type : 'string',
description : 'directory for systemd tmpfiles.d configuration files',
value : 'lib/tmpfiles.d'
)
option(
'tests',
type : 'boolean',
Expand Down
3 changes: 1 addition & 2 deletions sideload-repos-systemd/Makefile.am.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ systemduserunit_DATA += sideload-repos-systemd/flatpak-sideload-usb-repo.path
%.path: %.path.in config.log
$(AM_V_GEN) $(SED) -e "s|\@media_dir\@|$(RUN_MEDIA_DIR)|" $< > $@

tmpfilesdir = $(prefix)/lib/tmpfiles.d
dist_tmpfiles_DATA = sideload-repos-systemd/tmpfiles.d/flatpak-sideload-repos.conf
dist_tmpfiles_DATA += sideload-repos-systemd/tmpfiles.d/flatpak-sideload-repos.conf

endif

Expand Down
2 changes: 1 addition & 1 deletion sideload-repos-systemd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ configure_file(

install_data(
'tmpfiles.d/flatpak-sideload-repos.conf',
install_dir : 'lib/tmpfiles.d',
install_dir : get_option('tmpfilesdir'),
)

0 comments on commit 3b8260e

Please sign in to comment.