fixed version detection, added busy function

This commit is contained in:
2023-02-03 08:09:20 +01:00
parent c2a0ef0bd2
commit fd984c4a16
2 changed files with 56 additions and 1 deletions

48
profile.d/fun.sh Normal file
View File

@@ -0,0 +1,48 @@
# ------------------------------------------------------------------------------
# Copyright (c) 2013-2022 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
# 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
}

View File

@@ -81,9 +81,16 @@ pathappend ()
# Store script's path (realpath -s resolve symlinks if profile.sh is a symlink) # Store script's path (realpath -s resolve symlinks if profile.sh is a symlink)
export MYPATH=$(dirname $(realpath -s $0)) 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 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 fi
export PROFVERSION=$(cat $MYPATH/version) export PROFVERSION=$(cat $MYPATH/version)