hal/tools Makefile.am, 1.10, 1.11 fstab-sync.8.in, NONE,
1.1 fstab-sync.c, 1.22, 1.23
David Zeuthen
david at freedesktop.org
Thu Oct 14 11:37:31 PDT 2004
- Previous message: hal/hald device_info.c,1.15,1.16
- Next message: hal/po da.po,1.4,1.5 de.po,1.5,1.6 fr.po,1.4,1.5 nl.po,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv19112/tools
Modified Files:
Makefile.am fstab-sync.c
Added Files:
fstab-sync.8.in
Log Message:
2004-10-14 David Zeuthen <davidz at redhat.com>
* configure.in: Add fstab-sync.8 to AC_OUTPUT
* doc/conf/storage-non-fixed.fdi: New file, example
* doc/conf/storage-skip-all.fdi: New file, example
* doc/conf/Makefile.am: Dist and install two new .fdi files
* fdi/90defaultpolicy/storage-policy.fdi: Fix a typo in a comment
* hald/device_info.c:
(my_alphasort): New function
(scan_fdi_files): Use my_alphasort to sort in the right order. Process
all .fdi files instead of bailing out on the first match.
* hald/linux/osspec.c:
(get_selinux_removable_context): New function, copied over from
tools/fstab-sync.c (not currently used)
(osspec_probe): Use get_selinux_removable_context (not currently used)
* libhal-storage/libhal-storage.c:
(hal_drive_policy_get_mount_options): Check if mount_option property
is actually FALSE.
(hal_volume_policy_get_mount_options): Same
* libhal/libhal.c:
(hal_free_property_set): Check if object to free is NULL and just
return. Allows hal_free_property_set (NULL).
* tools/Makefile.am: Add rules for building fstab-sync.8 man page
* tools/fstab-sync.8.in: New file
* tools/fstab-sync.c: Much rewritten to use libhal-storage and the new
policy properties. See diff for details.
Index: Makefile.am
===================================================================
RCS file: /cvs/hal/hal/tools/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am 29 Aug 2004 22:31:39 -0000 1.10
+++ Makefile.am 14 Oct 2004 18:37:28 -0000 1.11
@@ -6,7 +6,7 @@
-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
-DPACKAGE_BIN_DIR=\""$(bindir)"\" \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
- -I$(top_srcdir) \
+ -I$(top_srcdir) -I$(top_srcdir)/libhal \
@PACKAGE_CFLAGS@
bin_PROGRAMS = lshal hal-get-property hal-set-property
@@ -22,11 +22,7 @@
hal_set_property_LDADD = @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la
fstab_sync_SOURCES = fstab-sync.c
-fstab_sync_LDADD = -lpopt $(top_builddir)/libhal/libhal.la
-
-if HAVE_SELINUX
-fstab_sync_LDADD += -lselinux
-endif
+fstab_sync_LDADD = -lpopt $(top_builddir)/libhal/libhal.la $(top_builddir)/libhal-storage/libhal-storage.la
if FSTAB_SYNC_ENABLED
install-data-local :
@@ -35,8 +31,14 @@
uninstall-local :
- rm -f $(DESTDIR)$(SYSCONFDIR)/hal/device.d/50-fstab-sync.hal
+
+MAN_IN_FILES = fstab-sync.8.in
+man_MANS = fstab-sync.8
+
endif
## FSTAB_SYNC_ENABLED end
+EXTRA_DIST=$(man_MANS) $(MAN_IN_FILES)
+
clean-local :
rm -f *~
--- NEW FILE: fstab-sync.8.in ---
.\"
.\" fstab-sync manual page.
.\" Copyright (C) 2004 Red Hat, Inc.
.\"
.TH fstab-sync 8
.SH NAME
fstab-sync \- Update the
.B /etc/fstab
file in response to HAL events
.SH SYNOPSIS
.PP
.B fstab-sync
[-cv?] [-a|--add UDI] [-r|--remove UDI] [-c|--clean]
[-v|--verbose] [-?|--help] [--usage]
.SH DESCRIPTION
This program serves one major purpose: Update the file systems table file
.B /etc/fstab
and create/remove mount points in
.B /media
in response to HAL events. This program is usually never run directly
from a shell; instead it is invoked as a callout from the
.B @SYSCONFDIR@/hal/device.d
directory by the HAL daemon.
.PP
Additionally, this program offers an option of removing any trace of
its previous actions from the file systems table file. Specifically
this happens when invoked by the HAL daemon for the root computer
device object which only happens when the HAL daemon is starting
up. Thus, when starting the HAL daemon, the
.B /etc/fstab
file will be completely sanitized, e.g. all entries previously added
by the
.B fstab-sync
program will be removed. When probing for hardware during the
startup of the HAL daemon, the
.B fstab-sync
program will be invoked several times to add new entries to the
.B /etc/fstab
file.
.PP
All entries added to
.B /etc/fstab
by
.B fstab-sync
can be identified by the use of the option
.B managed
in the options field. This option is a no-op; it is only used to uniquely
identify entries added by the
.B fstab-sync
program.
.PP
When the
.B /etc/fstab
file is written by
.B fstab-sync,
a comment with a link to this manual page is added to the file.
.SH CONTROLLING WHAT ENTRIES TO ADD
The
.B fstab-sync
program relies on properties on the relevant HAL device objects in
order to determine if and how an entry to the
.B /etc/fstab
file should be added. Specifically, entries are added for hal device
objects of respectively capability
.B storage
and
.B volume
only if appropriate
.B storage.policy
and
.B volume.policy
properties are set. Also, the
.B storage.policy.default
properties on the root computer device object are taken into account.
See the HAL specification on
.B http://freedesktop.org/Software/hal
for more information.
.PP
By default, the
.B @DATADIR@/fdi/90defaultpolicy/storage-policy.fdi
file specifies the policy - this file should never be edited by the
system administrator as it might get updated by the OS vendor for security
updates. Instead, system- or site-specific rules can be put in
the
.B @DATADIR@/fdi/95userpolicy
directory.
.PP
A number of sample policy files for various uses should
be available in the
.B @DATADIR@/doc/hal- at VERSION@/conf
directory. For example, the policy file
.B storage-non-fixed.fdi
ensures that only fixed optical and floppy drives gets tagged as
mountable which ensures that e.g. hard disk partitions on a fixed disk
won't get added to the
.B /etc/fstab
file. Similarly the
.B storage-skip-all.fdi
file will ensure no entries are ever added.
.SH DISABLING FSTAB-SYNC
Automatic updates of the
.B /etc/fstab
file by the
.B fstab-sync
program from the HAL daemon can be disabled by changing the
.B 50-fstab-sync.hal
symlink in
.B @SYSCONFDIR@/hal/device.d
directory to point to
.B /bin/false
.
.SH OPTIONS
The following options are supported:
.TP
.I "--add=UDI"
Add an entry to the
.B /etc/fstab
file by giving a HAL Unique Device Identifier
.TP
.I "--remove=UDI"
Remove an entry from fstab by giving a HAL Unique Device Identifier
.TP
.I "--clean"
Clean all entries generated by
.B fstab-sync
from the
.B /etc/fstab
file
.TP
.I "--verbose"
Report detailed information about operation progress
.TP
.I "--usage"
Display brief usage message
.TP
.I "--help"
Show options
.SH LOCKING
The
.B fstab-sync
program uses
.BR flock (2)
for locking the
.B /etc/fstab
file when adding or removing entries. This happens when the HAL daemon
starts up, when there's a media change event or when a storage device
is hotplugged.
.SH SEE ALSO
.BR fstab (5),
.B http://freedesktop.org/Software/hal
.SH BUGS
One known bug is that the HAL daemon has to be running when cleaning
the
.B /etc/fstab
file. Please send bug reports to the appropriate distribution bug
tracker or the HAL mailing list - see
http://freedesktop.org/Software/HalTraces for more information.
Index: fstab-sync.c
===================================================================
RCS file: /cvs/hal/hal/tools/fstab-sync.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- fstab-sync.c 29 Sep 2004 14:28:33 -0000 1.22
+++ fstab-sync.c 14 Oct 2004 18:37:28 -0000 1.23
@@ -1,4 +1,3 @@
-/* -*- mode: C; c-file-style: "gnu" -*- */
/* Copyright 2004 Red Hat, Inc.
*
* This software may be freely redistributed under the terms of the GNU
@@ -62,6 +61,7 @@
#define DBUS_API_SUBJECT_TO_CHANGE
#include "libhal/libhal.h"
+#include "libhal-storage/libhal-storage.h"
typedef int boolean;
[...1091 lines suppressed...]
+ fsy_use_managed = hal_drive_policy_default_use_managed_keyword (hal_context);
+ fstab_update_debug (_("%d: use_managed=%d\n"), pid, fsy_use_managed);
+ if (fsy_use_managed) {
+ if ((fsy_managed_primary = hal_drive_policy_default_get_managed_keyword_primary (hal_context)) == NULL)
+ goto out;
+ if ((fsy_managed_secondary = hal_drive_policy_default_get_managed_keyword_secondary (hal_context)) == NULL)
+ goto out;
+ fstab_update_debug (_("%d: managed primary='%s'\n"), pid, fsy_managed_primary);
+ fstab_update_debug (_("%d: managed secondary='%s'\n"), pid, fsy_managed_secondary);
+ }
+
if (!should_clean && (udi_to_add || udi_to_remove))
{
- LibHalFunctions halFunctions = { NULL };
-
- hal_context = hal_initialize (&halFunctions, 0);
-
if (udi_to_add)
retval = !add_udi (udi_to_add);
- Previous message: hal/hald device_info.c,1.15,1.16
- Next message: hal/po da.po,1.4,1.5 de.po,1.5,1.6 fr.po,1.4,1.5 nl.po,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list