summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2008-11-27Post-release version bumpHEADmasterDan Nicholson1-1/+1
2008-11-27Fix previous broken commitinitd-tools-0.1.3Dan Nicholson1-1/+1
Wasn't even build tested, apparently.
2008-11-02Report errors with more useful messagesDan Nicholson7-38/+41
This still doesn't do a great job of handling errors, but at least the user may see some reasonable information if they occur.
2008-11-02Add reference count to initd typeDan Nicholson3-3/+14
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.
2008-11-02Use nodes in list instead of duplicating all initd typesDan Nicholson14-61/+145
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.
2008-11-02Also reset errno for the symlink reading loopDan Nicholson1-0/+1
2008-11-02Reset errno before readdir to avoid false errorsDan Nicholson1-0/+1
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.
2008-09-07Post-release version bumpDan Nicholson1-1/+1
2008-09-01Fix handling of optional dependenciesinitd-tools-0.1.2DJ Lucas1-2/+4
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.
2008-09-01Correct stop link orderingDJ Lucas1-7/+2
The logic for writing new stop links was walking through the ordered list backwards, causing the stop links to be created incorrectly.
2008-08-31Post-release version bumpDan Nicholson1-1/+1
2008-08-31Correct the LSB location of the programsinitd-tools-0.1.1Dan Nicholson1-3/+3
The LSB says that the programs should live in /usr/lib/lsb, not /usr/lib/initd. Whoops.
2008-08-31Post-release version bumpDan Nicholson1-1/+1
2008-08-31Set release date statically in configureinitd-tools-0.1Dan Nicholson1-4/+4
No need to have the release date recomputed every time someone runs configure.
2008-08-31Tear out the buggy dirent d_type code for nowDan Nicholson1-7/+0
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.
2008-06-20Fix ChangeLog generation for distcheckDan Nicholson1-9/+9
The only sane way to handle the ChangeLog generation is to only create it when we have a .git directory and srcdir != builddir.
2008-06-17Fix tests when $srcdir != $builddirDan Nicholson10-23/+20
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.
2008-06-16Change the initd dir option to --with-initddirDan Nicholson1-6/+6
This is more consistent with the initd libdir option.
2008-06-16Drop the $exec_prefix hackeryDan Nicholson1-7/+1
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.
2008-06-16Install programs to initd libdir and make directory configurableDan Nicholson2-12/+19
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.
2008-06-16Add automake required files, including GPLv2 licenseDan Nicholson7-2/+343
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.
2008-06-16Add rules for generating ChangeLogDan Nicholson2-0/+19
The ChangeLog file will be generated from the git log at dist time and included in the tarball.
2008-06-16Create relative symlinks in /lib/initdDan Nicholson3-6/+94
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.
2008-06-12Create the rc*.d directories if necessary when creating linksDan Nicholson1-2/+14
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.
2008-06-11Set the default installation directories appropriatelyDan Nicholson2-1/+10
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.
2008-06-11Create links in $libdir/initd on installDan Nicholson2-0/+16
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.
2008-06-11test: Don't check active levels in the dep removal testDan Nicholson1-30/+0
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.
2008-06-11Add manual pages for install_initd and remove_initdDan Nicholson5-2/+90
Manual pages for install_initd and remove_initd have been added to the repo. They're a little bare for now.
2008-06-10Refactor common dependency and symlink handling into common routineDan Nicholson4-28/+46
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.
2008-06-10Only pass service basenames to the intid functionsDan Nicholson2-6/+14
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.
2008-06-10Use common set_initd_dir routine to determine init.d directoryDan Nicholson4-6/+50
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.
2008-06-04Split out common program functions into separate object fileDan Nicholson5-28/+55
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.
2008-06-04Rename libinitd headers with initd- prefix to avoid conflictsDan Nicholson17-41/+41
Since the libinitd headers are used throughout the tree, we want to avoid naming conflicts, such as util.h.
2008-06-04Include all the libinitd headers from initd.hDan Nicholson17-25/+9
Rather than having all the programs include each header they need, just have initd.h include all the headers that define interfaces in libinitd.
2008-06-04Add basename and dirname wrapper utilitiesDan Nicholson4-5/+65
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.
2008-06-03Define default init.d directoryDan Nicholson1-0/+10
This allows the default init.d directory to be set from configure. By default, it will be /etc/init.d.
2008-06-03Add remove_initd programDan Nicholson3-1/+124
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.
2008-06-03Add install_initd programDan Nicholson5-1/+128
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.
2008-05-29Don't add scripts to the remove list when they're not activeDan Nicholson1-4/+15
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.
2008-05-29Actually remove the requested servicesDan Nicholson1-1/+9
Fixed a bug where the removal process didn't actually include the requested service in the set to be removed.
2008-05-29Use two fields for storing installation/removal statusDan Nicholson5-52/+72
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.
2008-05-28verify_level: Don't set changed bits to activeDan Nicholson1-6/+0
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.
2008-05-28Handle rc bits more correctly when installing and removing linksDan Nicholson1-10/+38
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.
2008-05-28Allow easily recreating test linksDan Nicholson1-2/+5
Added the target links, which cleans the existing rc links and recreates them as they are originally.
2008-05-28Also allow dstart/dstop keys in initd_is_activeDan Nicholson1-0/+6
2008-05-28Add function initd_clear_rc and refactor with initd_set_rcDan Nicholson2-15/+49
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.
2008-05-28Use changed fields to fix dep solver in remove caseDan Nicholson3-45/+76
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.
2008-05-28Introduce rc change fields, cstart and cstopDan Nicholson3-2/+26
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.
2008-05-27initd_is_active: Take key type instead of sk typeDan Nicholson4-17/+29
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.
2008-05-26recurse_deps: Return NULL on errors, empty list is not errorDan Nicholson6-52/+56
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.