aggiornamenti installazione e README
This commit is contained in:
@@ -6,6 +6,23 @@ function this_script_path() {
|
||||
echo "$(cd "$(dirname "$(readlink -f -- "${BASH_SOURCE[1]}")")" > /dev/null && pwd -P)"
|
||||
}
|
||||
|
||||
function feat_bashrc_before_needed() {
|
||||
local bashrc="$HOME/.bashrc"
|
||||
local include_line='. "$HOME/.bashrc.before"'
|
||||
if [ ! -f "$bashrc" ]; then
|
||||
printf 'HOME="%s"\n%s\n' "$HOME" "$include_line" > "$bashrc"
|
||||
return
|
||||
fi
|
||||
if grep -Fqs "$include_line" "$bashrc" || grep -Fqs "$HOME/.bashrc.before" "$bashrc"; then
|
||||
return
|
||||
fi
|
||||
{
|
||||
printf 'HOME="%s"\n%s\n' "$HOME" "$include_line"
|
||||
cat "$bashrc"
|
||||
} > "$bashrc.tmp"
|
||||
mv "$bashrc.tmp" "$bashrc"
|
||||
}
|
||||
|
||||
function feat_missing() {
|
||||
! command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
@@ -13,6 +30,11 @@ function feat_missing() {
|
||||
function feat_needed() {
|
||||
FEAT="$1"
|
||||
if feat_missing "$FEAT"; then
|
||||
eval "feat_add_$FEAT"
|
||||
if type "feat_add_$FEAT" >/dev/null 2>&1; then
|
||||
eval "feat_add_$FEAT"
|
||||
else
|
||||
echo "Missing function: feat_add_$FEAT" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user