From 81e77426e554a61d85e1738af604359171a6062e Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 8 Jun 2011 22:37:07 -0400 Subject: init: declare PATH, remove absolute paths We were never very consistent about this anyways. Signed-off-by: Dave Reisner --- hooks/btrfs | 4 ++-- hooks/consolefont | 4 ++-- hooks/keymap | 6 +++--- hooks/memdisk | 6 +++--- hooks/udev | 6 +++--- init | 36 +++++++++++++++++++----------------- init_functions | 6 +++--- 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/hooks/btrfs b/hooks/btrfs index c4836c5..8ee5e0e 100644 --- a/hooks/btrfs +++ b/hooks/btrfs @@ -2,6 +2,6 @@ run_hook () { - /sbin/modprobe btrfs - /sbin/btrfs device scan + modprobe btrfs + btrfs device scan } diff --git a/hooks/consolefont b/hooks/consolefont index 8e53eec..07cbd71 100644 --- a/hooks/consolefont +++ b/hooks/consolefont @@ -4,11 +4,11 @@ run_hook () { if [ -e /consolefont.psfu ]; then msg -n ":: Loading console font..." - /usr/sbin/setfont -C /dev/console /consolefont.psfu + setfont -C /dev/console /consolefont.psfu msg "done." elif [ -e /consolefont.psf ]; then msg -n ":: Loading console font..." - /usr/sbin/setfont -C /dev/console /consolefont.psf + setfont -C /dev/console /consolefont.psf msg "done." else msg "No consolefont found despite added hook." diff --git a/hooks/keymap b/hooks/keymap index 9557c26..3593168 100644 --- a/hooks/keymap +++ b/hooks/keymap @@ -5,13 +5,13 @@ run_hook () msg -n ":: Loading keymap..." . /keymap.utf8 if [ "${UTF8}" = "yes" ]; then - /usr/bin/kbd_mode -u -C /dev/console + kbd_mode -u -C /dev/console printf "\033%%G" >> /dev/console else - /usr/bin/kbd_mode -a -C /dev/console + kbd_mode -a -C /dev/console printf "\033%%@" >> /dev/console fi - /sbin/loadkmap < /keymap.bin + loadkmap < /keymap.bin msg "done." fi } diff --git a/hooks/memdisk b/hooks/memdisk index 2c3642e..e3ff345 100644 --- a/hooks/memdisk +++ b/hooks/memdisk @@ -1,11 +1,11 @@ # vim:set ft=sh: run_hook () { - MEMDISK=$(/usr/bin/memdiskfind) + MEMDISK=$(memdiskfind) if [ $? -eq 0 ]; then # We found a memdisk, set up phram - /sbin/modprobe phram phram=memdisk,${MEMDISK} + modprobe phram phram=memdisk,${MEMDISK} # Load mtdblock, the memdisk will be /dev/mtdblock0 - /sbin/modprobe mtdblock + modprobe mtdblock fi } diff --git a/hooks/udev b/hooks/udev index 0340a9c..87aa796 100644 --- a/hooks/udev +++ b/hooks/udev @@ -2,8 +2,8 @@ run_hook () { msg -n ":: Triggering uevents..." - /sbin/udevadm trigger --action=add --type=subsystems - /sbin/udevadm trigger --action=add --type=devices - /sbin/udevadm settle + udevadm trigger --action=add --type=subsystems + udevadm trigger --action=add --type=devices + udevadm settle msg "done." } diff --git a/init b/init index 332b4de..1cb9337 100644 --- a/init +++ b/init @@ -1,26 +1,28 @@ #!/bin/busybox ash # Install busybox's applets as symlinks -/bin/busybox --install -s +PATH=/usr/sbin:/usr/bin:/sbin:/bin + +busybox --install -s . /init_functions mkdir -p /new_root -/bin/mount -t proc proc /proc -o nosuid,noexec,nodev -/bin/mount -t sysfs sys /sys -o nosuid,noexec,nodev +mount -t proc proc /proc -o nosuid,noexec,nodev +mount -t sysfs sys /sys -o nosuid,noexec,nodev if grep -q devtmpfs /proc/filesystems 2>/dev/null; then - /bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid + mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid devtmpfs_mounted=1 else - /bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid + mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid devtmpfs_mounted=0 # We don't have devtmpfs, so add the most important standard devices - /bin/mknod /dev/null c 1 3 - /bin/mknod /dev/zero c 1 5 - /bin/mknod /dev/console c 5 1 + mknod /dev/null c 1 3 + mknod /dev/zero c 1 5 + mknod /dev/console c 5 1 # /dev/mem is needed if we want to load uvesafb before triggering uevents - /bin/mknod /dev/mem c 1 1 + mknod /dev/mem c 1 1 fi -/bin/mount -t tmpfs run /run -o nosuid,noexec,nodev,mode=755,size=10M +mount -t tmpfs run /run -o nosuid,noexec,nodev,mode=755,size=10M root="" init="" @@ -35,7 +37,7 @@ parse_cmdline # if available, start udevd at this stage if [ -x /sbin/udevd ]; then msg ":: Starting udevd..." - /sbin/udevd --daemon --resolve-names=never + udevd --daemon --resolve-names=never udevd_running=1 msg "done." else @@ -49,12 +51,12 @@ if [ -n "${disablehooks}" ]; then fi if [ -n "${earlymodules}" ]; then - /sbin/modprobe -qab ${earlymodules//,/ } + modprobe -qab ${earlymodules//,/ } fi . /config -[ -n "$MODULES" ] && /sbin/modprobe -qab $MODULES +[ -n "$MODULES" ] && modprobe -qab $MODULES # If rootdelay is empty or not a non-negative integer, set it to 10 if [ -z "${rootdelay}" ] || ! [ "${rootdelay}" -ge 0 ]; then @@ -104,15 +106,15 @@ fi # Stop udevd if is running if [ "${udevd_running}" -eq 1 ]; then - /sbin/udevadm control --exit - /sbin/udevadm info --cleanup-db + udevadm control --exit + udevadm info --cleanup-db fi for d in proc sys dev run; do if [ -d /new_root/${d} ]; then - /bin/mount --move /${d} /new_root/${d} + mount --move /${d} /new_root/${d} else - /bin/umount /${d} + umount /${d} fi done exec env -i TERM=$TERM /sbin/switch_root -c /dev/console /new_root ${init} "$@" diff --git a/init_functions b/init_functions index 8e232d7..22c01f0 100644 --- a/init_functions +++ b/init_functions @@ -26,8 +26,8 @@ poll_device() { launch_interactive_shell() { export PS1='[ramfs \W]\$ ' - [ "$1" = "--exec" ] && exec /bin/sh -i - /bin/sh -i + [ "$1" = "--exec" ] && exec sh -i + sh -i } parse_cmdline() { @@ -120,7 +120,7 @@ default_mount_handler() { if [ -n "${rootfstype}" ]; then fstype="${rootfstype}" else - fstype=$(sbin/blkid -u filesystem -o value -s TYPE -p "${root}") + fstype=$(blkid -u filesystem -o value -s TYPE -p "${root}") if [ -z "${fstype}" ]; then err "Unable to determine the file system type of ${root}:" echo "Either it contains no filesystem, an unknown filesystem," -- cgit v1.2.3-24-g4f1b