Check in /usr/share/fetch/ascii/ before falling back to script location

This commit is contained in:
Dylan 2016-01-29 09:45:35 +11:00
parent 9bde0eb888
commit 55fcf79796
1 changed files with 28 additions and 15 deletions

19
fetch
View File

@ -1338,9 +1338,14 @@ getascii () {
esac
if [ "$ascii" == "distro" ]; then
# Get distro ascii file
# Lowercase the distro name
ascii=${ascii_distro,,}
# Check /usr/share/fetch for ascii before
# looking in the script's directory.
if [ -f "/usr/share/fetch/ascii/distro/${ascii/ *}" ]; then
ascii="/usr/share/fetch/ascii/distro/${ascii/ *}"
else
# Use $0 to get the script's physical path.
cd "${0%/*}"
ascii_dir=${0##*/}
@ -1354,7 +1359,14 @@ getascii () {
# Final directory
ascii_dir="$(pwd -P)"
if [ -f "$ascii_dir/ascii/distro/${ascii/ *}" ]; then
ascii="$ascii_dir/ascii/distro/${ascii/ *}"
else
padding="\033[0C"
return
fi
fi
# Overwrite distro colors if '$ascii_color` doesn't
# equal 'distro'.
@ -1378,9 +1390,10 @@ getascii () {
print="${ascii_color}$(<"$ascii")"
fi
# Strip escape codes backslashes from contents of
# the ascii file.
# Turn the file into a variable.
ascii_strip=$(<$ascii)
# Strip escape codes backslashes from contents of
ascii_strip=${ascii_strip//\$\{??\}}
ascii_strip=${ascii_strip//\\}