- free(s->pid_file);
- s->pid_file = fn;
- }
-
- } else if (state == DESCRIPTION) {
-
- /* Try to parse Red Hat style description
- * continuation */
-
- size_t k = strlen(t);
- char *j;
-
- if (t[k-1] == '\\')
- t[k-1] = 0;
- else
- state = NORMAL;
-
- if ((j = strstrip(t)) && *j) {
- char *d = NULL;
-
- if (chkconfig_description)
- d = strjoin(chkconfig_description, " ", j, NULL);
- else
- d = strdup(j);
-
- if (!d) {
- r = -ENOMEM;
- goto finish;
- }
-
- free(chkconfig_description);
- chkconfig_description = d;
- }
-
- } else if (state == LSB || state == LSB_DESCRIPTION) {
-
- if (startswith_no_case(t, "Provides:")) {
- char *i, *w;
- size_t z;
-
- state = LSB;
-
- FOREACH_WORD_QUOTED(w, z, t+9, i) {
- char *n, *m;
-
- if (!(n = strndup(w, z))) {
- r = -ENOMEM;
- goto finish;
- }
-
- r = sysv_translate_facility(n, path_get_file_name(path), &m);
- free(n);
-
- if (r < 0)
- goto finish;
-
- if (r == 0)
- continue;
-
- if (unit_name_to_type(m) == UNIT_SERVICE)
- r = unit_merge_by_name(u, m);
- else
- /* NB: SysV targets
- * which are provided
- * by a service are
- * pulled in by the
- * services, as an
- * indication that the
- * generic service is
- * now available. This
- * is strictly
- * one-way. The
- * targets do NOT pull
- * in the SysV
- * services! */
- r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, UNIT_WANTS, m, NULL, true);
-
- if (r < 0)
- log_error_unit(u->id,
- "[%s:%u] Failed to add LSB Provides name %s, ignoring: %s",
- path, line, m, strerror(-r));
-
- free(m);
- }
-
- } else if (startswith_no_case(t, "Required-Start:") ||
- startswith_no_case(t, "Should-Start:") ||
- startswith_no_case(t, "X-Start-Before:") ||
- startswith_no_case(t, "X-Start-After:")) {
- char *i, *w;
- size_t z;
-
- state = LSB;
-
- FOREACH_WORD_QUOTED(w, z, strchr(t, ':')+1, i) {
- char *n, *m;
-
- if (!(n = strndup(w, z))) {
- r = -ENOMEM;
- goto finish;
- }
-
- r = sysv_translate_facility(n, path_get_file_name(path), &m);
- if (r < 0) {
- log_error_unit(u->id,
- "[%s:%u] Failed to translate LSB dependency %s, ignoring: %s",
- path, line, n, strerror(-r));
- free(n);
- continue;
- }
-
- free(n);
-
- if (r == 0)
- continue;
-
- r = unit_add_dependency_by_name(u, startswith_no_case(t, "X-Start-Before:") ? UNIT_BEFORE : UNIT_AFTER, m, NULL, true);
-
- if (r < 0)
- log_error_unit(u->id, "[%s:%u] Failed to add dependency on %s, ignoring: %s",
- path, line, m, strerror(-r));
-
- free(m);
- }
- } else if (startswith_no_case(t, "Default-Start:")) {
- char *k, *d;
-
- state = LSB;
-
- k = delete_chars(t+14, WHITESPACE "-");
-
- if (k[0] != 0) {
- if (!(d = strdup(k))) {
- r = -ENOMEM;
- goto finish;
- }
-
- free(s->sysv_runlevels);
- s->sysv_runlevels = d;
- }
-
- } else if (startswith_no_case(t, "Description:")) {
- char *d, *j;
-
- state = LSB_DESCRIPTION;
-
- if ((j = strstrip(t+12)) && *j) {
- if (!(d = strdup(j))) {
- r = -ENOMEM;
- goto finish;
- }
- } else
- d = NULL;
-
- free(long_description);
- long_description = d;
-
- } else if (startswith_no_case(t, "Short-Description:")) {
- char *d, *j;
-
- state = LSB;
-
- if ((j = strstrip(t+18)) && *j) {
- if (!(d = strdup(j))) {
- r = -ENOMEM;
- goto finish;
- }
- } else
- d = NULL;
-
- free(short_description);
- short_description = d;
-
- } else if (state == LSB_DESCRIPTION) {
-
- if (startswith(l, "#\t") || startswith(l, "# ")) {
- char *j;
-
- if ((j = strstrip(t)) && *j) {
- char *d = NULL;
-
- if (long_description)
- d = strjoin(long_description, " ", t, NULL);
- else
- d = strdup(j);
-
- if (!d) {
- r = -ENOMEM;
- goto finish;
- }
-
- free(long_description);
- long_description = d;
- }
-
- } else
- state = LSB;
- }
- }
- }
-
- if ((r = sysv_exec_commands(s, supports_reload)) < 0)
- goto finish;
-
- if (s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) {
- /* If there a runlevels configured for this service
- * but none of the standard ones, then we assume this
- * is some special kind of service (which might be
- * needed for early boot) and don't create any links
- * to it. */
-
- UNIT(s)->default_dependencies = false;