rc-local-generator.c revision 49e942b2bc9fdedba79cd266a076ce9c9d91fc13
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering This file is part of systemd.
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering Copyright 2010 Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering Copyright 2011 Michal Schmidt
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering systemd is free software; you can redistribute it and/or modify it
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering under the terms of the GNU General Public License as published by
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering the Free Software Foundation; either version 2 of the License, or
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering (at your option) any later version.
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering systemd is distributed in the hope that it will be useful, but
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering General Public License for more details.
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering You should have received a copy of the GNU General Public License
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#define SCRIPT_PATH "/etc/init.d/boot.local"
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringstatic int add_symlink(const char *service) {
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering asprintf(&from, SYSTEM_DATA_UNIT_PATH "/%s", service);
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering asprintf(&to, "%s/multi-user.target.wants/%s", arg_dest, service);
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering log_error("Failed to create symlink from %s to %s: %m", from, to);
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poetteringstatic bool file_is_executable(const char *f) {
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering return S_ISREG(st.st_mode) && (st.st_mode & 0111);
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering log_error("This program takes one or no arguments.");
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering log_debug("Automatically adding rc-local.service.");