diff options
author | Linus Groh <mail@linusgroh.de> | 2020-04-27 19:09:43 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-28 10:18:58 +0200 |
commit | 92671be906066affa0aaf072615d094e50440c8a (patch) | |
tree | bb05a608e4e99141e965d25c1295e030254ea0ea /Ports/neofetch | |
parent | 092e27563302de9dc8355d5fbabdcee0e8170aab (diff) | |
download | serenity-92671be906066affa0aaf072615d094e50440c8a.zip |
Ports: Add neofetch
Diffstat (limited to 'Ports/neofetch')
-rwxr-xr-x | Ports/neofetch/package.sh | 6 | ||||
-rw-r--r-- | Ports/neofetch/patches/add-serenity-support.patch | 275 | ||||
-rw-r--r-- | Ports/neofetch/patches/fix-shebang.patch | 8 |
3 files changed, 289 insertions, 0 deletions
diff --git a/Ports/neofetch/package.sh b/Ports/neofetch/package.sh new file mode 100755 index 0000000000..bf0c9e48b1 --- /dev/null +++ b/Ports/neofetch/package.sh @@ -0,0 +1,6 @@ +#!/bin/bash ../.port_include.sh +port=neofetch +version=7.0.0 +useconfigure=false +depends=bash +files="https://github.com/dylanaraps/neofetch/archive/${version}.tar.gz neofetch-${version}.tar.gz" diff --git a/Ports/neofetch/patches/add-serenity-support.patch b/Ports/neofetch/patches/add-serenity-support.patch new file mode 100644 index 0000000000..b7b64b7c1f --- /dev/null +++ b/Ports/neofetch/patches/add-serenity-support.patch @@ -0,0 +1,275 @@ +--- neofetch-7.0.0/neofetch 2020-04-27 15:12:00.884771680 +0100 ++++ neofetch-7.0.0/neofetch 2020-04-27 20:10:22.265079042 +0100 +@@ -775,7 +775,7 @@ + # PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix, Raspbian, + # Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan, Regata, + # Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific, Septor, +-# SharkLinux, Siduction, Slackware, SliTaz, SmartOS, Solus, ++# SerenityOS, SharkLinux, Siduction, Slackware, SliTaz, SmartOS, Solus, + # Source_Mage, Sparky, Star, SteamOS, SunOS, openSUSE_Leap, + # openSUSE_Tumbleweed, openSUSE, SwagArch, Tails, Trisquel, + # Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio, Ubuntu, +@@ -923,6 +923,8 @@ + : Windows + ;; + ++ SerenityOS): SerenityOS ;; ++ + *) + printf '%s\n' "Unknown OS detected: '$kernel_name', aborting..." >&2 + printf '%s\n' "Open an issue on GitHub to add support for your OS." >&2 +@@ -1142,6 +1144,10 @@ + FreeMiNT) + distro=FreeMiNT + ;; ++ ++ SerenityOS) ++ distro=SerenityOS ++ ;; + esac + + distro=${distro//Enterprise Server} +@@ -1306,7 +1312,7 @@ + + get_kernel() { + # Since these OS are integrated systems, it's better to skip this function altogether +- [[ $os =~ (AIX|IRIX) ]] && return ++ # [[ $os =~ (AIX|IRIX) ]] && return + + # Haiku uses 'uname -v' and not - 'uname -r'. + [[ $os == Haiku ]] && { +@@ -1327,17 +1333,17 @@ + esac + + # Hide kernel info if it's identical to the distro info. +- [[ $os =~ (BSD|MINIX) && $distro == *"$kernel_name"* ]] && +- case $distro_shorthand in +- on|tiny) kernel=$kernel_version ;; +- *) unset kernel ;; +- esac ++ # [[ $os =~ (BSD|MINIX) && $distro == *"$kernel_name"* ]] && ++ # case $distro_shorthand in ++ # on|tiny) kernel=$kernel_version ;; ++ # *) unset kernel ;; ++ # esac + } + + get_uptime() { + # Get uptime in seconds. + case $os in +- Linux|Windows|MINIX) ++ Linux|Windows|MINIX|SerenityOS) + if [[ -r /proc/uptime ]]; then + s=$(< /proc/uptime) + s=${s/.*} +@@ -1396,7 +1402,10 @@ + + uptime=${d:+$d, }${h:+$h, }$m + uptime=${uptime%', '} +- uptime=${uptime:-$seconds secs} ++ # s/$seconds/$s ++ # Note: this was fixed upstream already but not released yet ++ # https://github.com/dylanaraps/neofetch/commit/e960c5168654211a8429e8089ba160e3cc89dc37 ++ uptime=${uptime:-$s secs} + + # Make the output of uptime smaller. + case $uptime_shorthand in +@@ -1577,6 +1586,8 @@ + off) shell="${SHELL##*/} " ;; + esac + ++ [[ $os == SerenityOS ]] && shell="SerenityOS Shell" ++ + [[ $shell_version != on ]] && return + + case ${shell_name:=${SHELL##*/}} in +@@ -2030,13 +2041,13 @@ + speed_dir="/sys/devices/system/cpu/cpu0/cpufreq" + + # Select the right temperature file. +- for temp_dir in /sys/class/hwmon/*; do +- [[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power|k10temp) ]] && { +- temp_dirs=("$temp_dir"/temp*_input) +- temp_dir=${temp_dirs[0]} +- break +- } +- done ++ # for temp_dir in /sys/class/hwmon/*; do ++ # [[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power|k10temp) ]] && { ++ # temp_dirs=("$temp_dir"/temp*_input) ++ # temp_dir=${temp_dirs[0]} ++ # break ++ # } ++ # done + + # Get CPU speed. + if [[ -d "$speed_dir" ]]; then +@@ -2201,6 +2212,17 @@ + cpu="$(awk -F':' '/CPU:/ {printf $2}' /kern/cpuinfo)" + speed="$(awk -F '[:.M]' '/Clocking:/ {printf $2}' /kern/cpuinfo)" + ;; ++ ++ "SerenityOS") ++ while IFS=":" read -r a b; do ++ case $a in ++ "brandstr") cpu="${b//\"}" ;; ++ esac ++ done < /proc/cpuinfo ++ # `cpu` will contain "@ [speed]GHz" and to be super correct we ++ # have to cut that off and store it in `speed` only for neofetch ++ # to append it again later - but that's fine for now this way. ++ ;; + esac + + # Remove un-needed patterns from cpu output. +@@ -2585,6 +2607,16 @@ + mem_used="$((mem_used / 1024))" + ;; + ++ "SerenityOS") ++ while IFS=":" read -d "," -r a b; do ++ case $a in ++ "\"user_physical_allocated\"") mem_used="$((b * 4096 / 1024 / 1024))" ;; ++ "\"user_physical_available\"") mem_free="$((b * 4096 / 1024 / 1024))" ;; ++ esac ++ done < /proc/memstat ++ mem_total="$((mem_used + mem_free))" ++ ;; ++ + esac + + [[ "$memory_percent" == "on" ]] && ((mem_perc=mem_used * 100 / mem_total)) +@@ -3027,6 +3059,17 @@ + theme="${theme/ '[Plasma]'}" + fi + fi ++ ++ if [[ "$os" == "SerenityOS" ]]; then ++ theme="Default" ++ # This will stop working if there's another "Name" key! ++ # We somehow need to check if the current section is "[Theme]". ++ while IFS="=" read -r a b; do ++ case $a in ++ $serenity) theme="${b}" ;; ++ esac ++ done < /etc/WindowServer/WindowServer.ini ++ fi + } + + get_theme() { +@@ -3035,6 +3078,7 @@ + gconf="gtk_theme" + xfconf="/Net/ThemeName" + kde="Name" ++ serenity="Name" + + get_style + } +@@ -3045,6 +3089,7 @@ + gconf="icon_theme" + xfconf="/Net/IconThemeName" + kde="Theme" ++ serenity= + + get_style + icons="$theme" +@@ -3074,6 +3119,8 @@ + *) term="${TERM_PROGRAM/\.app}" ;; + esac + ++ [[ $os == SerenityOS ]] && term="SerenityOS Terminal" ++ + # Most likely TosWin2 on FreeMiNT - quick check + [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && term="TosWin2" + [[ "$SSH_CONNECTION" ]] && term="$SSH_TTY" +@@ -3637,10 +3684,10 @@ + } + + get_public_ip() { +- if type -p dig >/dev/null; then +- public_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com)" +- [[ "$public_ip" =~ ^\; ]] && unset public_ip +- fi ++ # if type -p dig >/dev/null; then ++ # public_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com)" ++ # [[ "$public_ip" =~ ^\; ]] && unset public_ip ++ # fi + + if [[ -z "$public_ip" ]] && type -p drill >/dev/null; then + public_ip="$(drill myip.opendns.com @resolver1.opendns.com | \ +@@ -3785,13 +3832,13 @@ + } + + print_ascii() { +- if [[ -f "$image_source" && ! "$image_source" =~ (png|jpg|jpeg|jpe|svg|gif) ]]; then +- ascii_data="$(< "$image_source")" +- elif [[ "$image_source" == "ascii" || $image_source == auto ]]; then +- : +- else +- ascii_data="$image_source" +- fi ++ # if [[ -f "$image_source" && ! "$image_source" =~ (png|jpg|jpeg|jpe|svg|gif) ]]; then ++ # ascii_data="$(< "$image_source")" ++ # elif [[ "$image_source" == "ascii" || $image_source == auto ]]; then ++ # : ++ # else ++ # ascii_data="$image_source" ++ # fi + + # Set locale to get correct padding. + LC_ALL="$sys_locale" +@@ -4549,8 +4596,8 @@ + padding=${xrdb/*internalBorder:} + padding=${padding/$'\n'*} + +- [[ $padding =~ ^[0-9]+$ ]] || +- padding= ++ # [[ $padding =~ ^[0-9]+$ ]] || ++ # padding= + ;; + esac + } +@@ -4834,7 +4881,7 @@ + PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix, Raspbian, + Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan, Regata, + Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific, Septor, +- SharkLinux, Siduction, Slackware, SliTaz, SmartOS, Solus, ++ SerenityOS, SharkLinux, Siduction, Slackware, SliTaz, SmartOS, Solus, + Source_Mage, Sparky, Star, SteamOS, SunOS, openSUSE_Leap, + openSUSE_Tumbleweed, openSUSE, SwagArch, Tails, Trisquel, + Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio, Ubuntu, +@@ -9097,6 +9144,34 @@ + EOF + ;; + ++ "SerenityOS"*) ++ set_colors 3 1 7 8 15 ++ read -rd '' ascii_data <<'EOF' ++${c4} _ __ ++ / o \ ,^ _ `\ ++ \./ ] | /* / ++${c5} - *~ .#_ ${c4}`--` ++${c5} ,` ' "w ++${c5} ]` / ]${c4}Kp ++${c5} B 'M %m ]${c4}KK ++ K${c5}p \ #${c4}KKH ++ KK${c5}N,,,w,__,#${c4}KKK ++ `KKK${c2}\KKKKK${c4}KKK${c3}KK${c4}${c2}KNw${c4} ++ #R${c3}K${c4}K${c3}\KK${c4}gKKKH${c3}L5${c4}${c2}KK${c4}K ++ ]K${c3}|a${c4}#KKKKKBKNp${c3}LI${c4}${c2}K${c4}KN ++ .K${c3}K${c4}KDKBKBBKKKKKKN${c3}]${c4}${c2}KK${c4} ++${c2} ]K${c3}IMK${c4}KBKKKKKKKK${c3}RMI${c4}${c2}KKH${c4} ++${c2} ]K${c3}I${c4}#KkBBBBBBKKKKN${c3}I${c4}${c2}KK${c4} ++${c2} ]K${c3}[K${c4}KKBKKKKKKKKM${c3}*]${c4}KK ++ `KN${c3}|1${c4}KKKKKKKBKM${c3}`L${c4}KKM ++ `KN${c3},|]${c4}KKKKK${c3}/|L;${c4}${c2}#${c4}KK ++ `--KKK KK${c2}KKKKK${c4} ++ aaNKKKaKK ${c2}`${c4} ++ KKKKKKKKM ++ ```` ++EOF ++ ;; ++ + "SharkLinux"*) + set_colors 4 7 + read -rd '' ascii_data <<'EOF' diff --git a/Ports/neofetch/patches/fix-shebang.patch b/Ports/neofetch/patches/fix-shebang.patch new file mode 100644 index 0000000000..9fe36cd60a --- /dev/null +++ b/Ports/neofetch/patches/fix-shebang.patch @@ -0,0 +1,8 @@ +--- neofetch-7.0.0/neofetch 2020-04-27 15:12:00.884771680 +0100 ++++ neofetch-7.0.0/neofetch 2020-04-27 18:57:54.263417418 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/bash + # vim: noai:ts=4:sw=4:expandtab + # shellcheck source=/dev/null + # shellcheck disable=2009 |