Skip to content

Commit

Permalink
api: generate_logo fix using the simpler logo on all Ubuntu versions
Browse files Browse the repository at this point in the history
rather than using `package_latest_version` on `libicu-dev` which would be somewhat slow, check the binary of `libicudata.so` and see which version it is symlinked to

if the binary `libicudata.so` is not in the expected location, assume the version is lower than Unicode 13 and use the simpler logo
  • Loading branch information
theofficialgman committed Jan 21, 2024
1 parent f71cae6 commit 2a083b4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions api
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,17 @@ generate_logo() { #display colorized Pi-Apps logo in terminal
bg_black='\e[40m'
bg_white='\e[107m'

#use simpler logo if OS is Buster or lower - to fix issue https://github.com/Botspot/pi-apps/issues/1441
local version_id="$(grep 'VERSION_ID=' /etc/os-release | tr -cd '0123456789.')"
if [[ "$version_id" != *\.* ]] && [ "$version_id" -ge 11 ];then
#complex logo requires Unicode 13 support (libicu66+)
#this is available in Ubuntu 20.04+ and Debian 11+
#use simpler logo when not supported to fix issue https://github.com/Botspot/pi-apps/issues/1441
if [ -f /usr/lib/aarch64-linux-gnu/libicudata.so ]; then
local version="$(file /usr/lib/aarch64-linux-gnu/libicudata.so | sed -n 's/.*libicudata.so.//p')"
elif [ -f /usr/lib/arm-linux-gnueabihf/libicudata.so ]; then
local version="$(file /usr/lib/arm-linux-gnueabihf/libicudata.so | sed -n 's/.*libicudata.so.//p')"
else
local version="65"
fi
if (( $(echo "$version >= 66" | bc -l) )); then
echo -e "${bg_default} ${green}🭊${darkgreen}🬹🬹🬹${green}🬿${default} ${darkgreen} ${default}
${blue1}🭇🬭🬭${green}\e[48;5;26m🬎${bg_default}${blue2}🬭🬭🬭${blue3}${green}\e[48;5;26m🬎${bg_default}${blue3}🬭🬭🬼${default} ${darkgreen} ${default}
${blue1}🮉${bg_black} ${red}▄ ▄ ▄${blue3} ${bg_default}${default} █▀▀🭍 ▄ ${darkgreen} ${black} ${darkgreen} ${black} ${darkgreen} ${default}
Expand Down

2 comments on commit 2a083b4

@Botspot
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious about the choice to use bc to perform the comparison here.

@theofficialgman
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bash can't compare numbers with decimals.
The .so file end links look like .so.70.2

Please sign in to comment.