few varaible securisation, new alias hdu

This commit is contained in:
Geoffray Levasseur-Brandin
2025-06-19 14:41:31 +02:00
parent e9e9993dfc
commit 56e34bc346

View File

@@ -36,7 +36,7 @@
# ------------------------------------------------------------------------------
if [[ ! $SHELL =~ bash|zsh ]]; then
echo "That environmet script is designed to be used with bash or zsh being the shell."
echo "That environment script is designed to be used with bash or zsh being the shell."
echo "Please consider using bash or zsh instead, or patch me ;)!"
return 1
fi
@@ -46,7 +46,7 @@ fi
# ------------------------------------------------------------------------------
pathremove()
{
local ifs=':'
local IFS=':'
local newpath
local dir
local pathvar=${2:-PATH}
@@ -79,23 +79,23 @@ pathappend()
# ------------------------------------------------------------------------------
# Store script's path (realpath -s resolve symlinks if profile.sh is a symlink)
if [[ -z $PROFILE_PATH ]]; then
export MYPATH=$(dirname $(realpath -s $0))
if [[ -z "$PROFILE_PATH" ]]; then
export MYPATH=$(dirname "$(realpath -s "$0")")
else
export MYPATH=$PROFILE_PATH
export MYPATH="$PROFILE_PATH"
fi
if [[ ! -e $MYPATH/profile.sh ]]; then
if [[ ! -e "$MYPATH/profile.sh" ]]; then
echo "[ Warning ] Path detection failed, trying to use pwd..."
MYPATH=$(pwd)
if [[ ! -e $MYPATH/profile.sh ]]; then
if [[ ! -e "$MYPATH/profile.sh" ]]; then
echo "[ Error ] Impossible to determine installation path, pretty much nothing will work."
fi
fi
if [[ ! -s $MYPATH/version ]]; then
if [[ ! -s "$MYPATH/version" ]]; then
echo "[ Warning ] Impossible to determine running version of profile, your installation might be broken."
fi
export PROFVERSION=$(cat $MYPATH/version)
export PROFVERSION=$(cat "$MYPATH"/version)
# Build PATH environment variable
if [[ $EUID -eq 0 ]]; then
@@ -175,6 +175,7 @@ if [[ $INTERACTIVE ]]; then
alias du='du -ch'
alias sdu='du -sk ./* | sort -n'
alias hdu='du -hs ./* | sort -H'
# Define PS1
trap 'timer_start' DEBUG