diff --git a/profile.d/fun.sh b/profile.d/fun.sh new file mode 100644 index 0000000..90db1b1 --- /dev/null +++ b/profile.d/fun.sh @@ -0,0 +1,48 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) 2013-2022 Geoffray Levasseur +# Protected by the BSD3 license. Please read bellow for details. +# +# * Redistribution and use in source and binary forms, +# * with or without modification, are permitted provided +# * that the following conditions are met: +# * +# * Redistributions of source code must retain the above +# * copyright notice, this list of conditions and the +# * following disclaimer. +# * +# * Redistributions in binary form must reproduce the above +# * copyright notice, this list of conditions and the following +# * disclaimer in the documentation and/or other materials +# * provided with the distribution. +# * +# * Neither the name of the copyright holder nor the names +# * of any other contributors may be used to endorse or +# * promote products derived from this software without +# * specific prior written permission. +# * +# * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# * OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# Make non-IT peoples think you're busy doing something hard +# ------------------------------------------------------------------------------ +busy() +{ + if [[ -n $1 ]]; then + local pattern="$@" + else + local pattern="ca fe" + fi + cat /dev/urandom | hexdump -C | grep "$pattern" + unset pattern +} diff --git a/profile.sh b/profile.sh index 2365cc2..3816c6f 100644 --- a/profile.sh +++ b/profile.sh @@ -81,9 +81,16 @@ pathappend () # Store script's path (realpath -s resolve symlinks if profile.sh is a symlink) export MYPATH=$(dirname $(realpath -s $0)) +if [[ ! -e $MYPATH/profile.sh ]]; then + disp W "Path detection failed, using pwd..." + MYPATH=$(pwd) + if [[ ! -e $MYPATH/profile.sh ]]; then + disp E "Impossible to determine installation path, pretty much nothing will work." + fi +fi if [[ ! -s $MYPATH/version ]]; then - echo "Impossible to determine running version of profile, your installation might be broken." + disp W "Impossible to determine running version of profile, your installation might be broken." fi export PROFVERSION=$(cat $MYPATH/version)