mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 05:52:48 +07:00
Remove hard-coded paths to system tools available in $PATH
Since at least a44daf2 both run() and run_interactive() can access all
system tools in _PATH_STDPATH. A system that uses non-standard paths,
e.g. /system/bin and /apps/bin, should update _PATH_STDPATH.
For reference, see issue #69 and PRs #70 and #72.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+2
-2
@@ -31,14 +31,14 @@ static void save(void *arg)
|
||||
{
|
||||
_d("Saving system clock to RTC ...");
|
||||
/* -w,--systohc, -u,--utc */
|
||||
run_interactive("/sbin/hwclock -w -u", "Saving system time (UTC) to RTC");
|
||||
run_interactive("hwclock -w -u", "Saving system time (UTC) to RTC");
|
||||
}
|
||||
|
||||
static void restore(void *arg)
|
||||
{
|
||||
_d("Restoring system clock from RTC ...");
|
||||
/* -s,--hctosys, -u,--utc */
|
||||
run_interactive("/sbin/hwclock -s -u", "Restoring system clock (UTC) from RTC");
|
||||
run_interactive("hwclock -s -u", "Restoring system clock (UTC) from RTC");
|
||||
}
|
||||
|
||||
static plugin_t plugin = {
|
||||
|
||||
@@ -47,7 +47,7 @@ static void setup(void *arg)
|
||||
if ((fd = open("/var/run/console/console.lock", O_CREAT|O_WRONLY|O_TRUNC, 0644)) >= 0) {
|
||||
write(fd, username, strlen(username));
|
||||
close(fd);
|
||||
run("/sbin/pam_console_apply");
|
||||
run("pam_console_apply");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+3
-3
@@ -231,7 +231,7 @@ static void parse_static(char *line)
|
||||
if (MATCH_CMD(line, "check ", x)) {
|
||||
char *dev = strip_line(x);
|
||||
|
||||
strcpy(cmd, "/sbin/fsck -C -a ");
|
||||
strcpy(cmd, "fsck -C -a ");
|
||||
strlcat(cmd, dev, sizeof(cmd));
|
||||
run_interactive(cmd, "Checking file system %s", dev);
|
||||
|
||||
@@ -253,7 +253,7 @@ static void parse_static(char *line)
|
||||
if (MATCH_CMD(line, "module ", x)) {
|
||||
char *mod = strip_line(x);
|
||||
|
||||
strcpy(cmd, "/sbin/modprobe ");
|
||||
strcpy(cmd, "modprobe ");
|
||||
strlcat(cmd, mod, sizeof(cmd));
|
||||
run_interactive(cmd, "Loading kernel module %s", mod);
|
||||
|
||||
@@ -263,7 +263,7 @@ static void parse_static(char *line)
|
||||
if (MATCH_CMD(line, "mknod ", x)) {
|
||||
char *dev = strip_line(x);
|
||||
|
||||
strcpy(cmd, "/bin/mknod ");
|
||||
strcpy(cmd, "mknod ");
|
||||
strlcat(cmd, dev, sizeof(cmd));
|
||||
run_interactive(cmd, "Creating device node %s", dev);
|
||||
|
||||
|
||||
+4
-4
@@ -130,7 +130,7 @@ static int fsck(int pass)
|
||||
continue;
|
||||
}
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "/sbin/fsck -a %s", fs->fs_spec);
|
||||
snprintf(cmd, sizeof(cmd), "fsck -a %s", fs->fs_spec);
|
||||
run_interactive(cmd, "Checking filesystem %.13s", fs->fs_spec);
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ int main(int argc, char* argv[])
|
||||
* Mount filesystems
|
||||
*/
|
||||
#ifdef REMOUNT_ROOTFS
|
||||
run("/bin/mount -n -o remount,rw /");
|
||||
run("mount -n -o remount,rw /");
|
||||
#endif
|
||||
#ifdef SYSROOT
|
||||
mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
|
||||
@@ -361,10 +361,10 @@ int main(int argc, char* argv[])
|
||||
plugin_run_hooks(HOOK_ROOTFS_UP);
|
||||
|
||||
umask(0);
|
||||
if (run_interactive("/bin/mount -na", "Mounting filesystems"))
|
||||
if (run_interactive("mount -na", "Mounting filesystems"))
|
||||
plugin_run_hooks(HOOK_MOUNT_ERROR);
|
||||
|
||||
run("/sbin/swapon -ea");
|
||||
run("swapon -ea");
|
||||
umask(0022);
|
||||
|
||||
/* Base FS up, enable standard SysV init signals */
|
||||
|
||||
@@ -181,16 +181,16 @@ void do_shutdown(shutop_t op)
|
||||
|
||||
/* Unmount any tmpfs before unmounting swap ... */
|
||||
unmount_tmpfs();
|
||||
run("/sbin/swapoff -e -a");
|
||||
run("swapoff -e -a");
|
||||
|
||||
/* ... unmount remaining regular file systems. */
|
||||
unmount_regular();
|
||||
|
||||
/* We sit on / so we must remount it ro, try all the things! */
|
||||
sync();
|
||||
run("/bin/mount -n -o remount,ro -t dummytype dummydev /");
|
||||
run("/bin/mount -n -o remount,ro dummydev /");
|
||||
run("/bin/mount -n -o remount,ro /");
|
||||
run("mount -n -o remount,ro -t dummytype dummydev /");
|
||||
run("mount -n -o remount,ro dummydev /");
|
||||
run("mount -n -o remount,ro /");
|
||||
|
||||
/* Call mdadm to mark any RAID array(s) as clean before halting. */
|
||||
mdadm_wait();
|
||||
|
||||
Reference in New Issue
Block a user