Skip to content

Commit

Permalink
Fix paths
Browse files Browse the repository at this point in the history
  • Loading branch information
wkennington committed Nov 4, 2016
1 parent c9411a2 commit c81d700
Show file tree
Hide file tree
Showing 44 changed files with 63 additions and 170 deletions.
3 changes: 1 addition & 2 deletions man/sysctl.d.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
<refsynopsisdiv>
<para><filename>/etc/sysctl.d/*.conf</filename></para>
<para><filename>/run/sysctl.d/*.conf</filename></para>
<para><filename>/usr/lib/sysctl.d/*.conf</filename></para>
</refsynopsisdiv>

<refsect1>
Expand Down Expand Up @@ -128,7 +127,7 @@
</para>

<programlisting>ACTION=="add", SUBSYSTEM=="module", KERNEL=="br_netfilter", \
RUN+="/usr/lib/systemd/systemd-sysctl --prefix=/net/bridge"
RUN+="/run/current-system/sw/lib/systemd/systemd-sysctl --prefix=/net/bridge"
</programlisting>

<para><filename>/etc/sysctl.d/bridge.conf</filename>:
Expand Down
21 changes: 3 additions & 18 deletions src/basic/def.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,8 @@
#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
#define SIGNALS_IGNORE SIGPIPE

#ifdef HAVE_SPLIT_USR
#define KBD_KEYMAP_DIRS \
"/usr/share/keymaps/\0" \
"/usr/share/kbd/keymaps/\0" \
"/usr/lib/kbd/keymaps/\0" \
"/lib/kbd/keymaps/\0"
#else
#define KBD_KEYMAP_DIRS \
"/usr/share/keymaps/\0" \
"/usr/share/kbd/keymaps/\0" \
"/usr/lib/kbd/keymaps/\0"
#endif
#define KBD_KEYMAP_DIRS \
"/run/current-system/sw/share/keymaps/\0"

#define UNIX_SYSTEM_BUS_ADDRESS "unix:path=/var/run/dbus/system_bus_socket"
#define KERNEL_SYSTEM_BUS_ADDRESS "kernel:path=/sys/fs/kdbus/0-system/bus"
Expand All @@ -72,11 +62,7 @@
#define NOTIFY_FD_MAX 768
#define NOTIFY_BUFFER_MAX PIPE_BUF

#ifdef HAVE_SPLIT_USR
#define _CONF_PATHS_SPLIT_USR(n) "/lib/" n "\0"
#else
#define _CONF_PATHS_SPLIT_USR(n)
#endif

/* Return a nulstr for a standard cascade of configuration paths,
* suitable to pass to conf_files_list_nulstr() or config_parse_many_nulstr()
Expand All @@ -85,6 +71,5 @@
#define CONF_PATHS_NULSTR(n) \
"/etc/" n "\0" \
"/run/" n "\0" \
"/usr/local/lib/" n "\0" \
"/usr/lib/" n "\0" \
"/run/current-system/sw/lib/" n "\0" \
_CONF_PATHS_SPLIT_USR(n)
4 changes: 2 additions & 2 deletions src/basic/locale-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int add_locales_from_archive(Set *locales) {
unsigned i;
int r;

fd = open("/usr/lib/locale/locale-archive", O_RDONLY|O_NOCTTY|O_CLOEXEC);
fd = open("/run/current-system/sw/lib/locale/locale-archive", O_RDONLY|O_NOCTTY|O_CLOEXEC);
if (fd < 0)
return errno == ENOENT ? 0 : -errno;

Expand Down Expand Up @@ -146,7 +146,7 @@ static int add_locales_from_libdir (Set *locales) {
struct dirent *entry;
int r;

dir = opendir("/usr/lib/locale");
dir = opendir("/run/current-system/sw/lib/locale");
if (!dir)
return errno == ENOENT ? 0 : -errno;

Expand Down
3 changes: 1 addition & 2 deletions src/basic/path-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,7 @@ static int binary_is_good(const char *binary) {
return r;

return !PATH_IN_SET(d, "true"
"/bin/true",
"/usr/bin/true",
"/run/current-system/sw/bin/true",
"/dev/null");
}

Expand Down
2 changes: 1 addition & 1 deletion src/basic/path-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "time-util.h"

#define DEFAULT_PATH_NORMAL "/no-such-path"
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":/sbin:/bin"
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL

#ifdef HAVE_SPLIT_USR
# define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
Expand Down
6 changes: 0 additions & 6 deletions src/basic/stat-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ int path_is_os_tree(const char *path) {

assert(path);

/* We use /usr/lib/os-release as flag file if something is an OS */
p = strjoina(path, "/usr/lib/os-release");
r = access(p, F_OK);
if (r >= 0)
return 1;

/* Also check for the old location in /etc, just in case. */
p = strjoina(path, "/etc/os-release");
r = access(p, F_OK);
Expand Down
1 change: 1 addition & 0 deletions src/basic/user-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ int get_user_creds_clean(

if (shell &&
(isempty(*shell) || PATH_IN_SET(*shell,
"/run/current-system/sw/bin/nologin",
"/bin/nologin",
"/sbin/nologin",
"/usr/bin/nologin",
Expand Down
13 changes: 4 additions & 9 deletions src/core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1233,11 +1233,6 @@ static int status_welcome(void) {
"PRETTY_NAME", &pretty_name,
"ANSI_COLOR", &ansi_color,
NULL);
if (r == -ENOENT)
r = parse_env_file("/usr/lib/os-release", NEWLINE,
"PRETTY_NAME", &pretty_name,
"ANSI_COLOR", &ansi_color,
NULL);

if (r < 0 && r != -ENOENT)
log_warning_errno(r, "Failed to read os-release file: %m");
Expand Down Expand Up @@ -1518,7 +1513,7 @@ int main(int argc, char *argv[]) {
/* But at the same time, turn off the core_pattern logic by default, so that no coredumps are stored
* until the systemd-coredump tool is enabled via sysctl. */
if (!skip_setup)
(void) write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
(void) write_string_file("/proc/sys/kernel/core_pattern", "|/run/current-system/sw/bin/false", 0);
}

if (arg_system) {
Expand Down Expand Up @@ -2091,18 +2086,18 @@ int main(int argc, char *argv[]) {
log_warning_errno(errno, "Failed to execute configured init, trying fallback: %m");
}

args[0] = "/sbin/init";
args[0] = "/no-such-path/init";
(void) execv(args[0], (char* const*) args);

if (errno == ENOENT) {
log_warning("No /sbin/init, trying fallback");
log_warning("No /no-such-path/init, trying fallback");

args[0] = "/bin/sh";
args[1] = NULL;
(void) execv(args[0], (char* const*) args);
log_error_errno(errno, "Failed to execute /bin/sh, giving up: %m");
} else
log_warning_errno(errno, "Failed to execute /sbin/init, giving up: %m");
log_warning_errno(errno, "Failed to execute /no-such-path/init, giving up: %m");
}

arg_serialization = safe_fclose(arg_serialization);
Expand Down
2 changes: 1 addition & 1 deletion src/core/org.freedesktop.systemd1.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

[D-BUS Service]
Name=org.freedesktop.systemd1
Exec=/bin/false
Exec=/run/current-system/sw/bin/false
User=root
4 changes: 2 additions & 2 deletions src/core/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ static void swap_enter_activating(Swap *s) {
}
}

r = exec_command_set(s->control_command, "/sbin/swapon", NULL);
r = exec_command_set(s->control_command, "/run/current-system/sw/bin/swapon", NULL);
if (r < 0)
goto fail;

Expand Down Expand Up @@ -799,7 +799,7 @@ static void swap_enter_deactivating(Swap *s) {
s->control_command = s->exec_command + SWAP_EXEC_DEACTIVATE;

r = exec_command_set(s->control_command,
"/sbin/swapoff",
"/run/current-system/sw/bin/swapoff",
s->what,
NULL);
if (r < 0)
Expand Down
2 changes: 1 addition & 1 deletion src/coredump/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ static int process_kernel(int argc, char* argv[]) {
/* If this is PID 1 disable coredump collection, we'll unlikely be able to process it later on. */
if (streq(t, SPECIAL_INIT_SCOPE)) {
log_notice("Due to PID 1 having crashed coredump collection will now be turned off.");
(void) write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
(void) write_string_file("/proc/sys/kernel/core_pattern", "|/run/current-system/sw/bin/false", 0);
}

/* Let's avoid dead-locks when processing journald and init crashes, as socket activation and logging
Expand Down
4 changes: 2 additions & 2 deletions src/cryptsetup/cryptsetup-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ static int create_disk(

if (tmp)
fprintf(f,
"ExecStartPost=/sbin/mke2fs '/dev/mapper/%s'\n",
"ExecStartPost=/run/current-system/sw/bin/mke2fs '/dev/mapper/%s'\n",
name);

if (swap)
fprintf(f,
"ExecStartPost=/sbin/mkswap '/dev/mapper/%s'\n",
"ExecStartPost=/run/current-system/sw/bin/mkswap '/dev/mapper/%s'\n",
name);

r = fflush_and_check(f);
Expand Down
8 changes: 1 addition & 7 deletions src/delta/delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@
static const char prefixes[] =
"/etc\0"
"/run\0"
"/usr/local/lib\0"
"/usr/local/share\0"
"/usr/lib\0"
"/usr/share\0"
#ifdef HAVE_SPLIT_USR
"/lib\0"
#endif
"/run/current-software/sw/lib\0"
;

static const char suffixes[] =
Expand Down
7 changes: 0 additions & 7 deletions src/firstboot/firstboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,6 @@ static void print_welcome(void) {
r = parse_env_file(os_release, NEWLINE,
"PRETTY_NAME", &pretty_name,
NULL);
if (r == -ENOENT) {

os_release = prefix_roota(arg_root, "/usr/lib/os-release");
r = parse_env_file(os_release, NEWLINE,
"PRETTY_NAME", &pretty_name,
NULL);
}

if (r < 0 && r != -ENOENT)
log_warning_errno(r, "Failed to read os-release file: %m");
Expand Down
5 changes: 0 additions & 5 deletions src/hostname/hostnamed.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ static int context_read_data(Context *c) {
"PRETTY_NAME", &c->data[PROP_OS_PRETTY_NAME],
"CPE_NAME", &c->data[PROP_OS_CPE_NAME],
NULL);
if (r == -ENOENT)
r = parse_env_file("/usr/lib/os-release", NEWLINE,
"PRETTY_NAME", &c->data[PROP_OS_PRETTY_NAME],
"CPE_NAME", &c->data[PROP_OS_CPE_NAME],
NULL);

if (r < 0 && r != -ENOENT)
return r;
Expand Down
2 changes: 1 addition & 1 deletion src/hostname/org.freedesktop.hostname1.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

[D-BUS Service]
Name=org.freedesktop.hostname1
Exec=/bin/false
Exec=/run/current-system/sw/bin/false
User=root
SystemdService=dbus-org.freedesktop.hostname1.service
2 changes: 1 addition & 1 deletion src/import/org.freedesktop.import1.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

[D-BUS Service]
Name=org.freedesktop.import1
Exec=/bin/false
Exec=/run/current-system/sw/bin/false
User=root
SystemdService=dbus-org.freedesktop.import1.service
3 changes: 1 addition & 2 deletions src/journal-remote/journal-gatewayd.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,7 @@ static int request_handler_machine(
if (r < 0)
return mhd_respondf(connection, r, MHD_HTTP_INTERNAL_SERVER_ERROR, "Failed to determine disk usage: %m");

if (parse_env_file("/etc/os-release", NEWLINE, "PRETTY_NAME", &os_name, NULL) == -ENOENT)
(void) parse_env_file("/usr/lib/os-release", NEWLINE, "PRETTY_NAME", &os_name, NULL);
(void) parse_env_file("/etc/os-release", NEWLINE, "PRETTY_NAME", &os_name, NULL);

get_virtualization(&v);

Expand Down
2 changes: 1 addition & 1 deletion src/journal/cat.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) {
fd = -1;

if (argc <= optind)
(void) execl("/bin/cat", "/bin/cat", NULL);
(void) execl("/run/current-system/sw/bin/cat", "/run/current-system/sw/bin/cat", NULL);
else
(void) execvp(argv[optind], argv + optind);
r = -errno;
Expand Down
3 changes: 1 addition & 2 deletions src/journal/catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
#include "util.h"

const char * const catalog_file_dirs[] = {
"/usr/local/lib/systemd/catalog/",
"/usr/lib/systemd/catalog/",
"/run/current-system/sw/lib/systemd/catalog/",
NULL
};

Expand Down
1 change: 0 additions & 1 deletion src/kernel-install/kernel-install
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ ret=0
readarray -t PLUGINS < <(
dropindirs_sort ".install" \
"/etc/kernel/install.d" \
"/usr/lib/kernel/install.d"
)

case $COMMAND in
Expand Down
4 changes: 0 additions & 4 deletions src/libsystemd/sd-hwdb/sd-hwdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@ static int trie_search_f(sd_hwdb *hwdb, const char *search) {
static const char hwdb_bin_paths[] =
"/etc/systemd/hwdb/hwdb.bin\0"
"/etc/udev/hwdb.bin\0"
"/usr/lib/systemd/hwdb/hwdb.bin\0"
#ifdef HAVE_SPLIT_USR
"/lib/systemd/hwdb/hwdb.bin\0"
#endif
UDEVLIBEXECDIR "/hwdb.bin\0";

_public_ int sd_hwdb_new(sd_hwdb **ret) {
Expand Down
Loading

0 comments on commit c81d700

Please sign in to comment.