Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Wasn't even build tested, apparently.
|
|
This still doesn't do a great job of handling errors, but at least the
user may see some reasonable information if they occur.
|
|
Since we can now have an arbitrary number of nodes pointing to the same
initd type, a reference count is added so that the initd is only
destroyed when there are no references left.
|
|
Currently, the entire initd structure is duplicated each time a list is
copied. Since the initd is not specific to each list, this could cause
problems where changing a value in one initd would not be reflected in
the equivalent initd in another list. This also wastes memory as each
initd duplicated when only one copy is needed.
This change introduces the initd_node type. It points to an initd type
and contains the list pointers for inclusion in an initd_list type.
The typical constructors and destructors have been added for handling
these types in lists.
Quite a few places needed to be changed where there were iterations over
lists. We should really add accessor functions and use those whenever
we need access to members of a list.
|
|
|
|
After readdir completes, errno is check to see if any errors were
produced. However, if readdir is successful, it will not change the
current errno value. Reset it before the loop to ensure any errors are
due to the readdir calls.
|
|
|
|
When an missing dependency from Should-Start or Should-Stop was
encountered, all the processing was being skipped instead just moving to
the next dependency.
|
|
The logic for writing new stop links was walking through the ordered
list backwards, causing the stop links to be created incorrectly.
|
|
|
|
The LSB says that the programs should live in /usr/lib/lsb, not
/usr/lib/initd. Whoops.
|
|
|
|
No need to have the release date recomputed every time someone runs
configure.
|
|
Trying to use the d_type field from the dirent structure returns
DT_UNKNOWN sometimes causing the pool to never be populated. Remove it
for now in favor of the more portable stat() usage.
|
|
The only sane way to handle the ChangeLog generation is to only create
it when we have a .git directory and srcdir != builddir.
|
|
In order to make the tests work when the build directory is not the
source directory, we always copy the service scripts to an init.d
directory in the build directory. This means we can drop some of the
hacks to try to get the rc symlinks correct.
|
|
This is more consistent with the initd libdir option.
|
|
Users will just have to pass the correct flags if they want an LSB
conforming installation. Guessing $exec_prefix to try to get the correct
initd libdir is too error prone.
|
|
Since the canonical location for install_initd and remove_initd is
/usr/lib/initd, the actual programs are installed there and symlinks
are placed in $sbindir.
The initd libdir, /usr/lib/initd, is made configurable, but defaults
to $exec_prefix/lib/initd to allow the package to be easily prefixed.
|
|
Added the COPYING, AUTHORS, NEWS and README files. The COPYING file is
standard GPLv2, which we will use for this package. Copyrights will be
added to individual source files later.
The NEWS and README files are currently empty, but will be populated
later. The INSTALL file will also be included in the tarball, but we'll
just use the standard GNU INSTALL file from automake.
|
|
The ChangeLog file will be generated from the git log at dist time and
included in the tarball.
|
|
It's nice to create relative symlinks from /lib/initd to /sbin so that
the link path is always correct no matter where the filesystems are
mounted. To accomplish this, a script abs2rel.sh has been added which
converts two directory paths to a relative path. This is used to find
the relative path between /lib/initd and /sbin.
|
|
When the user is installing links, they may not have the rc*.d
directories created yet. This changes the behavior to attempt to create
the directory if it doesn't exist.
|
|
In the typical install, we want the data (man pages) to go to /usr, but
the programs to go in the root directory. This sets $prefix and
$exec_prefix appropriately if they have not been set by the user.
|
|
The LSB specification says that the programs should be called from
/lib/initd/{install,remove}_initd, so we create symlinks in that
directory to be conformant.
|
|
Since initd_remove_recurse_deps already handles the current activity
level, we don't need to check it in the test. This removes some false
failures in the test.
|
|
Manual pages for install_initd and remove_initd have been added to the
repo. They're a little bare for now.
|
|
install_initd and remove_initd take the exact same actions, with the
exception of calling the dep handler for adding services or for
removing services. This factors those actions into a common function,
installrm_action, which takes a boolean indicating whether we are
installing or removing services.
|
|
The initd functions operate on service names rather than full paths, so
the directory names are stripped off. This is not quite correct as we
really want to just strip the init.d directory name from the beginning
of the path and leave the rest. However, it should work in practice as
only one init.d directory can be used and we expect it to be a flat
directory containing scripts.
|
|
Add a new function set_initd_dir() to find the init.d directory from a
combination of a previously set string (the -d parameter), the directory
names of the arguments, or the default init.d directory.
|
|
Some routines will be exactly the same between install_initd and
remove_initd. This splits them out into a common util.c file.
This also adds a new function, get_initd_dir, which wraps dirname, but
returns NULL instead of "." when there is no directory component.
|
|
Since the libinitd headers are used throughout the tree, we want to
avoid naming conflicts, such as util.h.
|
|
Rather than having all the programs include each header they need, just
have initd.h include all the headers that define interfaces in libinitd.
|
|
Added wrappers for the basename() and dirname() functions that handle
the copying of the strings correctly. The initd_parse routine has been
adjusted to use this wrapper instead of the libc version.
|
|
This allows the default init.d directory to be set from configure. By
default, it will be /etc/init.d.
|
|
Create the executable remove_initd for removing services using Linux
Standard Base (LSB) headers. It removes symlinks for use in a System-V
initialization scheme.
|
|
Create the executable install_initd for installing services using Linux
Standard Base (LSB) headers. It creates symlinks for use in a System-V
initialization scheme.
|
|
The dep removal logic was always adding the requested services to the
remove list, causing all links to be rewritten. Now, check if it's
active before adding it. This means that requesting to remove an
inactive script will just do nothing.
|
|
Fixed a bug where the removal process didn't actually include the
requested service in the set to be removed.
|
|
Previously, there was a single change field cstart/stop that was
overloaded to contain both installation and removal status. It was
difficult to differentiate between whether a service was to be removed,
to be installed, or unchanged.
This commit converts the change field into two dedicated fields,
instart/stop and rmstart/stop to differentiate the cases better.
|
|
There's no sane way to set the changed bits to active without destroying
valid deactived levels in some cases. Instead, we just have to rely on
the fact that they'll be correct already.
|
|
A few changes in the installrm functions:
- When removing an existing symlink, we clear the active bit for that
level.
- When installing a new link, we set the active bit for that level.
- Before installing a new link, we check that the script is supposed to
start in that level and that it's not marked for removal.
|
|
Added the target links, which cleans the existing rc links and recreates
them as they are originally.
|
|
|
|
Added the initd_clear_rc function as the complement to initd_set_rc.
It clears level bits from an rc type in the initd. Refactored the rc_t
evaluation into a separate function, initd_get_rc_from_key.
|
|
When told to remove services through initd_remove_recurse_deps, their
changed fields are cleared to indicate that they will no longer be
available. This is an improvement over the previous hack where the
active bits were being cleared and then restored at the end of the
function.
With the changed fields cleared, we can skip services that are currently
active, but will be going away in add_all_actives. This fixes a bug
where a service can be asked to be removed, but then added right back in
because it's currently active.
When each rc level is verified after recursion has completed, the added
services are checked to see if they are marked for removal. This fixes a
bug where a service was asked to be removed, but added back because it
was a dependency of another service. When each service is verified at
that level, it is marked to change to active.
Using the changed field clearing in remove_recurse_deps and the setting
in verify_level, we should be able to install and remove scripts just by
checking the changed field.
Finally, fixed two tests which were passing with false positives due to
these bugs.
|
|
To differentiate between currently active rc levels and to-be-changed
rc levels, new members cstart and cstop have been added to the initd_t
type. These will be used in the dep solver to test for deps that are
marked for removal.
|
|
Another active field will be added, so we need to allow initd_is_active
to differentiate between them. Just using the sk type is not enough, so
now it takes the key name, returning false if an invalid key type was
passed.
|
|
The recurse_deps functions are now consistent in returning errors. Since
there are valid cases where an empty list may be returned, an error is
only indicated by returning NULL. This means callers of recurse_deps
must check that the list is not empty before iterating the members.
|