summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2017-07-16 17:24:34 +0200
committerJavier <dev.git@javispedro.com>2017-07-16 17:24:34 +0200
commit54e7d8476ca3b41cbb38226e58241e1920ad357a (patch)
tree0cb38942404ac0d8b3529f7c93958065edc1a4f8
parent48cf22d3af28386ad853c30d3e389570e3cdca6e (diff)
downloadvolumefs-54e7d8476ca3b41cbb38226e58241e1920ad357a.tar.gz
volumefs-54e7d8476ca3b41cbb38226e58241e1920ad357a.zip
rename to volumefs/userfs and add systemd unit files
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac3
-rw-r--r--packaging/volumefs.spec45
-rw-r--r--scripts/Makefile.am1
-rw-r--r--scripts/userfs.service10
-rwxr-xr-xscripts/volumefs.init4
-rw-r--r--scripts/volumefs.service11
-rw-r--r--src/Makefile.am14
-rw-r--r--src/userfs.c (renamed from src/usersfs.c)0
-rw-r--r--src/volumefs.c (renamed from src/volumesfs.c)2
10 files changed, 77 insertions, 15 deletions
diff --git a/Makefile.am b/Makefile.am
index dfa49b2..eda4c24 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,2 +1,2 @@
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = src
+SUBDIRS = src scripts
diff --git a/configure.ac b/configure.ac
index e7b717a..2c6e218 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ([2.69])
AC_INIT(volumefs, 1.0, javier@javispedro.com)
-AC_CONFIG_SRCDIR([src/volumesfs.c])
+AC_CONFIG_SRCDIR([src/volumefs.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([-Wall -Wno-extra-portability foreign])
@@ -22,6 +22,7 @@ PKG_CHECK_MODULES([UDISKS2], [udisks2])
AC_CONFIG_FILES([
Makefile
src/Makefile
+ scripts/Makefile
])
AC_OUTPUT
diff --git a/packaging/volumefs.spec b/packaging/volumefs.spec
index 49e8ec6..d5445df 100644
--- a/packaging/volumefs.spec
+++ b/packaging/volumefs.spec
@@ -8,16 +8,23 @@ URL: https://git.javispedro.com/cgit/volumefs.git/
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(fuse)
BuildRequires: pkgconfig(udisks2)
+%if 0%{?suse_version} >= 1210
+BuildRequires: systemd-rpm-macros
+%endif
%description
volumefs is a FUSE filesystem that will be automatically populated with
symlinks to all currently mounted external filesystems, as detected by
UDisks2.
-%package -n usersfs
-Summary: FUSE filesystem for showing ahome dirs of all users
+%package -n userfs
+Summary: FUSE filesystem for showing home dirs of all users
Group: System Environment/Base
+%description -n userfs
+userfs is a FUSE filesystem that will be automatically populated with
+symlinks to all the home directories of users defined in the current system.
+
%prep
%autosetup
@@ -27,14 +34,46 @@ Group: System Environment/Base
%install
%make_install
+install -D -m 644 scripts/volumefs.service %{buildroot}%{_unitdir}/volumefs.service
+install -D -m 644 scripts/userfs.service %{buildroot}%{_unitdir}/userfs.service
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
+%{_sbindir}/volumefs
+%{_unitdir}/volumefs.service
+
+%pre
+%service_add_pre volumefs.service
+
+%post
+%service_add_post volumefs.service
+
+%preun
+%service_del_preun volumefs.service
+
+%postun
+%service_del_postun volumefs.service
+
+%files -n userfs
+%defattr(-,root,root)
+%{_sbindir}/userfs
+%{_unitdir}/userfs.service
+
+%pre -n userfs
+%service_add_pre userfs.service
+
+%post -n userfs
+%service_add_post userfs.service
+
+%preun -n userfs
+%service_del_preun userfs.service
+
+%postun -n userfs
+%service_del_postun userfs.service
-%files -n usersfs
%changelog
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
new file mode 100644
index 0000000..3a3d7b7
--- /dev/null
+++ b/scripts/Makefile.am
@@ -0,0 +1 @@
+dist_noinst_DATA = volumefs.service userfs.service
diff --git a/scripts/userfs.service b/scripts/userfs.service
new file mode 100644
index 0000000..fe675ae
--- /dev/null
+++ b/scripts/userfs.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Populates /Users directory
+RequiresMountsFor=/etc
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/userfs -f -o allow_other -o auto_unmount /Users
+
+[Install]
+WantedBy=multi-user.target
diff --git a/scripts/volumefs.init b/scripts/volumefs.init
index dc80eed..6cc3cb9 100755
--- a/scripts/volumefs.init
+++ b/scripts/volumefs.init
@@ -9,8 +9,8 @@ depend()
start()
{
- /usr/sbin/volumesfs -o allow_other /Volumes
- /usr/sbin/usersfs -o allow_other /Users
+ /usr/sbin/volumefs -o allow_other /Volumes
+ /usr/sbin/userfs -o allow_other /Users
}
stop()
diff --git a/scripts/volumefs.service b/scripts/volumefs.service
new file mode 100644
index 0000000..dd8a194
--- /dev/null
+++ b/scripts/volumefs.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Populates /Volumes directory
+Requires=udisks2.service
+After=udisks2.service
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/volumefs -f -o allow_other -o auto_unmount /Volumes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/src/Makefile.am b/src/Makefile.am
index de90afd..801f704 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,9 +1,9 @@
-sbin_PROGRAMS = volumesfs usersfs
+sbin_PROGRAMS = volumefs userfs
-volumesfs_SOURCES = volumesfs.c
-volumesfs_CPPFLAGS = $(FUSE_CFLAGS) $(UDISKS2_CFLAGS)
-volumesfs_LDADD = $(FUSE_LIBS) $(UDISKS2_LIBS)
+volumefs_SOURCES = volumefs.c
+volumefs_CPPFLAGS = $(FUSE_CFLAGS) $(UDISKS2_CFLAGS)
+volumefs_LDADD = $(FUSE_LIBS) $(UDISKS2_LIBS)
-usersfs_SOURCES = usersfs.c
-usersfs_CPPFLAGS = $(FUSE_CFLAGS)
-usersfs_LDADD = $(FUSE_LIBS)
+userfs_SOURCES = userfs.c
+userfs_CPPFLAGS = $(FUSE_CFLAGS)
+userfs_LDADD = $(FUSE_LIBS)
diff --git a/src/usersfs.c b/src/userfs.c
index bb76ed1..bb76ed1 100644
--- a/src/usersfs.c
+++ b/src/userfs.c
diff --git a/src/volumesfs.c b/src/volumefs.c
index acf991b..bc36ba3 100644
--- a/src/volumesfs.c
+++ b/src/volumefs.c
@@ -93,7 +93,7 @@ static void volumesfs_destroy(void *user_data)
g_object_unref(client);
g_hash_table_destroy(mounts);
- g_object_unref(main_loop);
+ g_main_loop_unref(main_loop);
}
static int volumesfs_getattr(const char *path, struct stat *stbuf)