ports

morpheus ports
git clone git://git.2f30.org/ports
Log | Files | Refs | LICENSE

commit b044190c521211e4637dcd64529664bd2723e139
parent 85f9a6462996b0c2c72303c396d936fd98ad5ab6
Author: sin <sin@2f30.org>
Date:   Tue, 10 Jun 2014 13:51:05 +0100

Don't rely on PATH

Use absolute paths, avoids conflicts with shell builtins etc.

Diffstat:
Mfs/bin/rc.init | 61+++++++++++++++++++++++++++++--------------------------------
Mfs/bin/rc.shutdown | 29+++++++++++++----------------
Mfs/bin/rc.svc | 4++--
3 files changed, 44 insertions(+), 50 deletions(-)

diff --git a/fs/bin/rc.init b/fs/bin/rc.init @@ -1,8 +1,5 @@ #!/bin/sh -PATH=/bin -export PATH - umask 022 . /etc/rc.conf @@ -14,50 +11,50 @@ echo echo # Soft reboot on ctrl-alt-del -ctrlaltdel -s +/bin/ctrlaltdel -s -mount -n -t proc -o nosuid,noexec,nodev proc /proc -mount -n -t sysfs -o nosuid,noexec,nodev sysfs /sys +/bin/mount -n -t proc -o nosuid,noexec,nodev proc /proc +/bin/mount -n -t sysfs -o nosuid,noexec,nodev sysfs /sys -mount -n -t tmpfs -o nosuid,mode=0755 dev /dev -mkdir -p /dev/pts -mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts +/bin/mount -n -t tmpfs -o nosuid,mode=0755 dev /dev +/bin/mkdir -p /dev/pts +/bin/mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts -grep -q " verbose" /proc/cmdline && dmesg -n 8 || dmesg -n 3 +/bin/grep -q " verbose" /proc/cmdline && dmesg -n 8 || dmesg -n 3 -mount -o remount,ro / +/bin/mount -o remount,ro / echo Running smdev -smdev -s +/bin/smdev -s echo Setting smdev as the kernel hotplug echo /bin/smdev > /proc/sys/kernel/hotplug # HACK! cd /dev -ln -sf /proc/self/fd/0 stdin -ln -sf /proc/self/fd/1 stdout +/bin/ln -sf /proc/self/fd/0 stdin +/bin/ln -sf /proc/self/fd/1 stdout cd - 1>/dev/null echo Checking filesystems -fsck -ATa +/bin/fsck -ATa if [ $? -eq 1 ]; then echo Filesystem errors exist, fix manually. - sh - halt -r + /bin/sh + /bin/halt -r fi echo Remounting root as read-write -mount -o remount,rw / +/bin/mount -o remount,rw / echo Mounting filesystems -mount -a +/bin/mount -a echo "Setting hostname to $HOSTNAME" -hostname $HOSTNAME +/bin/hostname $HOSTNAME echo Bringing up the lo interface -ifconfig lo up +/bin/ifconfig lo up HWCLOCK_PARAMS="-s" case $HARDWARECLOCK in @@ -77,21 +74,21 @@ esac if [ -n "$HWCLOCK_PARAMS" ]; then echo Setting hwclock [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE" - hwclock $HWCLOCK_PARAMS /dev/rtc0 + /bin/hwclock $HWCLOCK_PARAMS /dev/rtc0 unset TZ fi echo Setting random seed -[ -f /etc/random-seed ] && cat /etc/random-seed >/dev/urandom -dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null +[ -f /etc/random-seed ] && /bin/cat /etc/random-seed >/dev/urandom +/bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null echo Storing dmesg output to /var/log/dmesg.log -dmesg > /var/log/dmesg.log -if [ -e /proc/sys/kernel/dmesg_restrict ] && [ $(cat /proc/sys/kernel/dmesg_restrict) = "1" ]; +/bin/dmesg > /var/log/dmesg.log +if [ -e /proc/sys/kernel/dmesg_restrict ] && [ $(/bin/cat /proc/sys/kernel/dmesg_restrict) = "1" ]; then - chmod 0600 /var/log/dmesg.log + /bin/chmod 0600 /var/log/dmesg.log else - chmod 0644 /var/log/dmesg.log + /bin/chmod 0644 /var/log/dmesg.log fi if [ -x /bin/rc.modules ]; then @@ -105,7 +102,7 @@ if [ -x /bin/rc.svc ]; then fi echo -sh -c 'respawn getty /dev/tty1 linux' &>/dev/null & -sh -c 'respawn getty /dev/tty2 linux' &>/dev/null & -sh -c 'respawn getty /dev/tty3 linux' &>/dev/null & -sh -c 'respawn getty /dev/tty4 linux' &>/dev/null & +/bin/sh -c '/bin/respawn /bin/getty /dev/tty1 linux' &>/dev/null & +/bin/sh -c '/bin/respawn /bin/getty /dev/tty2 linux' &>/dev/null & +/bin/sh -c '/bin/respawn /bin/getty /dev/tty3 linux' &>/dev/null & +/bin/sh -c '/bin/respawn /bin/getty /dev/tty4 linux' &>/dev/null & diff --git a/fs/bin/rc.shutdown b/fs/bin/rc.shutdown @@ -1,8 +1,5 @@ #!/bin/sh -PATH=/bin -export PATH - umask 022 . /etc/rc.conf @@ -17,7 +14,7 @@ reboot|poweroff) esac # Set linefeed mode to avoid staircase effect -echo; stty onlcr +echo; /bin/stty onlcr echo Shutting down @@ -39,36 +36,36 @@ esac if [ -n "$HWCLOCK_PARAMS" ]; then echo Saving system clock [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE" - hwclock $HWCLOCK_PARAMS /dev/rtc0 + /bin/hwclock $HWCLOCK_PARAMS /dev/rtc0 unset TZ fi echo Storing random seed -dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null +/bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null -svc -k +/bin/svc -k -killall5 -s TERM -sleep 3 -killall5 -s KILL +/bin/killall5 -s TERM +/bin/sleep 3 +/bin/killall5 -s KILL echo Remounting root as read-only -mount -o remount,ro / +/bin/mount -o remount,ro / echo Unmounting filesystems -umount -a +/bin/umount -a -sync -sleep 3 +/bin/sync +/bin/sleep 3 wait echo bye case "$1" in reboot) - halt -r + /bin/halt -r ;; poweroff) - halt -p + /bin/halt -p ;; esac diff --git a/fs/bin/rc.svc b/fs/bin/rc.svc @@ -2,8 +2,8 @@ . /etc/rc.conf -svc -c -svc -s +/bin/svc -c +/bin/svc -s if [ -x /bin/rc.local ]; then echo Running rc.local