X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=boot;h=2c3daaa036eefcfac84fb0165f534ebd0d8713d7;hp=fd56b32d92c145d2861ec304084640ba7aec4ab1;hb=af8421fe8ce3fa4efbc650dda89b071a4038cb1d;hpb=d86bad80996b986173c73c6a7bc2a072f1df3bdf diff --git a/boot b/boot index fd56b32..2c3daaa 100755 --- a/boot +++ b/boot @@ -5,18 +5,22 @@ set -e abs="${BASH_SOURCE[0]}" -# bash-2.0 (RHEL3) if [ -z "$abs" ];then - abs="$PWD" - echo >&2 "WARNING: Defaulting to: HOME=$abs" + # bash-2.0 (RHEL3) + abs="`history 1|awk '/\/boot *$/{print $NF}'`" fi -if [ "$abs" = "${abs#/}" ];then +if [ -n "$abs" -a "$abs" = "${abs#/}" ];then abs="$PWD/$abs" fi -abs="`dirname "$abs"`" -export HOME="$abs" +if [ -z "$abs" ];then + HOME="$PWD" + echo >&2 "WARNING: Defaulting to: HOME=$HOME" +else + abs="`dirname "$abs"`" + HOME="$abs" +fi unset abs cd set +e -. .bashrc +. .bash_profile echo OK